mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
ci: Fix running e2e tests in dev mode (no-changelog) (#6717)
This commit is contained in:
parent
995d5cc470
commit
710421fcc3
|
@ -1,6 +1,5 @@
|
||||||
import { randFirstName, randLastName } from '@ngneat/falso';
|
import { randFirstName, randLastName } from '@ngneat/falso';
|
||||||
|
|
||||||
export const BASE_URL = 'http://localhost:5678';
|
|
||||||
export const BACKEND_BASE_URL = 'http://localhost:5678';
|
export const BACKEND_BASE_URL = 'http://localhost:5678';
|
||||||
export const N8N_AUTH_COOKIE = 'n8n-auth';
|
export const N8N_AUTH_COOKIE = 'n8n-auth';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'cypress-real-events';
|
import 'cypress-real-events';
|
||||||
import { WorkflowPage } from '../pages';
|
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) => {
|
Cypress.Commands.add('getByTestId', (selector, ...args) => {
|
||||||
return cy.get(`[data-test-id="${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.Commands.add('signin', ({ email, password }) => {
|
||||||
Cypress.session.clearAllSavedSessions();
|
Cypress.session.clearAllSavedSessions();
|
||||||
cy.session([email, password], () => cy.request('POST', '/rest/login', { email, password }), {
|
cy.session(
|
||||||
validate() {
|
[email, password],
|
||||||
cy.getCookie(N8N_AUTH_COOKIE).should('exist');
|
() => cy.request('POST', `${BACKEND_BASE_URL}/rest/login`, { email, password }),
|
||||||
|
{
|
||||||
|
validate() {
|
||||||
|
cy.getCookie(N8N_AUTH_COOKIE).should('exist');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('signout', () => {
|
Cypress.Commands.add('signout', () => {
|
||||||
|
@ -58,7 +62,10 @@ Cypress.Commands.add('interceptREST', (method, url) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const setFeature = (feature: string, enabled: boolean) =>
|
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('enableFeature', (feature: string) => setFeature(feature, true));
|
||||||
Cypress.Commands.add('disableFeature', (feature): string => setFeature(feature, false));
|
Cypress.Commands.add('disableFeature', (feature): string => setFeature(feature, false));
|
||||||
|
|
|
@ -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';
|
import './commands';
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.request('POST', `${BASE_URL}/rest/e2e/reset`, {
|
cy.request('POST', `${BACKEND_BASE_URL}/rest/e2e/reset`, {
|
||||||
owner: INSTANCE_OWNER,
|
owner: INSTANCE_OWNER,
|
||||||
members: INSTANCE_MEMBERS,
|
members: INSTANCE_MEMBERS,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue