From 10e011d71edd58e2fa5b96e116bf6501e6945f92 Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 26 Nov 2024 13:57:00 +0100 Subject: [PATCH] chore: Fix flaky cypress tests (no-changelog) (#11894) --- cypress/e2e/17-sharing.cy.ts | 12 ++++++------ cypress/e2e/39-projects.cy.ts | 4 ++-- cypress/pages/workflows.ts | 2 ++ .../design-system/src/components/N8nCard/Card.vue | 6 +++--- .../N8nCard/__snapshots__/Card.test.ts.snap | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cypress/e2e/17-sharing.cy.ts b/cypress/e2e/17-sharing.cy.ts index 51b4a674d3..8a8fd4e4c1 100644 --- a/cypress/e2e/17-sharing.cy.ts +++ b/cypress/e2e/17-sharing.cy.ts @@ -88,7 +88,7 @@ describe('Sharing', { disableAutoLogin: true }, () => { cy.visit(workflowsPage.url); workflowsPage.getters.workflowCards().should('have.length', 1); - workflowsPage.getters.workflowCard('Workflow W1').click(); + workflowsPage.getters.workflowCardContent('Workflow W1').click(); workflowPage.actions.addNodeToCanvas('Airtable', true, true); ndv.getters.credentialInput().find('input').should('have.value', 'Credential C2'); ndv.actions.close(); @@ -104,7 +104,7 @@ describe('Sharing', { disableAutoLogin: true }, () => { cy.visit(workflowsPage.url); workflowsPage.getters.workflowCards().should('have.length', 2); - workflowsPage.getters.workflowCard('Workflow W1').click(); + workflowsPage.getters.workflowCardContent('Workflow W1').click(); workflowPage.actions.addNodeToCanvas('Airtable', true, true); ndv.getters.credentialInput().find('input').should('have.value', 'Credential C2'); ndv.actions.close(); @@ -133,7 +133,7 @@ describe('Sharing', { disableAutoLogin: true }, () => { cy.visit(workflowsPage.url); workflowsPage.getters.workflowCards().should('have.length', 2); - workflowsPage.getters.workflowCard('Workflow W1').click(); + workflowsPage.getters.workflowCardContent('Workflow W1').click(); workflowPage.actions.openNode('Notion'); ndv.getters .credentialInput() @@ -144,7 +144,7 @@ describe('Sharing', { disableAutoLogin: true }, () => { cy.waitForLoad(); cy.visit(workflowsPage.url); - workflowsPage.getters.workflowCard('Workflow W2').click('top'); + workflowsPage.getters.workflowCardContent('Workflow W2').click('top'); workflowPage.actions.executeWorkflow(); }); @@ -353,7 +353,7 @@ describe('Credential Usage in Cross Shared Workflows', () => { credentialsPage.getters.emptyListCreateCredentialButton().click(); credentialsModal.actions.createNewCredential('Notion API'); cy.visit(workflowsPage.url); - workflowsPage.getters.workflowCard(workflowName).click(); + workflowsPage.getters.workflowCardContent(workflowName).click(); workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true); // Only the own credential the shared one (+ the 'Create new' option) @@ -398,7 +398,7 @@ describe('Credential Usage in Cross Shared Workflows', () => { credentialsPage.getters.createCredentialButton().click(); credentialsModal.actions.createNewCredential('Notion API'); cy.visit(workflowsPage.url); - workflowsPage.getters.workflowCard(workflowName).click(); + workflowsPage.getters.workflowCardContent(workflowName).click(); workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true); // Only the personal credentials of the workflow owner and the global owner diff --git a/cypress/e2e/39-projects.cy.ts b/cypress/e2e/39-projects.cy.ts index bbd0508662..cc1ab5ca36 100644 --- a/cypress/e2e/39-projects.cy.ts +++ b/cypress/e2e/39-projects.cy.ts @@ -186,7 +186,7 @@ describe('Projects', { disableAutoLogin: true }, () => { menuItems.filter(':contains("Development")[class*=active_]').should('exist'); cy.intercept('GET', '/rest/workflows/*').as('loadWorkflow'); - workflowsPage.getters.workflowCards().first().click(); + workflowsPage.getters.workflowCards().first().findChildByTestId('card-content').click(); cy.wait('@loadWorkflow'); menuItems = cy.getByTestId('menu-item'); @@ -747,7 +747,7 @@ describe('Projects', { disableAutoLogin: true }, () => { // Open the moved workflow workflowsPage.getters.workflowCards().should('have.length', 1); - workflowsPage.getters.workflowCards().first().click(); + workflowsPage.getters.workflowCards().first().findChildByTestId('card-content').click(); // Check if the credential can be changed workflowPage.getters.canvasNodeByName(NOTION_NODE_NAME).should('be.visible').dblclick(); diff --git a/cypress/pages/workflows.ts b/cypress/pages/workflows.ts index 199cc3d31c..41f62e8bc3 100644 --- a/cypress/pages/workflows.ts +++ b/cypress/pages/workflows.ts @@ -56,6 +56,8 @@ export class WorkflowsPage extends BasePage { .parents('[data-test-id="resources-list-item"]'), workflowTags: (workflowName: string) => this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-tags'), + workflowCardContent: (workflowName: string) => + this.getters.workflowCard(workflowName).findChildByTestId('card-content'), workflowActivator: (workflowName: string) => this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-activator'), workflowActivatorStatus: (workflowName: string) => diff --git a/packages/design-system/src/components/N8nCard/Card.vue b/packages/design-system/src/components/N8nCard/Card.vue index 589a7f6c36..17630a4d1e 100644 --- a/packages/design-system/src/components/N8nCard/Card.vue +++ b/packages/design-system/src/components/N8nCard/Card.vue @@ -20,10 +20,10 @@ const classes = computed(() => ({