From e824ab057db5687325618109c18f35565811bfd8 Mon Sep 17 00:00:00 2001 From: OlegIvaniv Date: Fri, 28 Jul 2023 16:46:26 +0200 Subject: [PATCH] test(editor): Prevent node view unload by default in e2e run (#6787) Signed-off-by: Oleg Ivaniv --- cypress/e2e/14-data-transformation-expressions.cy.ts | 5 ----- cypress/e2e/14-mapping.cy.ts | 5 ----- cypress/e2e/16-webhook-node.cy.ts | 5 ----- cypress/e2e/25-stickies.cy.ts | 5 ----- cypress/pages/workflow.ts | 6 +++++- 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/cypress/e2e/14-data-transformation-expressions.cy.ts b/cypress/e2e/14-data-transformation-expressions.cy.ts index fc303c603b..829820b8e5 100644 --- a/cypress/e2e/14-data-transformation-expressions.cy.ts +++ b/cypress/e2e/14-data-transformation-expressions.cy.ts @@ -6,11 +6,6 @@ const ndv = new NDV(); describe('Data transformation expressions', () => { beforeEach(() => { wf.actions.visit(); - - cy.window().then((win) => { - // @ts-ignore - win.preventNodeViewBeforeUnload = true; - }); }); it('$json + native string methods', () => { diff --git a/cypress/e2e/14-mapping.cy.ts b/cypress/e2e/14-mapping.cy.ts index fa9bdd78a2..02ffef9613 100644 --- a/cypress/e2e/14-mapping.cy.ts +++ b/cypress/e2e/14-mapping.cy.ts @@ -12,11 +12,6 @@ const ndv = new NDV(); describe('Data mapping', () => { beforeEach(() => { workflowPage.actions.visit(); - - cy.window().then((win) => { - // @ts-ignore - win.preventNodeViewBeforeUnload = true; - }); }); it('maps expressions from table header', () => { diff --git a/cypress/e2e/16-webhook-node.cy.ts b/cypress/e2e/16-webhook-node.cy.ts index 80a649a952..3b96f744a5 100644 --- a/cypress/e2e/16-webhook-node.cy.ts +++ b/cypress/e2e/16-webhook-node.cy.ts @@ -79,11 +79,6 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => { describe('Webhook Trigger node', async () => { beforeEach(() => { workflowPage.actions.visit(); - - cy.window().then((win) => { - // @ts-ignore - win.preventNodeViewBeforeUnload = true; - }); }); it('should listen for a GET request', () => { diff --git a/cypress/e2e/25-stickies.cy.ts b/cypress/e2e/25-stickies.cy.ts index d0e219575f..ac94f882dd 100644 --- a/cypress/e2e/25-stickies.cy.ts +++ b/cypress/e2e/25-stickies.cy.ts @@ -23,11 +23,6 @@ function checkStickiesStyle( describe('Canvas Actions', () => { beforeEach(() => { workflowPage.actions.visit(); - - cy.window().then((win) => { - // @ts-ignore - win.preventNodeViewBeforeUnload = true; - }); }); it('adds sticky to canvas with default text and position', () => { diff --git a/cypress/pages/workflow.ts b/cypress/pages/workflow.ts index afe2a2081a..7333db5c86 100644 --- a/cypress/pages/workflow.ts +++ b/cypress/pages/workflow.ts @@ -115,9 +115,13 @@ export class WorkflowPage extends BasePage { editorTabButton: () => cy.getByTestId('radio-button-workflow'), }; actions = { - visit: () => { + visit: (preventNodeViewUnload = true) => { cy.visit(this.url); cy.waitForLoad(); + cy.window().then((win) => { + // @ts-ignore + win.preventNodeViewBeforeUnload = preventNodeViewUnload; + }); }, addInitialNodeToCanvas: (nodeDisplayName: string, { keepNdvOpen } = { keepNdvOpen: false }) => { this.getters.canvasPlusButton().click();