From 20bbc7f80b9e32104b4a8d635877b997c61fe880 Mon Sep 17 00:00:00 2001 From: shortstacked Date: Mon, 18 Aug 2025 09:05:38 +0100 Subject: [PATCH] test: Migrate 2929 test to Playwright (#18425) --- ...o-can-load-old-switch-node-workflows.cy.ts | 17 ---------------- .../testing/playwright/pages/CanvasPage.ts | 4 ++++ ...can-load-old-switch-node-workflows.spec.ts | 20 +++++++++++++++++++ .../Switch_node_with_null_connection.json | 0 4 files changed, 24 insertions(+), 17 deletions(-) delete mode 100644 cypress/e2e/2929-ado-can-load-old-switch-node-workflows.cy.ts create mode 100644 packages/testing/playwright/tests/ui/2929-ado-can-load-old-switch-node-workflows.spec.ts rename {cypress/fixtures => packages/testing/playwright/workflows}/Switch_node_with_null_connection.json (100%) diff --git a/cypress/e2e/2929-ado-can-load-old-switch-node-workflows.cy.ts b/cypress/e2e/2929-ado-can-load-old-switch-node-workflows.cy.ts deleted file mode 100644 index 39edc54163..0000000000 --- a/cypress/e2e/2929-ado-can-load-old-switch-node-workflows.cy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { - deleteNode, - getCanvasNodes, - navigateToNewWorkflowPage, - pasteWorkflow, -} from '../composables/workflow'; -import Workflow from '../fixtures/Switch_node_with_null_connection.json'; - -describe('ADO-2929 can load Switch nodes', () => { - it('can load workflows with Switch nodes with null at connection index', () => { - navigateToNewWorkflowPage(); - pasteWorkflow(Workflow); - getCanvasNodes().should('have.length', 3); - deleteNode('Switch'); - getCanvasNodes().should('have.length', 2); - }); -}); diff --git a/packages/testing/playwright/pages/CanvasPage.ts b/packages/testing/playwright/pages/CanvasPage.ts index 8092a81d1e..bc21fdd48b 100644 --- a/packages/testing/playwright/pages/CanvasPage.ts +++ b/packages/testing/playwright/pages/CanvasPage.ts @@ -259,4 +259,8 @@ export class CanvasPage extends BasePage { async clickProductionChecklistAction(actionText: string): Promise { await this.getProductionChecklistActionItem(actionText).click(); } + + getCanvasNodes() { + return this.page.getByTestId('canvas-node'); + } } diff --git a/packages/testing/playwright/tests/ui/2929-ado-can-load-old-switch-node-workflows.spec.ts b/packages/testing/playwright/tests/ui/2929-ado-can-load-old-switch-node-workflows.spec.ts new file mode 100644 index 0000000000..24686e1883 --- /dev/null +++ b/packages/testing/playwright/tests/ui/2929-ado-can-load-old-switch-node-workflows.spec.ts @@ -0,0 +1,20 @@ +import { test, expect } from '../../fixtures/base'; +import type { TestRequirements } from '../../Types'; + +const requirements: TestRequirements = { + workflow: { + 'Switch_node_with_null_connection.json': 'Switch Node with Null Connection', + }, +}; + +test.describe('ADO-2929 can load Switch nodes', () => { + test('can load workflows with Switch nodes with null at connection index @auth:owner', async ({ + n8n, + setupRequirements, + }) => { + await setupRequirements(requirements); + await expect(n8n.canvas.getCanvasNodes()).toHaveCount(3); + await n8n.canvas.deleteNodeByName('Switch'); + await expect(n8n.canvas.getCanvasNodes()).toHaveCount(2); + }); +}); diff --git a/cypress/fixtures/Switch_node_with_null_connection.json b/packages/testing/playwright/workflows/Switch_node_with_null_connection.json similarity index 100% rename from cypress/fixtures/Switch_node_with_null_connection.json rename to packages/testing/playwright/workflows/Switch_node_with_null_connection.json