2022-12-15 06:36:28 -08:00
|
|
|
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
|
|
|
|
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
|
|
|
|
describe('Inline expression editor', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
WorkflowPage.actions.visit();
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.actions.addInitialNodeToCanvas('Manual');
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.actions.addNodeToCanvas('Hacker News');
|
2023-01-18 06:48:36 -08:00
|
|
|
WorkflowPage.actions.openNode('Hacker News');
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.actions.openInlineExpressionEditor();
|
2023-06-08 02:06:09 -07:00
|
|
|
|
|
|
|
cy.on('uncaught:exception', (err) => err.name !== 'ExpressionError');
|
2022-12-15 06:36:28 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve primitive resolvables', () => {
|
2023-03-02 07:50:21 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('1 + 2');
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^3$/);
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
|
|
|
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
2023-01-09 02:44:15 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('"ab"');
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{rightArrow}+');
|
2023-01-09 02:44:15 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('"cd"');
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^abcd$/);
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
|
|
|
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('true && false');
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^false$/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve object resolvables', () => {
|
2023-03-02 07:50:21 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters
|
|
|
|
.inlineExpressionEditorInput()
|
|
|
|
.type('{ a: 1 }', { parseSpecialCharSequences: false });
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^\[Object: \{"a": 1\}\]$/);
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
|
|
|
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters
|
|
|
|
.inlineExpressionEditorInput()
|
|
|
|
.type('{ a: 1 }.a', { parseSpecialCharSequences: false });
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^1$/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve array resolvables', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
2023-08-07 02:52:33 -07:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('[1, 2, 3]');
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^\[Array: \[1,2,3\]\]$/);
|
|
|
|
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
|
|
|
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
2023-01-09 02:44:15 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('[1, 2, 3]');
|
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('[0]');
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^1$/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve $parameter[]', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().clear();
|
2022-12-15 06:36:28 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
|
2023-07-28 08:57:25 -07:00
|
|
|
// Resolving $parameter is slow, especially on CI runner
|
2023-08-07 02:52:33 -07:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('$parameter["operation"]');
|
2023-12-08 02:40:05 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().should('have.text', 'getAll');
|
2022-12-15 06:36:28 -08:00
|
|
|
});
|
|
|
|
});
|