diff --git a/cypress/e2e/10-undo-redo.cy.ts b/cypress/e2e/10-undo-redo.cy.ts index 541da069c4..b8f238b8f2 100644 --- a/cypress/e2e/10-undo-redo.cy.ts +++ b/cypress/e2e/10-undo-redo.cy.ts @@ -10,9 +10,12 @@ const WorkflowPage = new WorkflowPageClass(); const ndv = new NDV(); describe('Undo/Redo', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { WorkflowPage.actions.visit(); cy.waitForLoad(); }); @@ -38,7 +41,11 @@ describe('Undo/Redo', () => { it('should undo/redo adding node in the middle', () => { WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME); WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME); - WorkflowPage.actions.addNodeBetweenNodes(SCHEDULE_TRIGGER_NODE_NAME, CODE_NODE_NAME, SET_NODE_NAME) + WorkflowPage.actions.addNodeBetweenNodes( + SCHEDULE_TRIGGER_NODE_NAME, + CODE_NODE_NAME, + SET_NODE_NAME, + ); WorkflowPage.actions.zoomToFit(); WorkflowPage.actions.hitUndo(); WorkflowPage.getters.canvasNodes().should('have.have.length', 2); diff --git a/cypress/e2e/12-canvas.cy.ts b/cypress/e2e/12-canvas.cy.ts index 13d1bc6392..e0f984d13a 100644 --- a/cypress/e2e/12-canvas.cy.ts +++ b/cypress/e2e/12-canvas.cy.ts @@ -21,9 +21,12 @@ const ZOOM_OUT_X2_FACTOR = 0.64; const RENAME_NODE_NAME = 'Something else'; describe('Canvas Actions', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { WorkflowPage.actions.visit(); cy.waitForLoad(); }); @@ -46,14 +49,16 @@ describe('Canvas Actions', () => { // Change connection from Set to Set1 cy.draganddrop( WorkflowPage.getters.getEndpointSelector('input', SET_NODE_NAME), - WorkflowPage.getters.getEndpointSelector('input', `${SET_NODE_NAME}1`) - ) + WorkflowPage.getters.getEndpointSelector('input', `${SET_NODE_NAME}1`), + ); - WorkflowPage.getters.canvasNodeInputEndpointByName(`${SET_NODE_NAME}1`).should('have.class', 'jtk-endpoint-connected'); + WorkflowPage.getters + .canvasNodeInputEndpointByName(`${SET_NODE_NAME}1`) + .should('have.class', 'jtk-endpoint-connected'); cy.get('.jtk-connector').should('have.length', 1); // Disconnect Set1 - cy.drag(WorkflowPage.getters.getEndpointSelector('input', `${SET_NODE_NAME}1`), [-200, 100]) + cy.drag(WorkflowPage.getters.getEndpointSelector('input', `${SET_NODE_NAME}1`), [-200, 100]); cy.get('.jtk-connector').should('have.length', 0); }); @@ -67,7 +72,10 @@ describe('Canvas Actions', () => { WorkflowPage.getters.canvasPlusButton().should('be.visible'); WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME, true); - cy.drag(WorkflowPage.getters.getEndpointSelector('plus', SCHEDULE_TRIGGER_NODE_NAME), [100, 100]) + cy.drag( + WorkflowPage.getters.getEndpointSelector('plus', SCHEDULE_TRIGGER_NODE_NAME), + [100, 100], + ); WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible'); WorkflowPage.actions.addNodeToCanvas(IF_NODE_NAME, false); @@ -79,18 +87,20 @@ describe('Canvas Actions', () => { // Switch has 4 output endpoints for (let i = 0; i < 4; i++) { - WorkflowPage.getters.canvasNodePlusEndpointByName(SWITCH_NODE_NAME, i).click({ force: true }) + WorkflowPage.getters.canvasNodePlusEndpointByName(SWITCH_NODE_NAME, i).click({ force: true }); WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible'); WorkflowPage.actions.addNodeToCanvas(SET_NODE_NAME, false); WorkflowPage.actions.zoomToFit(); } WorkflowPage.actions.saveWorkflowOnButtonClick(); - cy.reload() + cy.reload(); cy.waitForLoad(); // Make sure all connections are there after reload for (let i = 0; i < 4; i++) { const setName = `${SET_NODE_NAME}${i > 0 ? i : ''}`; - WorkflowPage.getters.canvasNodeInputEndpointByName(setName).should('have.class', 'jtk-endpoint-connected'); + WorkflowPage.getters + .canvasNodeInputEndpointByName(setName) + .should('have.class', 'jtk-endpoint-connected'); } }); @@ -109,26 +119,26 @@ describe('Canvas Actions', () => { // Connect manual to Set1 cy.draganddrop( WorkflowPage.getters.getEndpointSelector('output', MANUAL_TRIGGER_NODE_DISPLAY_NAME), - WorkflowPage.getters.getEndpointSelector('input', `${SET_NODE_NAME}1`) - ) + WorkflowPage.getters.getEndpointSelector('input', `${SET_NODE_NAME}1`), + ); cy.get('.rect-input-endpoint.jtk-endpoint-connected').should('have.length', 2); // Connect Set1 and Set2 to merge cy.draganddrop( WorkflowPage.getters.getEndpointSelector('plus', SET_NODE_NAME), - WorkflowPage.getters.getEndpointSelector('input', MERGE_NODE_NAME, 0) - ) + WorkflowPage.getters.getEndpointSelector('input', MERGE_NODE_NAME, 0), + ); cy.draganddrop( WorkflowPage.getters.getEndpointSelector('plus', `${SET_NODE_NAME}1`), - WorkflowPage.getters.getEndpointSelector('input', MERGE_NODE_NAME, 1) - ) + WorkflowPage.getters.getEndpointSelector('input', MERGE_NODE_NAME, 1), + ); cy.get('.rect-input-endpoint.jtk-endpoint-connected').should('have.length', 4); // Make sure all connections are there after save & reload WorkflowPage.actions.saveWorkflowOnButtonClick(); - cy.reload() + cy.reload(); cy.waitForLoad(); cy.get('.rect-input-endpoint.jtk-endpoint-connected').should('have.length', 4); @@ -156,7 +166,7 @@ describe('Canvas Actions', () => { cy.get('.plus-draggable-endpoint').filter(':visible').should('not.have.class', 'ep-success'); cy.get('.jtk-connector.success').should('have.length', 3); cy.get('.jtk-connector').should('have.length', 4); - }) + }); it('should add a connected node using plus endpoint', () => { WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME); diff --git a/cypress/e2e/13-pinning.cy.ts b/cypress/e2e/13-pinning.cy.ts index f21320ca9c..cea2c4fef7 100644 --- a/cypress/e2e/13-pinning.cy.ts +++ b/cypress/e2e/13-pinning.cy.ts @@ -4,15 +4,18 @@ const workflowPage = new WorkflowPage(); const ndv = new NDV(); describe('Data pinning', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { workflowPage.actions.visit(); cy.waitForLoad(); }); it('Should be able to pin node output', () => { - workflowPage.actions.addInitialNodeToCanvas('Schedule Trigger', { keepNdvOpen: true}); + workflowPage.actions.addInitialNodeToCanvas('Schedule Trigger', { keepNdvOpen: true }); ndv.getters.container().should('be.visible'); ndv.getters.pinDataButton().should('not.exist'); ndv.getters.editPinnedDataButton().should('be.visible'); @@ -43,7 +46,7 @@ describe('Data pinning', () => { }); it('Should be be able to set pinned data', () => { - workflowPage.actions.addInitialNodeToCanvas('Schedule Trigger', { keepNdvOpen: true}); + workflowPage.actions.addInitialNodeToCanvas('Schedule Trigger', { keepNdvOpen: true }); ndv.getters.container().should('be.visible'); ndv.getters.pinDataButton().should('not.exist'); ndv.getters.editPinnedDataButton().should('be.visible'); diff --git a/cypress/e2e/14-data-transformation-expressions.cy.ts b/cypress/e2e/14-data-transformation-expressions.cy.ts index a5186a8af5..1082765393 100644 --- a/cypress/e2e/14-data-transformation-expressions.cy.ts +++ b/cypress/e2e/14-data-transformation-expressions.cy.ts @@ -4,15 +4,20 @@ const wf = new WorkflowPage(); const ndv = new NDV(); describe('Data transformation expressions', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { wf.actions.visit(); cy.waitForLoad(); cy.window() // @ts-ignore - .then(win => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload)); + .then( + (win) => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload), + ); }); it('$json + native string methods', () => { @@ -26,7 +31,7 @@ describe('Data transformation expressions', () => { ndv.getters.inlineExpressionEditorInput().clear().type(input); ndv.actions.execute(); - ndv.getters.outputDataContainer().should('be.visible') + ndv.getters.outputDataContainer().should('be.visible'); ndv.getters.outputDataContainer().contains(output); }); @@ -41,7 +46,7 @@ describe('Data transformation expressions', () => { ndv.getters.inlineExpressionEditorInput().clear().type(input); ndv.actions.execute(); - ndv.getters.outputDataContainer().should('be.visible') + ndv.getters.outputDataContainer().should('be.visible'); ndv.getters.outputDataContainer().contains(output); }); @@ -56,7 +61,7 @@ describe('Data transformation expressions', () => { ndv.getters.inlineExpressionEditorInput().clear().type(input); ndv.actions.execute(); - ndv.getters.outputDataContainer().should('be.visible') + ndv.getters.outputDataContainer().should('be.visible'); ndv.getters.outputDataContainer().contains(output); }); @@ -71,7 +76,7 @@ describe('Data transformation expressions', () => { ndv.getters.inlineExpressionEditorInput().clear().type(input); ndv.actions.execute(); - ndv.getters.outputDataContainer().should('be.visible') + ndv.getters.outputDataContainer().should('be.visible'); ndv.getters.outputDataContainer().contains(output); }); @@ -86,7 +91,7 @@ describe('Data transformation expressions', () => { ndv.getters.inlineExpressionEditorInput().clear().type(input); ndv.actions.execute(); - ndv.getters.outputDataContainer().should('be.visible') + ndv.getters.outputDataContainer().should('be.visible'); ndv.getters.outputDataContainer().contains(output); }); diff --git a/cypress/e2e/14-mapping.cy.ts b/cypress/e2e/14-mapping.cy.ts index 846eafb6e5..ff6ee35a52 100644 --- a/cypress/e2e/14-mapping.cy.ts +++ b/cypress/e2e/14-mapping.cy.ts @@ -9,15 +9,20 @@ const workflowPage = new WorkflowPage(); const ndv = new NDV(); describe('Data mapping', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { workflowPage.actions.visit(); cy.waitForLoad(); cy.window() // @ts-ignore - .then(win => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload)) + .then( + (win) => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload), + ); }); it('maps expressions from table header', () => { @@ -30,15 +35,29 @@ describe('Data mapping', () => { ndv.getters.inputDataContainer().get('table', { timeout: 10000 }).should('exist'); ndv.getters.nodeParameters().find('input[placeholder*="Add Value"]').click(); - ndv.getters.nodeParameters().find('.el-select-dropdown__list li:nth-child(3)').should('have.text', 'String').click(); - ndv.getters.parameterInput('name').should('have.length', 1).find('input').should('have.value', 'propertyName'); - ndv.getters.parameterInput('value').should('have.length', 1).find('input').should('have.value', ''); + ndv.getters + .nodeParameters() + .find('.el-select-dropdown__list li:nth-child(3)') + .should('have.text', 'String') + .click(); + ndv.getters + .parameterInput('name') + .should('have.length', 1) + .find('input') + .should('have.value', 'propertyName'); + ndv.getters + .parameterInput('value') + .should('have.length', 1) + .find('input') + .should('have.value', ''); ndv.actions.mapDataFromHeader(1, 'value'); ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.timestamp }}'); ndv.actions.mapDataFromHeader(2, 'value'); - ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.timestamp }} {{ $json["Readable date"] }}'); + ndv.getters + .inlineExpressionEditorInput() + .should('have.text', '{{ $json.timestamp }} {{ $json["Readable date"] }}'); }); it('maps expressions from table json, and resolves value based on hover', () => { @@ -50,40 +69,56 @@ describe('Data mapping', () => { ndv.actions.switchInputMode('Table'); ndv.getters.inputDataContainer().get('table', { timeout: 10000 }).should('exist'); - ndv.getters.parameterInput('name').should('have.length', 1).find('input').should('have.value', 'other'); - ndv.getters.parameterInput('value').should('have.length', 1).find('input').should('have.value', ''); + ndv.getters + .parameterInput('name') + .should('have.length', 1) + .find('input') + .should('have.value', 'other'); + ndv.getters + .parameterInput('value') + .should('have.length', 1) + .find('input') + .should('have.value', ''); - ndv.getters.inputTbodyCell(1, 0).find('span').contains('count').trigger('mousedown', {force: true}); + ndv.getters + .inputTbodyCell(1, 0) + .find('span') + .contains('count') + .trigger('mousedown', { force: true }); ndv.actions.mapToParameter('value'); ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }}'); - ndv.getters.parameterExpressionPreview('value').should('include.text', '0') + ndv.getters.parameterExpressionPreview('value').should('include.text', '0'); ndv.getters.inputTbodyCell(1, 0).realHover(); - ndv.getters.parameterExpressionPreview('value') + ndv.getters + .parameterExpressionPreview('value') .should('include.text', '0') .invoke('css', 'color') .should('equal', 'rgb(125, 125, 135)'); ndv.getters.inputTbodyCell(2, 0).realHover(); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '1') - .invoke('css', 'color') - .should('equal', 'rgb(125, 125, 135)'); + ndv.getters + .parameterExpressionPreview('value') + .should('include.text', '1') + .invoke('css', 'color') + .should('equal', 'rgb(125, 125, 135)'); ndv.actions.execute(); ndv.getters.outputTbodyCell(1, 0).realHover(); - ndv.getters.parameterExpressionPreview('value') + ndv.getters + .parameterExpressionPreview('value') .should('include.text', '0') .invoke('css', 'color') .should('equal', 'rgb(125, 125, 135)'); // todo update color ndv.getters.outputTbodyCell(2, 0).realHover(); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '1') - .invoke('css', 'color') - .should('equal', 'rgb(125, 125, 135)'); + ndv.getters + .parameterExpressionPreview('value') + .should('include.text', '1') + .invoke('css', 'color') + .should('equal', 'rgb(125, 125, 135)'); }); it('maps expressions from json view', () => { @@ -94,24 +129,34 @@ describe('Data mapping', () => { workflowPage.actions.openNode('Set'); ndv.actions.switchInputMode('JSON'); - ndv.getters.inputDataContainer().should('exist').find('.json-data') - .should('have.text', '[{"input":[{"count":0,"with space":"!!","with.dot":"!!","with"quotes":"!!"}]},{"input":[{"count":1}]}]') - .find('span').contains('"count"') + ndv.getters + .inputDataContainer() + .should('exist') + .find('.json-data') + .should( + 'have.text', + '[{"input":[{"count":0,"with space":"!!","with.dot":"!!","with"quotes":"!!"}]},{"input":[{"count":1}]}]', + ) + .find('span') + .contains('"count"') .realMouseDown(); ndv.actions.mapToParameter('value'); ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }}'); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '0'); + ndv.getters.parameterExpressionPreview('value').should('include.text', '0'); - ndv.getters.inputDataContainer().find('.json-data') - .find('span').contains('"input"') + ndv.getters + .inputDataContainer() + .find('.json-data') + .find('span') + .contains('"input"') .realMouseDown(); ndv.actions.mapToParameter('value'); - ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }} {{ $json.input }}'); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '0 [object Object]'); + ndv.getters + .inlineExpressionEditorInput() + .should('have.text', '{{ $json.input[0].count }} {{ $json.input }}'); + ndv.getters.parameterExpressionPreview('value').should('include.text', '0 [object Object]'); }); it('maps expressions from schema view', () => { @@ -123,25 +168,19 @@ describe('Data mapping', () => { ndv.actions.clearParameterInput('value'); cy.get('body').type('{esc}'); - ndv.getters.inputDataContainer() - .should('exist') - .find('span').contains('count') - .realMouseDown(); - + ndv.getters.inputDataContainer().should('exist').find('span').contains('count').realMouseDown(); ndv.actions.mapToParameter('value'); ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }}'); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '0'); + ndv.getters.parameterExpressionPreview('value').should('include.text', '0'); - ndv.getters.inputDataContainer() - .find('span').contains('input') - .realMouseDown(); + ndv.getters.inputDataContainer().find('span').contains('input').realMouseDown(); ndv.actions.mapToParameter('value'); - ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }} {{ $json.input }}'); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '0 [object Object]'); + ndv.getters + .inlineExpressionEditorInput() + .should('have.text', '{{ $json.input[0].count }} {{ $json.input }}'); + ndv.getters.parameterExpressionPreview('value').should('include.text', '0 [object Object]'); }); it('maps expressions from previous nodes', () => { @@ -150,32 +189,33 @@ describe('Data mapping', () => { ndv.actions.selectInputNode(SCHEDULE_TRIGGER_NODE_NAME); - ndv.getters.inputDataContainer() - .find('span').contains('count') - .realMouseDown(); + ndv.getters.inputDataContainer().find('span').contains('count').realMouseDown(); ndv.actions.mapToParameter('value'); - ndv.getters.inlineExpressionEditorInput().should('have.text', `{{ $node["${SCHEDULE_TRIGGER_NODE_NAME}"].json.input[0].count }}`); - ndv.getters.parameterExpressionPreview('value') - .should('not.exist'); + ndv.getters + .inlineExpressionEditorInput() + .should('have.text', `{{ $node["${SCHEDULE_TRIGGER_NODE_NAME}"].json.input[0].count }}`); + ndv.getters.parameterExpressionPreview('value').should('not.exist'); ndv.actions.switchInputMode('Table'); ndv.actions.mapDataFromHeader(1, 'value'); - ndv.getters.inlineExpressionEditorInput().should('have.text', `{{ $node["${SCHEDULE_TRIGGER_NODE_NAME}"].json.input[0].count }} {{ $node["${SCHEDULE_TRIGGER_NODE_NAME}"].json.input }}`); - ndv.getters.parameterExpressionPreview('value') - .should('not.exist'); + ndv.getters + .inlineExpressionEditorInput() + .should( + 'have.text', + `{{ $node["${SCHEDULE_TRIGGER_NODE_NAME}"].json.input[0].count }} {{ $node["${SCHEDULE_TRIGGER_NODE_NAME}"].json.input }}`, + ); + ndv.getters.parameterExpressionPreview('value').should('not.exist'); ndv.actions.selectInputNode('Set'); ndv.actions.executePrevious(); ndv.getters.executingLoader().should('not.exist'); ndv.getters.inputDataContainer().should('exist'); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '0 [object Object]'); + ndv.getters.parameterExpressionPreview('value').should('include.text', '0 [object Object]'); ndv.getters.inputTbodyCell(2, 0).realHover(); - ndv.getters.parameterExpressionPreview('value') - .should('include.text', '1 [object Object]'); + ndv.getters.parameterExpressionPreview('value').should('include.text', '1 [object Object]'); }); it('maps keys to path', () => { @@ -186,20 +226,20 @@ describe('Data mapping', () => { { input: [ { - "hello.world": { - "my count": 0, + 'hello.world': { + 'my count': 0, }, - } - ] + }, + ], }, { input: [ { - "hello.world": { - "my count": 1, - } - } - ] + 'hello.world': { + 'my count': 1, + }, + }, + ], }, ]); @@ -208,21 +248,18 @@ describe('Data mapping', () => { workflowPage.actions.addNodeToCanvas('Item Lists'); workflowPage.actions.openNode('Item Lists'); - ndv.getters.parameterInput('operation') - .click() - .find('li').contains('Sort') - .click(); + ndv.getters.parameterInput('operation').click().find('li').contains('Sort').click(); ndv.getters.nodeParameters().find('button').contains('Add Field To Sort By').click(); - ndv.getters.inputDataContainer() - .find('span').contains('my count') - .realMouseDown(); + ndv.getters.inputDataContainer().find('span').contains('my count').realMouseDown(); ndv.actions.mapToParameter('fieldName'); ndv.getters.inlineExpressionEditorInput().should('have.length', 0); - ndv.getters.parameterInput('fieldName') - .find('input').should('have.value', 'input[0]["hello.world"]["my count"]'); + ndv.getters + .parameterInput('fieldName') + .find('input') + .should('have.value', 'input[0]["hello.world"]["my count"]'); }); }); diff --git a/cypress/e2e/15-scheduler-node.cy.ts b/cypress/e2e/15-scheduler-node.cy.ts index 65dae8f4d7..922972263a 100644 --- a/cypress/e2e/15-scheduler-node.cy.ts +++ b/cypress/e2e/15-scheduler-node.cy.ts @@ -5,7 +5,7 @@ const workflowPage = new WorkflowPage(); const ndv = new NDV(); describe('Schedule Trigger node', async () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); }); @@ -42,34 +42,44 @@ describe('Schedule Trigger node', async () => { workflowPage.actions.activateWorkflow(); workflowPage.getters.activatorSwitch().should('have.class', 'is-checked'); - cy.request("GET", '/rest/workflows').then((response) => { - expect(response.status).to.eq(200); - expect(response.body.data).to.have.length(1); - const workflowId = response.body.data[0].id.toString(); - expect(workflowId).to.not.be.empty; - return workflowId; - }).then((workflowId) => { - cy.wait(1200); - cy.request("GET", '/rest/executions').then((response) => { + cy.request('GET', '/rest/workflows') + .then((response) => { expect(response.status).to.eq(200); - expect(response.body.data.results.length).to.be.greaterThan(0); - const matchingExecutions = response.body.data.results.filter((execution: any) => execution.workflowId === workflowId); - expect(matchingExecutions).to.have.length(1); + expect(response.body.data).to.have.length(1); + const workflowId = response.body.data[0].id.toString(); + expect(workflowId).to.not.be.empty; return workflowId; - }).then((workflowId) => { + }) + .then((workflowId) => { cy.wait(1200); - cy.request("GET", '/rest/executions').then((response) => { - expect(response.status).to.eq(200); - expect(response.body.data.results.length).to.be.greaterThan(0); - const matchingExecutions = response.body.data.results.filter((execution: any) => execution.workflowId === workflowId); - expect(matchingExecutions).to.have.length(2); - }).then(()=>{ - workflowPage.actions.activateWorkflow(); - workflowPage.getters.activatorSwitch().should('not.have.class', 'is-checked'); - cy.visit(workflowsPage.url); - workflowsPage.actions.deleteWorkFlow('Schedule Trigger Workflow'); - }); + cy.request('GET', '/rest/executions') + .then((response) => { + expect(response.status).to.eq(200); + expect(response.body.data.results.length).to.be.greaterThan(0); + const matchingExecutions = response.body.data.results.filter( + (execution: any) => execution.workflowId === workflowId, + ); + expect(matchingExecutions).to.have.length(1); + return workflowId; + }) + .then((workflowId) => { + cy.wait(1200); + cy.request('GET', '/rest/executions') + .then((response) => { + expect(response.status).to.eq(200); + expect(response.body.data.results.length).to.be.greaterThan(0); + const matchingExecutions = response.body.data.results.filter( + (execution: any) => execution.workflowId === workflowId, + ); + expect(matchingExecutions).to.have.length(2); + }) + .then(() => { + workflowPage.actions.activateWorkflow(); + workflowPage.getters.activatorSwitch().should('not.have.class', 'is-checked'); + cy.visit(workflowsPage.url); + workflowsPage.actions.deleteWorkFlow('Schedule Trigger Workflow'); + }); + }); }); - }); }); }); diff --git a/cypress/e2e/16-webhook-node.cy.ts b/cypress/e2e/16-webhook-node.cy.ts index 07495cc4b0..3ed3c342cf 100644 --- a/cypress/e2e/16-webhook-node.cy.ts +++ b/cypress/e2e/16-webhook-node.cy.ts @@ -27,7 +27,7 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => { respondWith, responseData, executeNow = true, - } = options; + } = options; workflowPage.actions.addInitialNodeToCanvas('Webhook'); workflowPage.actions.openNode('Webhook'); @@ -47,43 +47,43 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => { if (authentication) { cy.getByTestId('parameter-input-authentication').click(); cy.getByTestId('parameter-input-authentication') - .find('.el-select-dropdown') - .find('.option-headline') - .contains(authentication) - .click(); + .find('.el-select-dropdown') + .find('.option-headline') + .contains(authentication) + .click(); } if (responseCode) { cy.getByTestId('parameter-input-responseCode') - .find('.parameter-input') - .find('input') - .clear() - .type(responseCode.toString()); + .find('.parameter-input') + .find('input') + .clear() + .type(responseCode.toString()); } if (respondWith) { cy.getByTestId('parameter-input-responseMode').click(); cy.getByTestId('parameter-input-responseMode') - .find('.el-select-dropdown') - .find('.option-headline') - .contains(respondWith) - .click(); + .find('.el-select-dropdown') + .find('.option-headline') + .contains(respondWith) + .click(); } if (responseData) { cy.getByTestId('parameter-input-responseData').click(); cy.getByTestId('parameter-input-responseData') - .find('.el-select-dropdown') - .find('.option-headline') - .contains(responseData) - .click(); + .find('.el-select-dropdown') + .find('.option-headline') + .contains(responseData) + .click(); } if (executeNow) { ndv.actions.execute(); cy.wait(waitForWebhook); - cy.request(method, '/webhook-test/'+ webhookPath).then((response) => { + cy.request(method, '/webhook-test/' + webhookPath).then((response) => { expect(response.status).to.eq(200); ndv.getters.outputPanel().contains('headers'); }); @@ -91,36 +91,41 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => { }; describe('Webhook Trigger node', async () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { workflowPage.actions.visit(); cy.waitForLoad(); cy.window() // @ts-ignore - .then(win => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload)); + .then( + (win) => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload), + ); }); it('should listen for a GET request', () => { - simpleWebhookCall({method: 'GET', webhookPath: uuid(), executeNow: true}); + simpleWebhookCall({ method: 'GET', webhookPath: uuid(), executeNow: true }); }); it('should listen for a POST request', () => { - simpleWebhookCall({method: 'POST', webhookPath: uuid(), executeNow: true}); + simpleWebhookCall({ method: 'POST', webhookPath: uuid(), executeNow: true }); }); it('should listen for a DELETE request', () => { - simpleWebhookCall({method: 'DELETE', webhookPath: uuid(), executeNow: true}); + simpleWebhookCall({ method: 'DELETE', webhookPath: uuid(), executeNow: true }); }); it('should listen for a HEAD request', () => { - simpleWebhookCall({method: 'HEAD', webhookPath: uuid(), executeNow: true}); + simpleWebhookCall({ method: 'HEAD', webhookPath: uuid(), executeNow: true }); }); it('should listen for a PATCH request', () => { - simpleWebhookCall({method: 'PATCH', webhookPath: uuid(), executeNow: true}); + simpleWebhookCall({ method: 'PATCH', webhookPath: uuid(), executeNow: true }); }); it('should listen for a PUT request', () => { - simpleWebhookCall({method: 'PUT', webhookPath: uuid(), executeNow: true}); + simpleWebhookCall({ method: 'PUT', webhookPath: uuid(), executeNow: true }); }); it('should listen for a GET request and respond with Respond to Webhook node', () => { @@ -138,7 +143,10 @@ describe('Webhook Trigger node', async () => { workflowPage.actions.openNode('Set'); cy.get('.add-option').click(); cy.get('.add-option').find('.el-select-dropdown__item').contains('Number').click(); - cy.get('.fixed-collection-parameter').getByTestId('parameter-input-name').clear().type('MyValue'); + cy.get('.fixed-collection-parameter') + .getByTestId('parameter-input-name') + .clear() + .type('MyValue'); cy.get('.fixed-collection-parameter').getByTestId('parameter-input-value').clear().type('1234'); ndv.getters.backToCanvas().click(); @@ -147,7 +155,7 @@ describe('Webhook Trigger node', async () => { workflowPage.actions.executeWorkflow(); cy.wait(waitForWebhook); - cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => { + cy.request('GET', '/webhook-test/' + webhookPath).then((response) => { expect(response.status).to.eq(200); expect(response.body.MyValue).to.eq(1234); }); @@ -165,7 +173,7 @@ describe('Webhook Trigger node', async () => { ndv.actions.execute(); cy.wait(waitForWebhook); - cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => { + cy.request('GET', '/webhook-test/' + webhookPath).then((response) => { expect(response.status).to.eq(201); }); }); @@ -184,14 +192,17 @@ describe('Webhook Trigger node', async () => { workflowPage.actions.openNode('Set'); cy.get('.add-option').click(); cy.get('.add-option').find('.el-select-dropdown__item').contains('Number').click(); - cy.get('.fixed-collection-parameter').getByTestId('parameter-input-name').clear().type('MyValue'); + cy.get('.fixed-collection-parameter') + .getByTestId('parameter-input-name') + .clear() + .type('MyValue'); cy.get('.fixed-collection-parameter').getByTestId('parameter-input-value').clear().type('1234'); ndv.getters.backToCanvas().click(); workflowPage.actions.executeWorkflow(); cy.wait(waitForWebhook); - cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => { + cy.request('GET', '/webhook-test/' + webhookPath).then((response) => { expect(response.status).to.eq(200); expect(response.body.MyValue).to.eq(1234); }); @@ -213,10 +224,14 @@ describe('Webhook Trigger node', async () => { cy.get('.add-option').click(); cy.get('.add-option').find('.el-select-dropdown__item').contains('String').click(); cy.get('.fixed-collection-parameter').getByTestId('parameter-input-name').clear().type('data'); - cy.get('.fixed-collection-parameter').getByTestId('parameter-input-value').clear().find('input').invoke('val', cowBase64).trigger('blur'); + cy.get('.fixed-collection-parameter') + .getByTestId('parameter-input-value') + .clear() + .find('input') + .invoke('val', cowBase64) + .trigger('blur'); ndv.getters.backToCanvas().click(); - workflowPage.actions.addNodeToCanvas('Move Binary Data'); workflowPage.actions.zoomToFit(); @@ -232,7 +247,7 @@ describe('Webhook Trigger node', async () => { workflowPage.actions.executeWorkflow(); cy.wait(waitForWebhook); - cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => { + cy.request('GET', '/webhook-test/' + webhookPath).then((response) => { expect(response.status).to.eq(200); expect(Object.keys(response.body).includes('data')).to.be.true; }); @@ -249,7 +264,7 @@ describe('Webhook Trigger node', async () => { }); ndv.actions.execute(); cy.wait(waitForWebhook); - cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => { + cy.request('GET', '/webhook-test/' + webhookPath).then((response) => { expect(response.status).to.eq(200); expect(response.body.MyValue).to.be.undefined; }); @@ -273,28 +288,29 @@ describe('Webhook Trigger node', async () => { cy.wait(waitForWebhook); cy.request({ method: 'GET', - url: '/webhook-test/'+ webhookPath, + url: '/webhook-test/' + webhookPath, auth: { - 'user': 'username', - 'pass': 'password', + user: 'username', + pass: 'password', }, failOnStatusCode: false, }) - .then((response) => { - expect(response.status).to.eq(403); - }).then(() => { - cy.request({ - method: 'GET', - url: '/webhook-test/'+ webhookPath, - auth: { - 'user': 'test', - 'pass': 'test', - }, - failOnStatusCode: true, - }).then((response) => { - expect(response.status).to.eq(200); + .then((response) => { + expect(response.status).to.eq(403); + }) + .then(() => { + cy.request({ + method: 'GET', + url: '/webhook-test/' + webhookPath, + auth: { + user: 'test', + pass: 'test', + }, + failOnStatusCode: true, + }).then((response) => { + expect(response.status).to.eq(200); + }); }); - }); }); it('should listen for a GET request with Header Authentication', () => { @@ -315,25 +331,26 @@ describe('Webhook Trigger node', async () => { cy.wait(waitForWebhook); cy.request({ method: 'GET', - url: '/webhook-test/'+ webhookPath, + url: '/webhook-test/' + webhookPath, headers: { test: 'wrong', }, failOnStatusCode: false, }) - .then((response) => { - expect(response.status).to.eq(403); - }).then(() => { - cy.request({ - method: 'GET', - url: '/webhook-test/'+ webhookPath, - headers: { - test: 'test', - }, - failOnStatusCode: true, - }).then((response) => { - expect(response.status).to.eq(200); + .then((response) => { + expect(response.status).to.eq(403); + }) + .then(() => { + cy.request({ + method: 'GET', + url: '/webhook-test/' + webhookPath, + headers: { + test: 'test', + }, + failOnStatusCode: true, + }).then((response) => { + expect(response.status).to.eq(200); + }); }); - }); }); }); diff --git a/cypress/e2e/17-workflow-tags.cy.ts b/cypress/e2e/17-workflow-tags.cy.ts index 87926bf0f2..27c3e0b0b5 100644 --- a/cypress/e2e/17-workflow-tags.cy.ts +++ b/cypress/e2e/17-workflow-tags.cy.ts @@ -5,9 +5,12 @@ const wf = new WorkflowPage(); const TEST_TAGS = ['Tag 1', 'Tag 2', 'Tag 3']; describe('Workflow tags', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { wf.actions.visit(); cy.waitForLoad(); }); diff --git a/cypress/e2e/18-user-management.cy.ts b/cypress/e2e/18-user-management.cy.ts index f01cee7844..f06ba3d655 100644 --- a/cypress/e2e/18-user-management.cy.ts +++ b/cypress/e2e/18-user-management.cy.ts @@ -42,8 +42,8 @@ const updatedPersonalData = { newLastName: 'Else', newEmail: 'something_else@acme.corp', newPassword: 'Keybo4rd', - invalidPasswords: ['abc', 'longEnough', 'longenough123'] -} + invalidPasswords: ['abc', 'longEnough', 'longenough123'], +}; const usersSettingsPage = new SettingsUsersPage(); const workflowPage = new WorkflowPage(); @@ -67,7 +67,7 @@ describe('User Management', () => { }); it('should prevent non-owners to access UM settings', () => { - usersSettingsPage.actions.loginAndVisit(users[0].email, users[0].password, false) + usersSettingsPage.actions.loginAndVisit(users[0].email, users[0].password, false); }); it('should allow instance owner to access UM settings', () => { @@ -79,7 +79,10 @@ describe('User Management', () => { // All items in user list should be there usersSettingsPage.getters.userListItems().should('have.length', 3); // List item for current user should have the `Owner` badge - usersSettingsPage.getters.userItem(instanceOwner.email).find('.n8n-badge:contains("Owner")').should('exist'); + usersSettingsPage.getters + .userItem(instanceOwner.email) + .find('.n8n-badge:contains("Owner")') + .should('exist'); // Other users list items should contain action pop-up list usersSettingsPage.getters.userActionsToggle(users[0].email).should('exist'); usersSettingsPage.getters.userActionsToggle(users[1].email).should('exist'); @@ -106,8 +109,13 @@ describe('User Management', () => { it(`should allow user to change their personal data`, () => { personalSettingsPage.actions.loginAndVisit(instanceOwner.email, instanceOwner.password); - personalSettingsPage.actions.updateFirstAndLastName(updatedPersonalData.newFirstName, updatedPersonalData.newLastName); - personalSettingsPage.getters.currentUserName().should('contain', `${updatedPersonalData.newFirstName} ${updatedPersonalData.newLastName}`); + personalSettingsPage.actions.updateFirstAndLastName( + updatedPersonalData.newFirstName, + updatedPersonalData.newLastName, + ); + personalSettingsPage.getters + .currentUserName() + .should('contain', `${updatedPersonalData.newFirstName} ${updatedPersonalData.newLastName}`); workflowPage.getters.successToast().should('contain', 'Personal details updated'); }); @@ -121,18 +129,30 @@ describe('User Management', () => { it(`shouldn't allow user to change password if old password is wrong`, () => { personalSettingsPage.actions.loginAndVisit(instanceOwner.email, instanceOwner.password); personalSettingsPage.actions.updatePassword('iCannotRemember', updatedPersonalData.newPassword); - workflowPage.getters.errorToast().closest('div').should('contain', 'Provided current password is incorrect.'); + workflowPage.getters + .errorToast() + .closest('div') + .should('contain', 'Provided current password is incorrect.'); }); it(`should change current user password`, () => { personalSettingsPage.actions.loginAndVisit(instanceOwner.email, instanceOwner.password); - personalSettingsPage.actions.updatePassword(instanceOwner.password, updatedPersonalData.newPassword); + personalSettingsPage.actions.updatePassword( + instanceOwner.password, + updatedPersonalData.newPassword, + ); workflowPage.getters.successToast().should('contain', 'Password updated'); - personalSettingsPage.actions.loginWithNewData(instanceOwner.email, updatedPersonalData.newPassword); + personalSettingsPage.actions.loginWithNewData( + instanceOwner.email, + updatedPersonalData.newPassword, + ); }); it(`shouldn't allow users to set invalid email`, () => { - personalSettingsPage.actions.loginAndVisit(instanceOwner.email, updatedPersonalData.newPassword); + personalSettingsPage.actions.loginAndVisit( + instanceOwner.email, + updatedPersonalData.newPassword, + ); // try without @ part personalSettingsPage.actions.tryToSetInvalidEmail(updatedPersonalData.newEmail.split('@')[0]); // try without domain @@ -140,9 +160,15 @@ describe('User Management', () => { }); it(`should change user email`, () => { - personalSettingsPage.actions.loginAndVisit(instanceOwner.email, updatedPersonalData.newPassword); + personalSettingsPage.actions.loginAndVisit( + instanceOwner.email, + updatedPersonalData.newPassword, + ); personalSettingsPage.actions.updateEmail(updatedPersonalData.newEmail); workflowPage.getters.successToast().should('contain', 'Personal details updated'); - personalSettingsPage.actions.loginWithNewData(updatedPersonalData.newEmail, updatedPersonalData.newPassword); + personalSettingsPage.actions.loginWithNewData( + updatedPersonalData.newEmail, + updatedPersonalData.newPassword, + ); }); }); diff --git a/cypress/e2e/19-execution.cy.ts b/cypress/e2e/19-execution.cy.ts index 37b9561f6f..79b60d9dc6 100644 --- a/cypress/e2e/19-execution.cy.ts +++ b/cypress/e2e/19-execution.cy.ts @@ -5,10 +5,13 @@ const workflowsPage = new WorkflowsPage(); const workflowPage = new WorkflowPageClass(); const ndv = new NDV(); -describe('Execution',() => { - beforeEach(() => { +describe('Execution', () => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { cy.visit('/'); }); @@ -34,17 +37,36 @@ describe('Execution',() => { workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); // Check canvas nodes after 1st step (workflow passed the manual trigger node - workflowPage.getters.canvasNodeByName('Manual').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check').should('not.exist')); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-sync-alt')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); cy.wait(2000); // Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start) - workflowPage.getters.canvasNodeByName('Manual').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check')).should('be.visible'); + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check')) + .should('be.visible'); // Clear execution data workflowPage.getters.clearExecutionDataButton().should('be.visible'); @@ -77,20 +99,39 @@ describe('Execution',() => { workflowPage.getters.stopExecutionWaitingForWebhookButton().should('not.exist'); // Check canvas nodes after 1st step (workflow passed the manual trigger node - workflowPage.getters.canvasNodeByName('Manual').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check').should('not.exist')); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-sync-alt')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check').should('not.exist')); - + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); cy.wait(1000); workflowPage.getters.stopExecutionButton().click(); // Check canvas nodes after workflow stopped - workflowPage.getters.canvasNodeByName('Manual').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-sync-alt').should('not.visible')); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Manual') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt').should('not.visible')); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); // Clear execution data workflowPage.getters.clearExecutionDataButton().should('be.visible'); @@ -140,17 +181,36 @@ describe('Execution',() => { }); // Check canvas nodes after 1st step (workflow passed the manual trigger node - workflowPage.getters.canvasNodeByName('Webhook').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check').should('not.exist')); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-sync-alt')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); cy.wait(2000); // Check canvas nodes after 2nd step (waiting node finished its execution and the http request node is about to start) - workflowPage.getters.canvasNodeByName('Webhook').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check')).should('be.visible'); + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check')) + .should('be.visible'); // Clear execution data workflowPage.getters.clearExecutionDataButton().should('be.visible'); @@ -200,19 +260,39 @@ describe('Execution',() => { }); // Check canvas nodes after 1st step (workflow passed the manual trigger node - workflowPage.getters.canvasNodeByName('Webhook').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check').should('not.exist')); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-sync-alt')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); cy.wait(1000); workflowPage.getters.stopExecutionWaitingForWebhookButton().click(); // Check canvas nodes after workflow stopped - workflowPage.getters.canvasNodeByName('Webhook').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-check')).should('be.visible'); - workflowPage.getters.canvasNodeByName('Wait').within(() => cy.get('.fa-sync-alt').should('not.visible')); - workflowPage.getters.canvasNodeByName('Set').within(() => cy.get('.fa-check').should('not.exist')); + workflowPage.getters + .canvasNodeByName('Webhook') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-check')) + .should('be.visible'); + workflowPage.getters + .canvasNodeByName('Wait') + .within(() => cy.get('.fa-sync-alt').should('not.visible')); + workflowPage.getters + .canvasNodeByName('Set') + .within(() => cy.get('.fa-check').should('not.exist')); // Clear execution data workflowPage.getters.clearExecutionDataButton().should('be.visible'); diff --git a/cypress/e2e/2-credentials.cy.ts b/cypress/e2e/2-credentials.cy.ts index 2ab6473702..82cfa427a3 100644 --- a/cypress/e2e/2-credentials.cy.ts +++ b/cypress/e2e/2-credentials.cy.ts @@ -259,7 +259,7 @@ describe('Credentials', () => { cy.contains('Create New Credential').click(); credentialsModal.getters.editCredentialModal().should('be.visible'); credentialsModal.getters.editCredentialModal().should('contain.text', 'Notion API'); - }) + }); it('should render custom node with custom credential', () => { workflowPage.actions.visit(); @@ -269,5 +269,5 @@ describe('Credentials', () => { cy.contains('Create New Credential').click(); credentialsModal.getters.editCredentialModal().should('be.visible'); credentialsModal.getters.editCredentialModal().should('contain.text', 'Custom E2E Credential'); - }) + }); }); diff --git a/cypress/e2e/20-workflow-executions.cy.ts b/cypress/e2e/20-workflow-executions.cy.ts index bd7dc0a210..b40f26be91 100644 --- a/cypress/e2e/20-workflow-executions.cy.ts +++ b/cypress/e2e/20-workflow-executions.cy.ts @@ -1,5 +1,5 @@ -import { WorkflowPage } from "../pages"; -import { WorkflowExecutionsTab } from "../pages/workflow-executions-tab"; +import { WorkflowPage } from '../pages'; +import { WorkflowExecutionsTab } from '../pages/workflow-executions-tab'; const workflowPage = new WorkflowPage(); const executionsTab = new WorkflowExecutionsTab(); @@ -9,6 +9,9 @@ describe('Current Workflow Executions', () => { before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { workflowPage.actions.visit(); cy.waitForLoad(); cy.createFixtureWorkflow('Test_workflow_4_executions_view.json', `My test workflow`); @@ -20,12 +23,14 @@ describe('Current Workflow Executions', () => { executionsTab.getters.executionListItems().should('have.length', 11); executionsTab.getters.successfulExecutionListItems().should('have.length', 9); executionsTab.getters.failedExecutionListItems().should('have.length', 2); - executionsTab.getters.executionListItems().first().invoke('attr','class').should('match', /_active_/); + executionsTab.getters + .executionListItems() + .first() + .invoke('attr', 'class') + .should('match', /_active_/); }); - }); - const createMockExecutions = () => { workflowPage.actions.turnOnManualExecutionSaving(); executionsTab.actions.createManualExecutions(5); @@ -37,4 +42,4 @@ const createMockExecutions = () => { executionsTab.actions.createManualExecutions(4); executionsTab.actions.switchToExecutionsTab(); cy.waitForLoad(); -} +}; diff --git a/cypress/e2e/4-node-creator.cy.ts b/cypress/e2e/4-node-creator.cy.ts index 4068b2c1fd..9850ab14c1 100644 --- a/cypress/e2e/4-node-creator.cy.ts +++ b/cypress/e2e/4-node-creator.cy.ts @@ -28,11 +28,7 @@ describe('Node Creator', () => { it('should open node creator on trigger tab if no trigger is on canvas', () => { nodeCreatorFeature.getters.canvasAddButton().click(); - nodeCreatorFeature.getters - .nodeCreator() - .contains('Select a trigger') - .should('be.visible'); - + nodeCreatorFeature.getters.nodeCreator().contains('Select a trigger').should('be.visible'); }); it('should navigate subcategory', () => { @@ -86,20 +82,14 @@ describe('Node Creator', () => { // TODO: Replace once we have canvas feature utils cy.get('div').contains('Add first step').should('be.hidden'); - nodeCreatorFeature.actions.openNodeCreator() - nodeCreatorFeature.getters - .nodeCreator() - .contains('What happens next?') - .should('be.visible'); + nodeCreatorFeature.actions.openNodeCreator(); + nodeCreatorFeature.getters.nodeCreator().contains('What happens next?').should('be.visible'); - nodeCreatorFeature.getters.getCreatorItem('Add another trigger').click(); - nodeCreatorFeature.getters.nodeCreator().contains('Select a trigger').should('be.visible'); - nodeCreatorFeature.getters.activeSubcategory().find('button').should('exist'); - nodeCreatorFeature.getters.activeSubcategory().find('button').click(); - nodeCreatorFeature.getters - .nodeCreator() - .contains('What happens next?') - .should('be.visible'); + nodeCreatorFeature.getters.getCreatorItem('Add another trigger').click(); + nodeCreatorFeature.getters.nodeCreator().contains('Select a trigger').should('be.visible'); + nodeCreatorFeature.getters.activeSubcategory().find('button').should('exist'); + nodeCreatorFeature.getters.activeSubcategory().find('button').click(); + nodeCreatorFeature.getters.nodeCreator().contains('What happens next?').should('be.visible'); }); it('should add node to canvas from actions panel', () => { @@ -110,7 +100,7 @@ describe('Node Creator', () => { nodeCreatorFeature.getters.activeSubcategory().should('have.text', editImageNode); nodeCreatorFeature.getters.getCreatorItem('Crop Image').click(); NDVModal.getters.parameterInput('operation').should('contain.text', 'Crop'); - }) + }); it('should search through actions and confirm added action', () => { nodeCreatorFeature.actions.openNodeCreator(); diff --git a/cypress/e2e/5-ndv.cy.ts b/cypress/e2e/5-ndv.cy.ts index 350ad3a185..9025725e55 100644 --- a/cypress/e2e/5-ndv.cy.ts +++ b/cypress/e2e/5-ndv.cy.ts @@ -6,16 +6,17 @@ const workflowPage = new WorkflowPage(); const ndv = new NDV(); describe('NDV', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + beforeEach(() => { 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'); workflowPage.getters.canvasNodes().first().dblclick(); diff --git a/cypress/e2e/6-code-node.cy.ts b/cypress/e2e/6-code-node.cy.ts index 540e4825a0..0e4a16d933 100644 --- a/cypress/e2e/6-code-node.cy.ts +++ b/cypress/e2e/6-code-node.cy.ts @@ -5,7 +5,7 @@ const WorkflowPage = new WorkflowPageClass(); const ndv = new NDV(); describe('Code node', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); }); diff --git a/cypress/e2e/7-workflow-actions.cy.ts b/cypress/e2e/7-workflow-actions.cy.ts index aeb3752ec2..4742bb3cbc 100644 --- a/cypress/e2e/7-workflow-actions.cy.ts +++ b/cypress/e2e/7-workflow-actions.cy.ts @@ -14,9 +14,12 @@ const DUPLICATE_WORKFLOW_TAG = 'Duplicate'; const WorkflowPage = new WorkflowPageClass(); describe('Workflow Actions', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); + }); + + beforeEach(() => { WorkflowPage.actions.visit(); cy.waitForLoad(); }); diff --git a/cypress/e2e/8-http-request-node.cy.ts b/cypress/e2e/8-http-request-node.cy.ts index cc62b5182f..11c9619472 100644 --- a/cypress/e2e/8-http-request-node.cy.ts +++ b/cypress/e2e/8-http-request-node.cy.ts @@ -5,7 +5,7 @@ const workflowPage = new WorkflowPage(); const ndv = new NDV(); describe('HTTP Request node', () => { - beforeEach(() => { + before(() => { cy.resetAll(); cy.skipSetup(); });