ci: Fix running e2e tests in dev mode (no-changelog) (#6717)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-07-21 11:48:23 +02:00 committed by GitHub
parent 995d5cc470
commit 710421fcc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View file

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

View file

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

View file

@ -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,
});