From edf6313fa51ecfe34ad626a956012d911754ec09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Thu, 9 Mar 2023 17:08:47 +0100 Subject: [PATCH] ci: Fix e2e tests (no-changelog) (#5658) * ci: Fix e2e tests (no-changelog) * Fix sign-in cypress command * Run smoke test against head branch instead of base --------- Co-authored-by: Oleg Ivaniv --- .github/workflows/ci-pull-requests.yml | 2 +- cypress/support/commands.ts | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 922cbbda96..e14db3222e 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -108,7 +108,7 @@ jobs: uses: ./.github/workflows/e2e-reusable.yml if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-e2e') }} with: - branch: ${{ github.event.pull_request.base.ref }} + branch: ${{ github.event.pull_request.head.ref }} user: ${{ github.event.inputs.user || 'PR User' }} spec: ${{ github.event.inputs.spec || 'e2e/0-smoke.cy.ts' }} run-env: base:16.18.1 diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index f970970a90..42b9f73c3d 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -24,9 +24,8 @@ // -- This will overwrite an existing command -- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) import 'cypress-real-events'; -import { SigninPage, SignupPage, SettingsUsersPage, WorkflowPage } from '../pages'; +import { WorkflowsPage, SigninPage, SignupPage, SettingsUsersPage, WorkflowPage } from '../pages'; import { N8N_AUTH_COOKIE } from '../constants'; -import { WorkflowPage as WorkflowPageClass } from '../pages/workflow'; import { MessageBox } from '../pages/modals/message-box'; Cypress.Commands.add('getByTestId', (selector, ...args) => { @@ -34,15 +33,15 @@ Cypress.Commands.add('getByTestId', (selector, ...args) => { }); Cypress.Commands.add('createFixtureWorkflow', (fixtureKey, workflowName) => { - const WorkflowPage = new WorkflowPageClass(); + const workflowPage = new WorkflowPage(); // We need to force the click because the input is hidden - WorkflowPage.getters + workflowPage.getters .workflowImportInput() .selectFile(`cypress/fixtures/${fixtureKey}`, { force: true }); - WorkflowPage.actions.setWorkflowName(workflowName); + workflowPage.actions.setWorkflowName(workflowName); - WorkflowPage.getters.saveButton().should('contain', 'Saved'); + workflowPage.getters.saveButton().should('contain', 'Saved'); }); Cypress.Commands.add( @@ -209,7 +208,9 @@ Cypress.Commands.add('grantBrowserPermissions', (...permissions: string[]) => { } }); -Cypress.Commands.add('readClipboard', () => cy.window().then(win => win.navigator.clipboard.readText())) +Cypress.Commands.add('readClipboard', () => + cy.window().then((win) => win.navigator.clipboard.readText()), +); Cypress.Commands.add('paste', { prevSubject: true }, (selector, pastePayload) => { // https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event