2023-03-02 07:50:21 -08:00
|
|
|
import { WorkflowPage, NDV } from '../pages';
|
2022-12-01 00:26:38 -08:00
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const ndv = new NDV();
|
|
|
|
|
|
|
|
describe('NDV', () => {
|
2023-03-08 06:11:13 -08:00
|
|
|
before(() => {
|
2023-03-02 07:50:21 -08:00
|
|
|
cy.resetAll();
|
|
|
|
cy.skipSetup();
|
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();
|
|
|
|
});
|
|
|
|
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
|
|
|
});
|
|
|
|
|
|
|
|
it('should change input', () => {
|
|
|
|
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-03-02 07:50:21 -08:00
|
|
|
ndv.getters.inputDataContainer().find('[class*=schema_]').should('exist')
|
2023-01-18 06:48:36 -08:00
|
|
|
ndv.getters.inputDataContainer().should('contain', 'start');
|
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');
|
|
|
|
workflowPage.actions.addNodeToCanvas('Airtable', true, true, 'Read data from a table');
|
2023-01-16 05:55:58 -08:00
|
|
|
ndv.getters.container().should('be.visible');
|
|
|
|
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();
|
|
|
|
ndv.getters.parameterInput('application').find('input').eq(1).focus().blur();
|
2023-01-16 05:55:58 -08:00
|
|
|
cy.get('.has-issues').should('have.length', 2);
|
|
|
|
ndv.getters.backToCanvas().click();
|
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);
|
|
|
|
});
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
describe('test output schema view', () => {
|
|
|
|
const schemaKeys = ['id', 'name', 'email', 'notes', 'country', 'created', 'objectValue', 'prop1', 'prop2'];
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_schema_test.json', `NDV test schema view ${uuid()}`);
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
workflowPage.actions.openNode('Set');
|
|
|
|
ndv.actions.execute();
|
|
|
|
});
|
|
|
|
it('should switch to output schema view and validate it', () => {
|
|
|
|
ndv.getters.outputDisplayMode().children().should('have.length', 3);
|
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Table');
|
|
|
|
ndv.getters.outputDisplayMode().contains('Schema').click();
|
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema');
|
|
|
|
|
|
|
|
schemaKeys.forEach((key) => {
|
|
|
|
ndv.getters.outputPanel().find('[data-test-id=run-data-schema-item]').contains(key).should('exist');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it('should preserve schema view after execution', () => {
|
|
|
|
ndv.getters.outputDisplayMode().contains('Schema').click();
|
|
|
|
ndv.actions.execute();
|
|
|
|
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema');
|
|
|
|
})
|
|
|
|
it('should collapse and expand nested schema object', () => {
|
|
|
|
const expandedObjectProps = ['prop1', 'prop2'];;
|
|
|
|
const getObjectValueItem = () => ndv.getters.outputPanel().find('[data-test-id=run-data-schema-item]').filter(':contains("objectValue")');
|
|
|
|
ndv.getters.outputDisplayMode().contains('Schema').click();
|
|
|
|
|
|
|
|
expandedObjectProps.forEach((key) => {
|
|
|
|
ndv.getters.outputPanel().find('[data-test-id=run-data-schema-item]').contains(key).should('be.visible');
|
|
|
|
});
|
|
|
|
getObjectValueItem().find('label').click();
|
|
|
|
expandedObjectProps.forEach((key) => {
|
|
|
|
ndv.getters.outputPanel().find('[data-test-id=run-data-schema-item]').contains(key).should('not.be.visible');
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
2022-12-01 00:26:38 -08:00
|
|
|
});
|