2024-06-26 03:35:55 -07:00
|
|
|
|
import { MANUAL_TRIGGER_NODE_DISPLAY_NAME, NOTION_NODE_NAME } from '../constants';
|
2023-11-29 03:13:55 -08:00
|
|
|
|
import { NDV, WorkflowPage } from '../pages';
|
2024-02-23 04:34:32 -08:00
|
|
|
|
import { NodeCreator } from '../pages/features/node-creator';
|
2024-04-18 05:56:04 -07:00
|
|
|
|
import { clickCreateNewCredential } from '../composables/ndv';
|
|
|
|
|
import { setCredentialValues } from '../composables/modals/credential-modal';
|
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();
|
2024-06-12 23:39:53 -07:00
|
|
|
|
workflowPage.actions.renameWithUniqueName();
|
2022-12-01 00:26:38 -08:00
|
|
|
|
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');
|
|
|
|
|
});
|
|
|
|
|
|
2024-05-22 21:39:05 -07:00
|
|
|
|
it('should show input panel when node is not connected', () => {
|
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual');
|
|
|
|
|
workflowPage.actions.deselectAll();
|
|
|
|
|
workflowPage.actions.addNodeToCanvas('Set');
|
|
|
|
|
workflowPage.getters.canvasNodes().last().dblclick();
|
|
|
|
|
ndv.getters.container().should('be.visible').should('contain', 'Wire me up');
|
|
|
|
|
});
|
|
|
|
|
|
2022-12-01 00:26:38 -08:00
|
|
|
|
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', () => {
|
2024-06-12 23:39:53 -07:00
|
|
|
|
cy.createFixtureWorkflow('NDV-test-select-input.json', 'NDV test select input');
|
2022-12-01 00:26:38 -08:00
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
|
workflowPage.getters.canvasNodes().last().dblclick();
|
2024-06-24 09:09:28 -07:00
|
|
|
|
ndv.actions.switchInputMode('Table');
|
2022-12-01 00:26:38 -08:00
|
|
|
|
ndv.getters.inputSelect().click();
|
|
|
|
|
ndv.getters.inputOption().last().click();
|
2024-06-24 09:09:28 -07:00
|
|
|
|
ndv.getters.inputDataContainer().should('be.visible');
|
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
|
|
|
|
|
2024-04-08 18:46:52 -07:00
|
|
|
|
it('should disconect Switch outputs if rules order was changed', () => {
|
2024-06-10 06:49:50 -07:00
|
|
|
|
cy.createFixtureWorkflow('NDV-test-switch_reorder.json', 'NDV test switch reorder');
|
2024-04-08 18:46:52 -07:00
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
|
workflowPage.actions.openNode('Merge');
|
|
|
|
|
ndv.getters.outputPanel().contains('2 items').should('exist');
|
|
|
|
|
cy.contains('span', 'first').should('exist');
|
|
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Switch');
|
|
|
|
|
cy.get('.cm-line').realMouseMove(100, 100);
|
|
|
|
|
cy.get('.fa-angle-down').click();
|
|
|
|
|
ndv.getters.backToCanvas().click();
|
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
|
workflowPage.actions.openNode('Merge');
|
|
|
|
|
ndv.getters.outputPanel().contains('1 item').should('exist');
|
|
|
|
|
cy.contains('span', 'zero').should('exist');
|
|
|
|
|
});
|
|
|
|
|
|
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', () => {
|
2024-05-22 06:54:25 -07:00
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_ndv_errors.json', 'Validation errors');
|
|
|
|
|
workflowPage.getters.canvasNodes().should('have.have.length', 1);
|
|
|
|
|
workflowPage.actions.openNode('Airtable');
|
|
|
|
|
cy.get('.has-issues').should('have.length', 3);
|
|
|
|
|
cy.get('[class*=hasIssues]').should('have.length', 1);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should render run errors correctly', () => {
|
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_ndv_run_error.json', 'Run error');
|
|
|
|
|
workflowPage.actions.openNode('Error');
|
|
|
|
|
ndv.actions.execute();
|
|
|
|
|
ndv.getters
|
|
|
|
|
.nodeRunErrorMessage()
|
|
|
|
|
.should('have.text', 'Info for expression missing from previous node');
|
|
|
|
|
ndv.getters
|
|
|
|
|
.nodeRunErrorDescription()
|
|
|
|
|
.should(
|
|
|
|
|
'contains.text',
|
|
|
|
|
"An expression here won't work because it uses .item and n8n can't figure out the matching item.",
|
|
|
|
|
);
|
2023-01-16 05:55:58 -08:00
|
|
|
|
});
|
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() {
|
2024-06-12 23:39:53 -07:00
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_schema_test.json');
|
2023-03-16 02:19:12 -07:00
|
|
|
|
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',
|
2024-06-12 23:39:53 -07:00
|
|
|
|
'NDV test schema view 2',
|
2023-06-20 03:00:53 -07:00
|
|
|
|
);
|
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');
|
|
|
|
|
|
2024-06-24 09:09:28 -07:00
|
|
|
|
ndv.actions.switchInputMode('Table');
|
|
|
|
|
ndv.actions.switchOutputMode('Table');
|
|
|
|
|
|
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.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();
|
|
|
|
|
|
2024-06-12 23:39:53 -07:00
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_3.json', 'My test workflow 1');
|
2023-05-10 01:32:09 -07:00
|
|
|
|
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
|
|
|
|
|
2024-06-10 06:49:50 -07:00
|
|
|
|
ndv.actions.validateExpressionPreview('value', output ?? input);
|
2023-06-20 03:00:53 -07:00
|
|
|
|
ndv.getters.parameterInput('value').clear();
|
|
|
|
|
});
|
2023-05-10 01:32:09 -07:00
|
|
|
|
});
|
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', () => {
|
2024-05-21 10:11:02 -07:00
|
|
|
|
cy.intercept(
|
|
|
|
|
'POST',
|
|
|
|
|
'/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}]`);
|
|
|
|
|
}
|
2024-02-23 04:34:32 -08:00
|
|
|
|
|
|
|
|
|
it('should traverse floating nodes with mouse', () => {
|
2024-06-10 06:49:50 -07:00
|
|
|
|
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
|
|
|
|
// 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');
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
});
|
|
|
|
|
|
2024-02-23 04:34:32 -08:00
|
|
|
|
it('should traverse floating nodes with keyboard', () => {
|
2024-06-10 06:49:50 -07:00
|
|
|
|
cy.createFixtureWorkflow('Floating_Nodes.json', 'Floating Nodes');
|
2024-02-23 04:34:32 -08:00
|
|
|
|
workflowPage.getters.canvasNodes().first().dblclick();
|
|
|
|
|
getFloatingNodeByPosition('inputMain').should('not.exist');
|
|
|
|
|
getFloatingNodeByPosition('outputMain').should('exist');
|
2023-11-29 03:13:55 -08:00
|
|
|
|
// 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');
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
});
|
2024-02-23 04:34:32 -08:00
|
|
|
|
|
|
|
|
|
it('should connect floating sub-nodes', () => {
|
|
|
|
|
const nodeCreator = new NodeCreator();
|
|
|
|
|
const connectionGroups = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Language Models',
|
2024-03-14 01:03:33 -07:00
|
|
|
|
id: 'ai_languageModel',
|
2024-02-23 04:34:32 -08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Tools',
|
2024-03-14 01:03:33 -07:00
|
|
|
|
id: 'ai_tool',
|
2024-02-23 04:34:32 -08:00
|
|
|
|
},
|
2024-03-14 01:03:33 -07:00
|
|
|
|
];
|
2024-02-23 04:34:32 -08:00
|
|
|
|
|
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('AI Agent', { keepNdvOpen: true });
|
|
|
|
|
|
|
|
|
|
connectionGroups.forEach((group) => {
|
|
|
|
|
cy.getByTestId(`add-subnode-${group.id}`).should('exist');
|
|
|
|
|
cy.getByTestId(`add-subnode-${group.id}`).click();
|
|
|
|
|
|
|
|
|
|
cy.getByTestId('nodes-list-header').contains(group.title).should('exist');
|
|
|
|
|
nodeCreator.getters.getNthCreatorItem(1).click();
|
|
|
|
|
getFloatingNodeByPosition('outputSub').should('exist');
|
|
|
|
|
getFloatingNodeByPosition('outputSub').click({ force: true });
|
|
|
|
|
|
|
|
|
|
if (group.id === 'ai_languageModel') {
|
|
|
|
|
cy.getByTestId(`add-subnode-${group.id}`).should('not.exist');
|
|
|
|
|
} else {
|
|
|
|
|
cy.getByTestId(`add-subnode-${group.id}`).should('exist');
|
|
|
|
|
// Expand the subgroup
|
|
|
|
|
cy.getByTestId('subnode-connection-group-ai_tool').click();
|
|
|
|
|
cy.getByTestId(`add-subnode-${group.id}`).click();
|
|
|
|
|
nodeCreator.getters.getNthCreatorItem(1).click();
|
|
|
|
|
getFloatingNodeByPosition('outputSub').click({ force: true });
|
2024-03-14 01:03:33 -07:00
|
|
|
|
cy.getByTestId('subnode-connection-group-ai_tool')
|
|
|
|
|
.findChildByTestId('floating-subnode')
|
|
|
|
|
.should('have.length', 2);
|
2024-02-23 04:34:32 -08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Since language model has no credentials set, it should show an error
|
2024-03-14 01:03:33 -07:00
|
|
|
|
// Sinse code tool require alphanumeric tool name it would also show an error(2 errors, 1 for each tool node)
|
|
|
|
|
cy.get('[class*=hasIssues]').should('have.length', 3);
|
|
|
|
|
});
|
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', () => {
|
2024-06-12 23:39:53 -07:00
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_ndv_version.json', 'NDV test version');
|
2023-11-23 09:28:07 -08:00
|
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Edit Fields (old)');
|
|
|
|
|
ndv.actions.openSettings();
|
2024-06-18 01:32:51 -07:00
|
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Set node version 2 (Latest version: 3.4)');
|
2023-11-23 09:28:07 -08:00
|
|
|
|
ndv.actions.close();
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Edit Fields (latest)');
|
|
|
|
|
ndv.actions.openSettings();
|
2024-06-18 01:32:51 -07:00
|
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Edit Fields (Set) node version 3.4 (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();
|
2024-06-18 01:32:51 -07:00
|
|
|
|
ndv.getters.nodeVersion().should('have.text', 'Edit Fields (Set) node version 3.4 (Latest)');
|
2024-02-22 06:37:29 -08:00
|
|
|
|
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', () => {
|
2024-06-10 06:49:50 -07:00
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_xml_output.json', 'test');
|
2023-12-22 06:03:40 -08:00
|
|
|
|
|
|
|
|
|
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()
|
2024-07-01 02:03:04 -07:00
|
|
|
|
.findChildByTestId('run-data-schema-item-value')
|
2024-01-04 08:23:24 -08:00
|
|
|
|
.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-05-30 07:53:33 -07: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
|
|
|
|
|
2024-04-18 05:56:04 -07:00
|
|
|
|
it('Should clear mismatched collection parameters', () => {
|
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);
|
|
|
|
|
});
|
2024-03-05 05:16:24 -08:00
|
|
|
|
|
2024-04-18 05:56:04 -07:00
|
|
|
|
it('Should not clear resource/operation after credential change', () => {
|
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Discord', {
|
|
|
|
|
keepNdvOpen: true,
|
|
|
|
|
action: 'Delete a message',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
clickCreateNewCredential();
|
|
|
|
|
setCredentialValues({
|
|
|
|
|
botToken: 'sk_test_123',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ndv.getters.parameterInput('resource').find('input').should('have.value', 'Message');
|
|
|
|
|
ndv.getters.parameterInput('operation').find('input').should('have.value', 'Delete');
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-26 03:35:55 -07:00
|
|
|
|
it('Should show error state when remote options cannot be fetched', () => {
|
|
|
|
|
cy.intercept('POST', '/rest/dynamic-node-parameters/options', { statusCode: 500 }).as(
|
|
|
|
|
'parameterOptions',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas(NOTION_NODE_NAME, {
|
|
|
|
|
keepNdvOpen: true,
|
|
|
|
|
action: 'Update a database page',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ndv.actions.addItemToFixedCollection('propertiesUi');
|
|
|
|
|
ndv.getters
|
|
|
|
|
.parameterInput('key')
|
|
|
|
|
.find('input')
|
|
|
|
|
.should('have.value', 'Error fetching options from Notion');
|
|
|
|
|
});
|
|
|
|
|
|
2024-03-05 05:16:24 -08:00
|
|
|
|
it('Should open appropriate node creator after clicking on connection hint link', () => {
|
|
|
|
|
const nodeCreator = new NodeCreator();
|
|
|
|
|
const hintMapper = {
|
2024-03-14 01:03:33 -07:00
|
|
|
|
Memory: 'AI Nodes',
|
2024-03-05 05:16:24 -08:00
|
|
|
|
'Output Parser': 'AI Nodes',
|
|
|
|
|
'Token Splitter': 'Document Loaders',
|
2024-03-14 01:03:33 -07:00
|
|
|
|
Tool: 'AI Nodes',
|
|
|
|
|
Embeddings: 'Vector Stores',
|
|
|
|
|
'Vector Store': 'Retrievers',
|
|
|
|
|
};
|
|
|
|
|
cy.createFixtureWorkflow(
|
|
|
|
|
'open_node_creator_for_connection.json',
|
2024-06-12 23:39:53 -07:00
|
|
|
|
'open_node_creator_for_connection',
|
2024-03-14 01:03:33 -07:00
|
|
|
|
);
|
2024-03-05 05:16:24 -08:00
|
|
|
|
|
|
|
|
|
Object.entries(hintMapper).forEach(([node, group]) => {
|
|
|
|
|
workflowPage.actions.openNode(node);
|
|
|
|
|
cy.get('[data-action=openSelectiveNodeCreator]').contains('Insert one').click();
|
|
|
|
|
nodeCreator.getters.activeSubcategory().should('contain', group);
|
|
|
|
|
cy.realPress('Escape');
|
|
|
|
|
});
|
2024-03-14 01:03:33 -07:00
|
|
|
|
});
|
2024-04-03 03:16:16 -07:00
|
|
|
|
|
2024-05-09 05:45:31 -07:00
|
|
|
|
it('should allow selecting item for expressions', () => {
|
|
|
|
|
workflowPage.actions.visit();
|
|
|
|
|
|
2024-06-12 23:39:53 -07:00
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_3.json', 'My test workflow 2');
|
2024-05-09 05:45:31 -07:00
|
|
|
|
workflowPage.actions.openNode('Set');
|
|
|
|
|
|
|
|
|
|
ndv.actions.typeIntoParameterInput('value', '='); // switch to expressions
|
|
|
|
|
ndv.actions.typeIntoParameterInput('value', '{{', {
|
|
|
|
|
parseSpecialCharSequences: false,
|
|
|
|
|
});
|
|
|
|
|
ndv.actions.typeIntoParameterInput('value', '$json.input[0].count');
|
|
|
|
|
ndv.getters.inlineExpressionEditorOutput().should('have.text', '0');
|
|
|
|
|
|
|
|
|
|
ndv.actions.expressionSelectNextItem();
|
|
|
|
|
ndv.getters.inlineExpressionEditorOutput().should('have.text', '1');
|
|
|
|
|
ndv.getters.inlineExpressionEditorItemInput().should('have.value', '1');
|
|
|
|
|
ndv.getters.inlineExpressionEditorItemNextButton().should('be.disabled');
|
|
|
|
|
|
|
|
|
|
ndv.actions.expressionSelectPrevItem();
|
|
|
|
|
ndv.getters.inlineExpressionEditorOutput().should('have.text', '0');
|
|
|
|
|
ndv.getters.inlineExpressionEditorItemInput().should('have.value', '0');
|
|
|
|
|
ndv.getters.inlineExpressionEditorItemPrevButton().should('be.disabled');
|
|
|
|
|
|
|
|
|
|
ndv.actions.expressionSelectItem(1);
|
|
|
|
|
ndv.getters.inlineExpressionEditorOutput().should('have.text', '1');
|
|
|
|
|
});
|
2024-07-11 08:36:53 -07:00
|
|
|
|
|
|
|
|
|
it('should show data from the correct output in schema view', () => {
|
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_multiple_outputs.json');
|
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.executeWorkflow();
|
|
|
|
|
workflowPage.actions.openNode('Only Item 1');
|
|
|
|
|
ndv.getters.inputPanel().should('be.visible');
|
|
|
|
|
ndv.getters
|
|
|
|
|
.inputPanel()
|
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
|
.should('contain.text', 'onlyOnItem1');
|
|
|
|
|
ndv.actions.close();
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Only Item 2');
|
|
|
|
|
ndv.getters.inputPanel().should('be.visible');
|
|
|
|
|
ndv.getters
|
|
|
|
|
.inputPanel()
|
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
|
.should('contain.text', 'onlyOnItem2');
|
|
|
|
|
ndv.actions.close();
|
|
|
|
|
|
|
|
|
|
workflowPage.actions.openNode('Only Item 3');
|
|
|
|
|
ndv.getters.inputPanel().should('be.visible');
|
|
|
|
|
ndv.getters
|
|
|
|
|
.inputPanel()
|
|
|
|
|
.find('[data-test-id=run-data-schema-item]')
|
|
|
|
|
.should('contain.text', 'onlyOnItem3');
|
|
|
|
|
});
|
2022-12-01 00:26:38 -08:00
|
|
|
|
});
|