2022-12-15 06:36:28 -08:00
|
|
|
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
|
|
|
|
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
|
|
|
|
describe('Inline expression editor', () => {
|
|
|
|
before(() => {
|
2023-01-04 00:47:48 -08:00
|
|
|
cy.resetAll();
|
2022-12-15 06:36:28 -08:00
|
|
|
cy.skipSetup();
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
|
|
|
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-01-09 02:44:15 -08: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-01-09 02:44:15 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorInput().type('$parameter["operation"]');
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^getAll$/);
|
2022-12-15 06:36:28 -08:00
|
|
|
});
|
|
|
|
});
|