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 <oleg@n8n.io>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-03-09 17:08:47 +01:00 committed by GitHub
parent 1979eb8a9c
commit edf6313fa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -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

View file

@ -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