2023-06-07 07:53:53 -07:00
|
|
|
import { randFirstName, randLastName } from '@ngneat/falso';
|
|
|
|
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
|
2022-12-15 06:36:28 -08:00
|
|
|
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
|
|
|
2023-06-07 07:53:53 -07:00
|
|
|
const email = DEFAULT_USER_EMAIL;
|
|
|
|
const password = DEFAULT_USER_PASSWORD;
|
|
|
|
const firstName = randFirstName();
|
|
|
|
const lastName = randLastName();
|
|
|
|
|
2022-12-15 06:36:28 -08:00
|
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
|
|
|
|
describe('Inline expression editor', () => {
|
|
|
|
before(() => {
|
2023-06-07 07:53:53 -07:00
|
|
|
cy.setup({ email, firstName, lastName, password });
|
2022-12-15 06:36:28 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-06-07 07:53:53 -07:00
|
|
|
cy.signin({ email, password });
|
2022-12-15 06:36:28 -08:00
|
|
|
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-04-26 00:18:10 -07:00
|
|
|
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^get$/);
|
2022-12-15 06:36:28 -08:00
|
|
|
});
|
|
|
|
});
|