2022-12-01 00:26:38 -08:00
|
|
|
import { WorkflowsPage, WorkflowPage, NDV } from '../pages';
|
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
|
|
|
|
const workflowsPage = new WorkflowsPage();
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const ndv = new NDV();
|
|
|
|
|
|
|
|
describe('NDV', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.resetAll();
|
|
|
|
cy.skipSetup();
|
|
|
|
workflowsPage.actions.createWorkflowFromCard();
|
|
|
|
workflowPage.actions.renameWorkflow(uuid());
|
|
|
|
workflowPage.actions.saveWorkflowOnButtonClick();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show up when double clicked on a node and close when Back to canvas clicked', () => {
|
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual Trigger');
|
|
|
|
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
|
|
|
});
|
|
|
|
|
|
|
|
ndv.getters.runDataDisplayMode().should('have.length.at.least', 1).and('be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
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-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', () => {
|
|
|
|
workflowPage.actions.addNodeToCanvas('Typeform', true);
|
|
|
|
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', () => {
|
|
|
|
workflowPage.actions.addNodeToCanvas('Manual Trigger');
|
|
|
|
workflowPage.actions.addNodeToCanvas('Airtable', true);
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
2022-12-01 00:26:38 -08:00
|
|
|
});
|