2022-12-01 00:26:38 -08:00
|
|
|
import { v4 as uuid } from 'uuid';
|
2023-11-23 09:28:07 -08:00
|
|
|
import { getVisibleSelect } from '../utils';
|
2023-11-29 03:13:55 -08:00
|
|
|
import { MANUAL_TRIGGER_NODE_DISPLAY_NAME } from '../constants';
|
|
|
|
import { NDV, WorkflowPage } from '../pages';
|
2022-12-01 00:26:38 -08:00
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const ndv = new NDV();
|
|
|
|
|
|
|
|
describe('NDV', () => {
|
2023-03-08 06:11:13 -08:00
|
|
|
beforeEach(() => {
|
|
|
|
workflowPage.actions.visit();
|
2022-12-01 00:26:38 -08:00
|
|
|
workflowPage.actions.renameWorkflow(uuid());
|
|
|
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
|
|
|
});
|
2023-04-21 05:08:51 -07:00
|
|
|
|
2022-12-01 00:26:38 -08:00
|
|
|
it('should show up when double clicked on a node and close when Back to canvas clicked', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual');
|
2022-12-01 00:26:38 -08:00
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
|
|
|
ndv.getters.container().should('be.visible');
|
2022-12-15 07:39:59 -08:00
|
|
|
ndv.getters.backToCanvas().click();
|
2022-12-01 00:26:38 -08:00
|
|
|
ndv.getters.container().should('not.be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should test webhook node', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Webhook');
|
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
|
|
|
|
2023-01-18 06:48:36 -08:00
|
|
|
ndv.actions.execute();
|
2022-12-01 00:26:38 -08:00
|
|
|
ndv.getters.copyInput().click();
|
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite');
|
2022-12-01 00:26:38 -08:00
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
cy.readClipboard().then((url) => {
|
2022-12-01 00:26:38 -08:00
|
|
|
cy.request({
|
|
|
|
method: 'GET',
|
|
|
|
url,
|
|
|
|
}).then((resp) => {
|
2022-12-15 07:39:59 -08:00
|
|
|
expect(resp.status).to.eq(200);
|
|
|
|
});
|
2022-12-01 00:26:38 -08:00
|
|
|
});
|
|
|
|
|
2023-02-06 20:47:37 -08:00
|
|
|
ndv.getters.outputDisplayMode().should('have.length.at.least', 1).and('be.visible');
|
2022-12-01 00:26:38 -08:00
|
|
|
});
|
|
|
|
|
2023-10-30 05:44:19 -07:00
|
|
|
it('should change input and go back to canvas', () => {
|
2022-12-01 00:26:38 -08:00
|
|
|
cy.createFixtureWorkflow('NDV-test-select-input.json', `NDV test select input ${uuid()}`);
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.getters.canvasNodes().last().dblclick();
|
|
|
|
ndv.getters.inputSelect().click();
|
|
|
|
ndv.getters.inputOption().last().click();
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters.inputDataContainer().find('[class*=schema_]').should('exist');
|
2023-01-18 06:48:36 -08:00
|
|
|
ndv.getters.inputDataContainer().should('contain', 'start');
|
2023-10-30 05:44:19 -07:00
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
ndv.getters.container().should('not.be.visible');
|
|
|
|
cy.shouldNotHaveConsoleErrors();
|
2022-12-01 00:26:38 -08:00
|
|
|
});
|
2023-01-16 05:55:58 -08:00
|
|
|
|
|
|
|
it('should show correct validation state for resource locator params', () => {
|
2023-03-02 07:50:21 -08:00
|
|
|
workflowPage.actions.addNodeToCanvas('Typeform', true, true);
|
2023-01-16 05:55:58 -08:00
|
|
|
ndv.getters.container().should('be.visible');
|
|
|
|
cy.get('.has-issues').should('have.length', 0);
|
|
|
|
cy.get('[class*=hasIssues]').should('have.length', 0);
|
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
// Both credentials and resource locator errors should be visible
|
2023-01-18 06:48:36 -08:00
|
|
|
workflowPage.actions.openNode('Typeform');
|
2023-01-16 05:55:58 -08:00
|
|
|
cy.get('.has-issues').should('have.length', 1);
|
|
|
|
cy.get('[class*=hasIssues]').should('have.length', 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show validation errors only after blur or re-opening of NDV', () => {
|
2023-02-17 06:08:26 -08:00
|
|
|
workflowPage.actions.addNodeToCanvas('Manual');
|
2023-07-17 09:42:30 -07:00
|
|
|
workflowPage.actions.addNodeToCanvas('Airtable', true, true, 'Search records');
|
2023-01-16 05:55:58 -08:00
|
|
|
ndv.getters.container().should('be.visible');
|
2024-01-10 03:35:47 -08:00
|
|
|
cy.get('.has-issues').should('have.length', 0);
|
2023-01-27 01:18:15 -08:00
|
|
|
ndv.getters.parameterInput('table').find('input').eq(1).focus().blur();
|
2023-07-17 09:42:30 -07:00
|
|
|
ndv.getters.parameterInput('base').find('input').eq(1).focus().blur();
|
2024-01-10 03:35:47 -08:00
|
|
|
cy.get('.has-issues').should('have.length', 2);
|
2023-01-16 05:55:58 -08:00
|
|
|
ndv.getters.backToCanvas().click();
|
2023-01-18 06:48:36 -08:00
|
|
|
workflowPage.actions.openNode('Airtable');
|
2023-07-17 09:42:30 -07:00
|
|
|
cy.get('.has-issues').should('have.length', 2);
|
2023-01-16 05:55:58 -08:00
|
|
|
cy.get('[class*=hasIssues]').should('have.length', 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show all validation errors when opening pasted node', () => {
|
|
|
|
cy.fixture('Test_workflow_ndv_errors.json').then((data) => {
|
|
|
|
cy.get('body').paste(JSON.stringify(data));
|
|
|
|
workflowPage.getters.canvasNodes().should('have.have.length', 1);
|
2023-01-18 06:48:36 -08:00
|
|
|
workflowPage.actions.openNode('Airtable');
|
2023-01-16 05:55:58 -08:00
|
|
|
cy.get('.has-issues').should('have.length', 3);
|
|
|
|
cy.get('[class*=hasIssues]').should('have.length', 1);
|
|
|
|
});
|
|
|
|
});
|
2023-03-16 02:19:12 -07:00
|
|
|
|
2023-03-31 04:59:09 -07:00
|
|
|
it('should save workflow using keyboard shortcut from NDV', () => {
|
|
|
|
workflowPage.actions.addNodeToCanvas('Manual');
|
|
|
|
workflowPage.actions.addNodeToCanvas('Set', true, true);
|
|
|
|
ndv.getters.container().should('be.visible');
|
|
|
|
workflowPage.actions.saveWorkflowUsingKeyboardShortcut();
|
|
|
|
workflowPage.getters.isWorkflowSaved();
|
2023-06-20 03:00:53 -07:00
|
|
|
});
|
2023-03-31 04:59:09 -07:00
|
|
|
|
2023-03-16 02:19:12 -07:00
|
|
|
describe('test output schema view', () => {
|
2023-06-20 03:00:53 -07:00
|
|
|
const schemaKeys = [
|
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'email',
|
|
|
|
'notes',
|
|
|
|
'country',
|
|
|
|
'created',
|
|
|
|
'objectValue',
|
|
|
|
'prop1',
|
|
|
|
'prop2',
|
|
|
|
];
|
2023-03-30 23:31:19 -07:00
|
|
|
function setupSchemaWorkflow() {
|
2023-03-16 02:19:12 -07:00
|
|
|
cy.createFixtureWorkflow('Test_workflow_schema_test.json', `NDV test schema view ${uuid()}`);
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.openNode('Set');
|
|
|
|
ndv.actions.execute();
|
2023-03-30 23:31:19 -07:00
|
|
|
}
|
|
|
|
|
2023-03-16 02:19:12 -07:00
|
|
|
it('should switch to output schema view and validate it', () => {
|
2023-06-20 03:00:53 -07:00
|
|
|
setupSchemaWorkflow();
|
2023-03-16 02:19:12 -07:00
|
|
|
ndv.getters.outputDisplayMode().children().should('have.length', 3);
|
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Table');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.switchOutputMode('Schema');
|
2023-03-16 02:19:12 -07:00
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema');
|
|
|
|
|
|
|
|
schemaKeys.forEach((key) => {
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputPanel()
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
.contains(key)
|
|
|
|
.should('exist');
|
2023-03-16 02:19:12 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
it('should preserve schema view after execution', () => {
|
2023-06-20 03:00:53 -07:00
|
|
|
setupSchemaWorkflow();
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.switchOutputMode('Schema');
|
2023-03-16 02:19:12 -07:00
|
|
|
ndv.actions.execute();
|
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema');
|
2023-06-20 03:00:53 -07:00
|
|
|
});
|
2023-03-16 02:19:12 -07:00
|
|
|
it('should collapse and expand nested schema object', () => {
|
2023-06-20 03:00:53 -07:00
|
|
|
setupSchemaWorkflow();
|
|
|
|
const expandedObjectProps = ['prop1', 'prop2'];
|
|
|
|
const getObjectValueItem = () =>
|
|
|
|
ndv.getters
|
|
|
|
.outputPanel()
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
.filter(':contains("objectValue")');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.switchOutputMode('Schema');
|
2023-03-16 02:19:12 -07:00
|
|
|
|
|
|
|
expandedObjectProps.forEach((key) => {
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputPanel()
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
.contains(key)
|
|
|
|
.should('be.visible');
|
2023-03-16 02:19:12 -07:00
|
|
|
});
|
|
|
|
getObjectValueItem().find('label').click();
|
|
|
|
expandedObjectProps.forEach((key) => {
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputPanel()
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
.contains(key)
|
|
|
|
.should('not.be.visible');
|
2023-03-16 02:19:12 -07:00
|
|
|
});
|
2023-06-20 03:00:53 -07:00
|
|
|
});
|
2023-03-30 23:31:19 -07:00
|
|
|
it('should not display pagination for schema', () => {
|
2023-06-20 03:00:53 -07:00
|
|
|
setupSchemaWorkflow();
|
2023-03-30 23:31:19 -07:00
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
workflowPage.getters.canvasNodeByName('Set').click();
|
2023-06-20 03:00:53 -07:00
|
|
|
workflowPage.actions.addNodeToCanvas(
|
|
|
|
'Customer Datastore (n8n training)',
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
'Get All People',
|
|
|
|
);
|
2023-03-30 23:31:19 -07:00
|
|
|
ndv.actions.execute();
|
|
|
|
ndv.getters.outputPanel().contains('25 items').should('exist');
|
|
|
|
ndv.getters.outputPanel().find('[class*=_pagination]').should('exist');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.switchOutputMode('Schema');
|
2023-03-30 23:31:19 -07:00
|
|
|
ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.switchOutputMode('JSON');
|
2023-03-30 23:31:19 -07:00
|
|
|
ndv.getters.outputPanel().find('[class*=_pagination]').should('exist');
|
2023-06-20 03:00:53 -07:00
|
|
|
});
|
2023-03-30 23:31:19 -07:00
|
|
|
it('should display large schema', () => {
|
2023-06-20 03:00:53 -07:00
|
|
|
cy.createFixtureWorkflow(
|
|
|
|
'Test_workflow_schema_test_pinned_data.json',
|
|
|
|
`NDV test schema view ${uuid()}`,
|
|
|
|
);
|
2023-03-30 23:31:19 -07:00
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.openNode('Set');
|
|
|
|
|
|
|
|
ndv.getters.outputPanel().contains('20 items').should('exist');
|
|
|
|
ndv.getters.outputPanel().find('[class*=_pagination]').should('exist');
|
2023-07-28 00:51:07 -07:00
|
|
|
ndv.actions.switchOutputMode('Schema');
|
2023-03-30 23:31:19 -07:00
|
|
|
ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist');
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputPanel()
|
|
|
|
.find('[data-test-id=run-data-schema-item] [data-test-id=run-data-schema-item]')
|
|
|
|
.should('have.length', 20);
|
|
|
|
});
|
2023-04-24 02:07:32 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('can link and unlink run selectors between input and output', () => {
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_5.json', 'Test');
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
workflowPage.actions.openNode('Set3');
|
|
|
|
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.inputRunSelector()
|
2023-04-24 02:07:32 -07:00
|
|
|
.should('exist')
|
|
|
|
.find('input')
|
|
|
|
.should('include.value', '2 of 2 (6 items)');
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.outputRunSelector()
|
2023-04-24 02:07:32 -07:00
|
|
|
.should('exist')
|
|
|
|
.find('input')
|
|
|
|
.should('include.value', '2 of 2 (6 items)');
|
|
|
|
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
|
|
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
|
2023-04-24 02:07:32 -07:00
|
|
|
ndv.getters.inputTbodyCell(1, 0).should('have.text', '1111');
|
|
|
|
ndv.getters.outputTbodyCell(1, 0).should('have.text', '1111');
|
|
|
|
|
|
|
|
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
|
|
|
|
ndv.actions.changeInputRunSelector('2 of 2 (6 items)');
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters.outputRunSelector().find('input').should('include.value', '2 of 2 (6 items)');
|
2023-04-24 02:07:32 -07:00
|
|
|
|
|
|
|
// unlink
|
|
|
|
ndv.actions.toggleOutputRunLinking();
|
|
|
|
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
|
|
|
|
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters
|
|
|
|
.inputRunSelector()
|
2023-04-24 02:07:32 -07:00
|
|
|
.should('exist')
|
|
|
|
.find('input')
|
|
|
|
.should('include.value', '2 of 2 (6 items)');
|
|
|
|
|
|
|
|
// link again
|
|
|
|
ndv.actions.toggleOutputRunLinking();
|
|
|
|
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
|
|
|
|
|
2023-04-24 02:07:32 -07:00
|
|
|
// unlink again
|
|
|
|
ndv.actions.toggleInputRunLinking();
|
|
|
|
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
|
|
|
|
ndv.actions.changeInputRunSelector('2 of 2 (6 items)');
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters.outputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
|
2023-04-24 02:07:32 -07:00
|
|
|
|
|
|
|
// link again
|
|
|
|
ndv.actions.toggleInputRunLinking();
|
|
|
|
ndv.getters.inputTbodyCell(1, 0).click(); // remove tooltip
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.getters.outputRunSelector().find('input').should('include.value', '2 of 2 (6 items)');
|
2023-04-24 02:07:32 -07:00
|
|
|
});
|
2023-05-10 01:32:09 -07:00
|
|
|
|
|
|
|
it('should display parameter hints correctly', () => {
|
|
|
|
workflowPage.actions.visit();
|
|
|
|
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_3.json', `My test workflow`);
|
|
|
|
workflowPage.actions.openNode('Set1');
|
|
|
|
|
|
|
|
ndv.actions.typeIntoParameterInput('value', '='); // switch to expressions
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
|
|
|
input: 'hello',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: '',
|
|
|
|
output: '[empty]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: ' test',
|
|
|
|
},
|
|
|
|
{
|
2023-06-20 03:00:53 -07:00
|
|
|
input: ' ',
|
2023-05-10 01:32:09 -07:00
|
|
|
},
|
|
|
|
{
|
2023-06-20 03:00:53 -07:00
|
|
|
input: '<div></div>',
|
2023-05-10 01:32:09 -07:00
|
|
|
},
|
|
|
|
].forEach(({ input, output }) => {
|
2023-06-20 03:00:53 -07:00
|
|
|
if (input) {
|
|
|
|
ndv.actions.typeIntoParameterInput('value', input);
|
|
|
|
}
|
|
|
|
ndv.getters.parameterInput('name').click(); // remove focus from input, hide expression preview
|
2023-05-10 01:32:09 -07:00
|
|
|
|
2023-06-20 03:00:53 -07:00
|
|
|
ndv.actions.validateExpressionPreview('value', output || input);
|
|
|
|
ndv.getters.parameterInput('value').clear();
|
|
|
|
});
|
2023-05-10 01:32:09 -07:00
|
|
|
});
|
2023-08-29 05:00:17 -07:00
|
|
|
|
2023-08-31 07:40:20 -07:00
|
|
|
it('should not retrieve remote options when required params throw errors', () => {
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('E2e Test', { action: 'Remote Options' });
|
2023-08-31 07:40:20 -07:00
|
|
|
|
|
|
|
ndv.getters.parameterInput('remoteOptions').click();
|
|
|
|
getVisibleSelect().find('.el-select-dropdown__item').should('have.length', 3);
|
|
|
|
|
2023-10-13 03:30:45 -07:00
|
|
|
ndv.actions.setInvalidExpression({ fieldName: 'fieldId', delay: 200 });
|
2023-08-31 07:40:20 -07:00
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters.nodeParameters().click(); // remove focus from input, hide expression preview
|
2023-08-31 07:40:20 -07:00
|
|
|
|
|
|
|
ndv.getters.parameterInput('remoteOptions').click();
|
|
|
|
|
2024-02-06 09:34:34 -08:00
|
|
|
ndv.getters.parameterInputIssues('remoteOptions').realHover({ scrollBehavior: false });
|
2023-10-12 05:18:35 -07:00
|
|
|
// Remote options dropdown should not be visible
|
|
|
|
ndv.getters.parameterInput('remoteOptions').find('.el-select').should('not.exist');
|
2023-08-31 07:40:20 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should retrieve remote options when non-required params throw errors', () => {
|
2023-09-01 04:29:31 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('E2e Test', { action: 'Remote Options' });
|
2023-08-31 07:40:20 -07:00
|
|
|
|
|
|
|
ndv.getters.parameterInput('remoteOptions').click();
|
|
|
|
getVisibleSelect().find('.el-select-dropdown__item').should('have.length', 3);
|
|
|
|
ndv.getters.parameterInput('remoteOptions').click();
|
|
|
|
|
2023-10-12 05:18:35 -07:00
|
|
|
ndv.actions.setInvalidExpression({ fieldName: 'otherField', delay: 50 });
|
2023-08-31 07:40:20 -07:00
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters.nodeParameters().click(); // remove focus from input, hide expression preview
|
2023-08-31 07:40:20 -07:00
|
|
|
|
|
|
|
ndv.getters.parameterInput('remoteOptions').click();
|
|
|
|
getVisibleSelect().find('.el-select-dropdown__item').should('have.length', 3);
|
|
|
|
});
|
|
|
|
|
2023-08-29 05:00:17 -07:00
|
|
|
it('should flag issues as soon as params are set', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Webhook');
|
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
|
|
|
|
|
|
|
workflowPage.getters.nodeIssuesByName('Webhook').should('not.exist');
|
|
|
|
ndv.getters.nodeExecuteButton().should('not.be.disabled');
|
|
|
|
ndv.getters.triggerPanelExecuteButton().should('exist');
|
|
|
|
|
|
|
|
ndv.getters.parameterInput('path').clear();
|
|
|
|
|
|
|
|
ndv.getters.nodeExecuteButton().should('be.disabled');
|
|
|
|
ndv.getters.triggerPanelExecuteButton().should('not.exist');
|
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.nodeIssuesByName('Webhook').should('exist');
|
|
|
|
|
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
2023-09-01 04:29:31 -07:00
|
|
|
ndv.getters.parameterInput('path').type('t');
|
2023-08-29 05:00:17 -07:00
|
|
|
|
|
|
|
ndv.getters.nodeExecuteButton().should('not.be.disabled');
|
|
|
|
ndv.getters.triggerPanelExecuteButton().should('exist');
|
|
|
|
|
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.nodeIssuesByName('Webhook').should('not.exist');
|
|
|
|
});
|
2023-10-05 03:31:52 -07:00
|
|
|
|
|
|
|
it('should not push NDV header out with a lot of code in Code node editor', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Code', { keepNdvOpen: true });
|
|
|
|
ndv.getters.parameterInput('jsCode').get('.cm-content').type('{selectall}').type('{backspace}');
|
|
|
|
cy.fixture('Dummy_javascript.txt').then((code) => {
|
|
|
|
ndv.getters.parameterInput('jsCode').get('.cm-content').paste(code);
|
|
|
|
});
|
|
|
|
ndv.getters.nodeExecuteButton().should('be.visible');
|
|
|
|
});
|
2023-10-12 05:18:35 -07:00
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
it('should allow editing code in fullscreen in the Code node', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Code', { keepNdvOpen: true });
|
|
|
|
ndv.actions.openCodeEditorFullscreen();
|
|
|
|
|
|
|
|
ndv.getters.codeEditorFullscreen().type('{selectall}').type('{backspace}').type('foo()');
|
2024-01-10 03:35:47 -08:00
|
|
|
ndv.getters.codeEditorFullscreen().should('contain.text', 'foo()');
|
|
|
|
cy.wait(200);
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters.codeEditorDialog().find('.el-dialog__close').click();
|
|
|
|
ndv.getters.parameterInput('jsCode').get('.cm-content').should('contain.text', 'foo()');
|
|
|
|
});
|
|
|
|
|
2023-10-12 05:18:35 -07:00
|
|
|
it('should not retrieve remote options when a parameter value changes', () => {
|
2023-11-17 03:03:05 -08:00
|
|
|
cy.intercept('/rest/dynamic-node-parameters/options?**', cy.spy().as('fetchParameterOptions'));
|
2023-10-12 05:18:35 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('E2e Test', { action: 'Remote Options' });
|
|
|
|
// Type something into the field
|
|
|
|
ndv.actions.typeIntoParameterInput('otherField', 'test');
|
|
|
|
// Should call the endpoint only once (on mount), not for every keystroke
|
|
|
|
cy.get('@fetchParameterOptions').should('have.been.calledOnce');
|
|
|
|
});
|
2023-11-23 09:28:07 -08:00
|
|
|
|
2023-11-29 03:13:55 -08:00
|
|
|
describe('floating nodes', () => {
|
2024-01-04 08:23:24 -08:00
|
|
|
function getFloatingNodeByPosition(
|
|
|
|
position: 'inputMain' | 'outputMain' | 'outputSub' | 'inputSub',
|
|
|
|
) {
|
2023-11-29 03:13:55 -08:00
|
|
|
return cy.get(`[data-node-placement=${position}]`);
|
|
|
|
}
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.createFixtureWorkflow('Floating_Nodes.json', `Floating Nodes`);
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
|
|
|
getFloatingNodeByPosition('inputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputMain').should('exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should traverse floating nodes with mouse', () => {
|
|
|
|
// Traverse 4 connected node forwards
|
2024-01-04 08:23:24 -08:00
|
|
|
Array.from(Array(4).keys()).forEach((i) => {
|
|
|
|
getFloatingNodeByPosition('outputMain').click({ force: true });
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', `Node ${i + 1}`);
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('inputMain').should('exist');
|
|
|
|
getFloatingNodeByPosition('outputMain').should('exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.selectedNodes().should('have.length', 1);
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.selectedNodes()
|
|
|
|
.first()
|
|
|
|
.should('contain', `Node ${i + 1}`);
|
2023-11-29 03:13:55 -08:00
|
|
|
workflowPage.getters.selectedNodes().first().dblclick();
|
2024-01-04 08:23:24 -08:00
|
|
|
});
|
2023-11-29 03:13:55 -08:00
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('outputMain').click({ force: true });
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', 'Chain');
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('inputSub').should('exist');
|
|
|
|
getFloatingNodeByPosition('inputSub').click({ force: true });
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', 'Model');
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('inputSub').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('inputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputSub').should('exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.selectedNodes().should('have.length', 1);
|
|
|
|
workflowPage.getters.selectedNodes().first().should('contain', 'Model');
|
|
|
|
workflowPage.getters.selectedNodes().first().dblclick();
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('outputSub').click({ force: true });
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', 'Chain');
|
|
|
|
|
|
|
|
// Traverse 4 connected node backwards
|
2024-01-04 08:23:24 -08:00
|
|
|
Array.from(Array(4).keys()).forEach((i) => {
|
|
|
|
getFloatingNodeByPosition('inputMain').click({ force: true });
|
|
|
|
ndv.getters.nodeNameContainer().should('contain', `Node ${4 - i}`);
|
|
|
|
getFloatingNodeByPosition('outputMain').should('exist');
|
|
|
|
getFloatingNodeByPosition('inputMain').should('exist');
|
|
|
|
});
|
|
|
|
getFloatingNodeByPosition('inputMain').click({ force: true });
|
|
|
|
workflowPage.getters
|
|
|
|
.selectedNodes()
|
|
|
|
.first()
|
|
|
|
.should('contain', MANUAL_TRIGGER_NODE_DISPLAY_NAME);
|
|
|
|
getFloatingNodeByPosition('inputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('inputSub').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputSub').should('not.exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.selectedNodes().should('have.length', 1);
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.selectedNodes()
|
|
|
|
.first()
|
|
|
|
.should('contain', MANUAL_TRIGGER_NODE_DISPLAY_NAME);
|
2023-11-29 03:13:55 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should traverse floating nodes with mouse', () => {
|
|
|
|
// Traverse 4 connected node forwards
|
2024-01-04 08:23:24 -08:00
|
|
|
Array.from(Array(4).keys()).forEach((i) => {
|
|
|
|
cy.realPress(['ShiftLeft', 'Meta', 'AltLeft', 'ArrowRight']);
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', `Node ${i + 1}`);
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('inputMain').should('exist');
|
|
|
|
getFloatingNodeByPosition('outputMain').should('exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.selectedNodes().should('have.length', 1);
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.selectedNodes()
|
|
|
|
.first()
|
|
|
|
.should('contain', `Node ${i + 1}`);
|
2023-11-29 03:13:55 -08:00
|
|
|
workflowPage.getters.selectedNodes().first().dblclick();
|
2024-01-04 08:23:24 -08:00
|
|
|
});
|
2023-11-29 03:13:55 -08:00
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
cy.realPress(['ShiftLeft', 'Meta', 'AltLeft', 'ArrowRight']);
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', 'Chain');
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('inputSub').should('exist');
|
|
|
|
cy.realPress(['ShiftLeft', 'Meta', 'AltLeft', 'ArrowDown']);
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', 'Model');
|
2024-01-04 08:23:24 -08:00
|
|
|
getFloatingNodeByPosition('inputSub').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('inputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputSub').should('exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.selectedNodes().should('have.length', 1);
|
|
|
|
workflowPage.getters.selectedNodes().first().should('contain', 'Model');
|
|
|
|
workflowPage.getters.selectedNodes().first().dblclick();
|
2024-01-04 08:23:24 -08:00
|
|
|
cy.realPress(['ShiftLeft', 'Meta', 'AltLeft', 'ArrowUp']);
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.getters.nodeNameContainer().should('contain', 'Chain');
|
|
|
|
|
|
|
|
// Traverse 4 connected node backwards
|
2024-01-04 08:23:24 -08:00
|
|
|
Array.from(Array(4).keys()).forEach((i) => {
|
|
|
|
cy.realPress(['ShiftLeft', 'Meta', 'AltLeft', 'ArrowLeft']);
|
|
|
|
ndv.getters.nodeNameContainer().should('contain', `Node ${4 - i}`);
|
|
|
|
getFloatingNodeByPosition('outputMain').should('exist');
|
|
|
|
getFloatingNodeByPosition('inputMain').should('exist');
|
|
|
|
});
|
|
|
|
cy.realPress(['ShiftLeft', 'Meta', 'AltLeft', 'ArrowLeft']);
|
|
|
|
workflowPage.getters
|
|
|
|
.selectedNodes()
|
|
|
|
.first()
|
|
|
|
.should('contain', MANUAL_TRIGGER_NODE_DISPLAY_NAME);
|
|
|
|
getFloatingNodeByPosition('inputMain').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('inputSub').should('not.exist');
|
|
|
|
getFloatingNodeByPosition('outputSub').should('not.exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.getters.selectedNodes().should('have.length', 1);
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.getters
|
|
|
|
.selectedNodes()
|
|
|
|
.first()
|
|
|
|
.should('contain', MANUAL_TRIGGER_NODE_DISPLAY_NAME);
|
2023-11-29 03:13:55 -08:00
|
|
|
});
|
2023-12-22 06:03:40 -08:00
|
|
|
});
|
|
|
|
|
2023-11-23 09:28:07 -08:00
|
|
|
it('should show node name and version in settings', () => {
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_ndv_version.json', `NDV test version ${uuid()}`);
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Edit Fields (old)');
|
|
|
|
ndv.actions.openSettings();
|
2024-02-06 09:34:34 -08:00
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Set node version 2 (Latest version: 3.3)');
|
2023-11-23 09:28:07 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Edit Fields (latest)');
|
|
|
|
ndv.actions.openSettings();
|
2024-02-06 09:34:34 -08:00
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Edit Fields (Set) node version 3.3 (Latest)');
|
2023-11-23 09:28:07 -08:00
|
|
|
ndv.actions.close();
|
|
|
|
|
2024-02-22 06:37:29 -08:00
|
|
|
workflowPage.actions.openNode('Edit Fields (no typeVersion)');
|
|
|
|
ndv.actions.openSettings();
|
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Edit Fields (Set) node version 3.3 (Latest)');
|
|
|
|
ndv.actions.close();
|
|
|
|
|
2023-11-23 09:28:07 -08:00
|
|
|
workflowPage.actions.openNode('Function');
|
|
|
|
ndv.actions.openSettings();
|
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Function node version 1 (Deprecated)');
|
|
|
|
ndv.actions.close();
|
|
|
|
});
|
2023-12-22 06:03:40 -08:00
|
|
|
|
|
|
|
it('Should render xml and html tags as strings and can search', () => {
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_xml_output.json', `test`);
|
|
|
|
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Edit Fields');
|
|
|
|
|
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Table');
|
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters
|
|
|
|
.outputTableRow(1)
|
|
|
|
.should('include.text', '<?xml version="1.0" encoding="UTF-8"?> <library>');
|
2023-12-22 06:03:40 -08:00
|
|
|
|
|
|
|
cy.document().trigger('keyup', { key: '/' });
|
|
|
|
ndv.getters.searchInput().filter(':focus').type('<lib');
|
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters.outputTableRow(1).find('mark').should('have.text', '<lib');
|
2023-12-22 06:03:40 -08:00
|
|
|
|
|
|
|
ndv.getters.outputDisplayMode().find('label').eq(1).should('include.text', 'JSON');
|
|
|
|
ndv.getters.outputDisplayMode().find('label').eq(1).click();
|
|
|
|
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters.outputDataContainer().find('.json-data').should('exist');
|
|
|
|
ndv.getters
|
|
|
|
.outputDataContainer()
|
|
|
|
.should(
|
|
|
|
'have.text',
|
|
|
|
'[{"body": "<?xml version="1.0" encoding="UTF-8"?> <library> <book> <title>Introduction to XML</title> <author>John Doe</author> <publication_year>2020</publication_year> <isbn>1234567890</isbn> </book> <book> <title>Data Science Basics</title> <author>Jane Smith</author> <publication_year>2019</publication_year> <isbn>0987654321</isbn> </book> <book> <title>Programming in Python</title> <author>Bob Johnson</author> <publication_year>2021</publication_year> <isbn>5432109876</isbn> </book> </library>"}]',
|
|
|
|
);
|
|
|
|
ndv.getters.outputDataContainer().find('mark').should('have.text', '<lib');
|
2023-12-22 06:03:40 -08:00
|
|
|
|
|
|
|
ndv.getters.outputDisplayMode().find('label').eq(2).should('include.text', 'Schema');
|
2024-01-04 08:23:24 -08:00
|
|
|
ndv.getters.outputDisplayMode().find('label').eq(2).click({ force: true });
|
|
|
|
ndv.getters
|
|
|
|
.outputDataContainer()
|
|
|
|
.findChildByTestId('run-data-schema-item')
|
|
|
|
.find('> span')
|
|
|
|
.should('include.text', '<?xml version="1.0" encoding="UTF-8"?>');
|
2023-12-22 06:03:40 -08:00
|
|
|
});
|
|
|
|
|
2023-12-22 03:50:36 -08:00
|
|
|
it('should properly show node execution indicator', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Code');
|
|
|
|
workflowPage.actions.openNode('Code');
|
|
|
|
// Should not show run info before execution
|
|
|
|
ndv.getters.nodeRunSuccessIndicator().should('not.exist');
|
|
|
|
ndv.getters.nodeRunErrorIndicator().should('not.exist');
|
|
|
|
ndv.getters.nodeExecuteButton().click();
|
|
|
|
ndv.getters.nodeRunSuccessIndicator().should('exist');
|
|
|
|
});
|
2023-12-22 06:03:40 -08:00
|
|
|
|
2023-12-22 03:50:36 -08:00
|
|
|
it('should properly show node execution indicator for multiple nodes', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Code');
|
|
|
|
workflowPage.actions.openNode('Code');
|
|
|
|
ndv.actions.typeIntoParameterInput('jsCode', 'testets');
|
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
// Manual tigger node should show success indicator
|
2024-01-22 00:20:02 -08:00
|
|
|
workflowPage.actions.openNode('When clicking "Test workflow"');
|
2023-12-22 03:50:36 -08:00
|
|
|
ndv.getters.nodeRunSuccessIndicator().should('exist');
|
|
|
|
// Code node should show error
|
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
workflowPage.actions.openNode('Code');
|
|
|
|
ndv.getters.nodeRunErrorIndicator().should('exist');
|
|
|
|
});
|
2023-12-22 06:03:40 -08:00
|
|
|
|
2023-12-21 23:41:20 -08:00
|
|
|
it('Should handle mismatched option attributes', () => {
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('LDAP', {
|
|
|
|
keepNdvOpen: true,
|
|
|
|
action: 'Create a new entry',
|
|
|
|
});
|
2023-12-21 23:41:20 -08:00
|
|
|
// Add some attributes in Create operation
|
|
|
|
cy.getByTestId('parameter-item').contains('Add Attributes').click();
|
|
|
|
ndv.actions.changeNodeOperation('Update');
|
|
|
|
// Attributes should be empty after operation change
|
|
|
|
cy.getByTestId('parameter-item').contains('Currently no items exist').should('exist');
|
|
|
|
});
|
2023-12-22 06:03:40 -08:00
|
|
|
|
2023-12-21 23:41:20 -08:00
|
|
|
it('Should keep RLC values after operation change', () => {
|
|
|
|
const TEST_DOC_ID = '1111';
|
2024-01-04 08:23:24 -08:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Google Sheets', {
|
|
|
|
keepNdvOpen: true,
|
|
|
|
action: 'Append row in sheet',
|
|
|
|
});
|
2023-12-21 23:41:20 -08:00
|
|
|
ndv.actions.setRLCValue('documentId', TEST_DOC_ID);
|
|
|
|
ndv.actions.changeNodeOperation('Update Row');
|
|
|
|
ndv.getters.resourceLocatorInput('documentId').find('input').should('have.value', TEST_DOC_ID);
|
|
|
|
});
|
2022-12-01 00:26:38 -08:00
|
|
|
});
|