From 710421fcc3516ff1f9187777aa4e050e1157bf1a 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: Fri, 21 Jul 2023 11:48:23 +0200 Subject: [PATCH] ci: Fix running e2e tests in dev mode (no-changelog) (#6717) --- cypress/constants.ts | 1 - cypress/support/commands.ts | 19 +++++++++++++------ cypress/support/e2e.ts | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cypress/constants.ts b/cypress/constants.ts index dcb96b5ffd..06ccbd7130 100644 --- a/cypress/constants.ts +++ b/cypress/constants.ts @@ -1,6 +1,5 @@ import { randFirstName, randLastName } from '@ngneat/falso'; -export const BASE_URL = 'http://localhost:5678'; export const BACKEND_BASE_URL = 'http://localhost:5678'; export const N8N_AUTH_COOKIE = 'n8n-auth'; diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 505022934a..6c7adaea8f 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -1,6 +1,6 @@ import 'cypress-real-events'; import { WorkflowPage } from '../pages'; -import { BASE_URL, N8N_AUTH_COOKIE } from '../constants'; +import { BACKEND_BASE_URL, N8N_AUTH_COOKIE } from '../constants'; Cypress.Commands.add('getByTestId', (selector, ...args) => { return cy.get(`[data-test-id="${selector}"]`, ...args); @@ -41,11 +41,15 @@ Cypress.Commands.add('waitForLoad', (waitForIntercepts = true) => { Cypress.Commands.add('signin', ({ email, password }) => { Cypress.session.clearAllSavedSessions(); - cy.session([email, password], () => cy.request('POST', '/rest/login', { email, password }), { - validate() { - cy.getCookie(N8N_AUTH_COOKIE).should('exist'); + cy.session( + [email, password], + () => cy.request('POST', `${BACKEND_BASE_URL}/rest/login`, { email, password }), + { + validate() { + cy.getCookie(N8N_AUTH_COOKIE).should('exist'); + }, }, - }); + ); }); Cypress.Commands.add('signout', () => { @@ -58,7 +62,10 @@ Cypress.Commands.add('interceptREST', (method, url) => { }); const setFeature = (feature: string, enabled: boolean) => - cy.request('PATCH', `${BASE_URL}/rest/e2e/feature`, { feature: `feat:${feature}`, enabled }); + cy.request('PATCH', `${BACKEND_BASE_URL}/rest/e2e/feature`, { + feature: `feat:${feature}`, + enabled, + }); Cypress.Commands.add('enableFeature', (feature: string) => setFeature(feature, true)); Cypress.Commands.add('disableFeature', (feature): string => setFeature(feature, false)); diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 456ba9efd9..dc3079282f 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -1,8 +1,8 @@ -import { BASE_URL, INSTANCE_MEMBERS, INSTANCE_OWNER } from '../constants'; +import { BACKEND_BASE_URL, INSTANCE_MEMBERS, INSTANCE_OWNER } from '../constants'; import './commands'; before(() => { - cy.request('POST', `${BASE_URL}/rest/e2e/reset`, { + cy.request('POST', `${BACKEND_BASE_URL}/rest/e2e/reset`, { owner: INSTANCE_OWNER, members: INSTANCE_MEMBERS, });