2022-12-01 04:26:22 -08:00
|
|
|
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
|
|
|
|
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
|
|
|
|
describe('Expression editor modal', () => {
|
|
|
|
before(() => {
|
|
|
|
cy.skipSetup();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
WorkflowPage.actions.visit();
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.actions.addInitialNodeToCanvas('Manual');
|
2022-12-01 04:26:22 -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.openExpressionEditorModal();
|
2022-12-01 04:26:22 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve primitive resolvables', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().type('{{ 1 + 2');
|
2022-12-01 04:26:22 -08:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^3$/);
|
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
|
|
|
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().type('{{ "ab" + "cd"');
|
2022-12-01 04:26:22 -08:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^abcd$/);
|
|
|
|
|
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
|
|
|
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().type('{{ true && false');
|
2022-12-01 04:26:22 -08:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^false$/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve object resolvables', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters
|
|
|
|
.expressionModalInput()
|
|
|
|
.type('{{ { a : 1 }', { parseSpecialCharSequences: false });
|
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^\[Object: \{"a": 1\}\]$/);
|
2022-12-01 04:26:22 -08:00
|
|
|
|
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
|
|
|
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters
|
|
|
|
.expressionModalInput()
|
|
|
|
.type('{{ { a : 1 }.a', { parseSpecialCharSequences: false });
|
2022-12-01 04:26:22 -08:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^1$/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve array resolvables', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().type('{{ [1, 2, 3]');
|
2022-12-01 04:26:22 -08:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^\[Array: \[1,2,3\]\]$/);
|
|
|
|
|
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
|
|
|
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().type('{{ [1, 2, 3][0]');
|
2022-12-01 04:26:22 -08:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^1$/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should resolve $parameter[]', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().clear();
|
2023-02-02 03:35:38 -08:00
|
|
|
WorkflowPage.getters.expressionModalInput().type('{{ $parameter["operation"]');
|
2023-04-26 00:18:10 -07:00
|
|
|
WorkflowPage.getters.expressionModalOutput().contains(/^get$/);
|
2022-12-01 04:26:22 -08:00
|
|
|
});
|
|
|
|
});
|