mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
test: Address flaky setup e2e (no-changelog) (#6085)
* test: Add /setup intercept for `skipSetup` command (no-changelog) * Drop all tables for e2e reset, intercept account setup request * Fix linting issues * Allow to skip setup account request intercept and linting fixes * Make sure variables are loaded * Use PATCH for enabling of e2e features * Do not exclude migration table from truncation * Add user sign-up intercept
This commit is contained in:
@@ -16,6 +16,7 @@ describe('Variables', () => {
|
||||
});
|
||||
|
||||
it('should show the unlicensed action box when the feature is disabled', () => {
|
||||
cy.disableFeature('feat:variables');
|
||||
cy.signin({ email, password });
|
||||
cy.visit(variablesPage.url);
|
||||
|
||||
@@ -30,7 +31,10 @@ describe('Variables', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.signin({ email, password });
|
||||
cy.intercept('GET', '/rest/variables').as('loadVariables');
|
||||
|
||||
cy.visit(variablesPage.url);
|
||||
cy.wait(['@loadVariables', '@loadSettings']);
|
||||
});
|
||||
|
||||
it('should show the licensed action box when the feature is enabled', () => {
|
||||
|
||||
@@ -84,11 +84,12 @@ describe('Default owner', () => {
|
||||
});
|
||||
|
||||
it('should be able to setup instance and migrate workflows and credentials', () => {
|
||||
cy.setup({ email, firstName, lastName, password });
|
||||
cy.setup({ email, firstName, lastName, password }, true);
|
||||
|
||||
messageBox.getters.content().should('contain.text', '1 existing workflow and 1 credential');
|
||||
|
||||
messageBox.actions.confirm();
|
||||
cy.wait('@setupRequest');
|
||||
cy.url().should('include', settingsUsersPage.url);
|
||||
settingsSidebar.actions.back();
|
||||
|
||||
|
||||
@@ -105,18 +105,22 @@ Cypress.Commands.add('signup', ({ firstName, lastName, password, url }) => {
|
||||
|
||||
signupPage.getters.form().within(() => {
|
||||
cy.url().then((url) => {
|
||||
cy.intercept('/rest/users/*').as('userSignup')
|
||||
signupPage.getters.firstName().type(firstName);
|
||||
signupPage.getters.lastName().type(lastName);
|
||||
signupPage.getters.password().type(password);
|
||||
signupPage.getters.submit().click();
|
||||
cy.wait('@userSignup');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('setup', ({ email, firstName, lastName, password }) => {
|
||||
Cypress.Commands.add('setup', ({ email, firstName, lastName, password }, skipIntercept = false) => {
|
||||
const signupPage = new SignupPage();
|
||||
|
||||
cy.intercept('GET', signupPage.url).as('setupPage');
|
||||
cy.visit(signupPage.url);
|
||||
cy.wait('@setupPage');
|
||||
|
||||
signupPage.getters.form().within(() => {
|
||||
cy.url().then((url) => {
|
||||
@@ -125,7 +129,13 @@ Cypress.Commands.add('setup', ({ email, firstName, lastName, password }) => {
|
||||
signupPage.getters.firstName().type(firstName);
|
||||
signupPage.getters.lastName().type(lastName);
|
||||
signupPage.getters.password().type(password);
|
||||
|
||||
cy.intercept('POST', '/rest/owner/setup').as('setupRequest');
|
||||
signupPage.getters.submit().click();
|
||||
|
||||
if(!skipIntercept) {
|
||||
cy.wait('@setupRequest');
|
||||
}
|
||||
} else {
|
||||
cy.log('User already signed up');
|
||||
}
|
||||
@@ -168,7 +178,9 @@ Cypress.Commands.add('skipSetup', () => {
|
||||
const workflowPage = new WorkflowPage();
|
||||
const Confirmation = new MessageBox();
|
||||
|
||||
cy.intercept('GET', signupPage.url).as('setupPage');
|
||||
cy.visit(signupPage.url);
|
||||
cy.wait('@setupPage');
|
||||
|
||||
signupPage.getters.form().within(() => {
|
||||
cy.url().then((url) => {
|
||||
@@ -199,7 +211,11 @@ Cypress.Commands.add('setupOwner', (payload) => {
|
||||
});
|
||||
|
||||
Cypress.Commands.add('enableFeature', (feature) => {
|
||||
cy.task('enable-feature', feature);
|
||||
cy.task('set-feature', { feature, enabled: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add('disableFeature', (feature) => {
|
||||
cy.task('set-feature', { feature, enabled: false });
|
||||
});
|
||||
|
||||
Cypress.Commands.add('grantBrowserPermissions', (...permissions: string[]) => {
|
||||
|
||||
@@ -36,13 +36,14 @@ declare global {
|
||||
signin(payload: SigninPayload): void;
|
||||
signout(): void;
|
||||
signup(payload: SignupPayload): void;
|
||||
setup(payload: SetupPayload): void;
|
||||
setup(payload: SetupPayload, skipIntercept?: boolean): void;
|
||||
setupOwner(payload: SetupPayload): void;
|
||||
inviteUsers(payload: InviteUsersPayload): void;
|
||||
interceptREST(method: string, url: string): Chainable<Interception>;
|
||||
skipSetup(): void;
|
||||
resetAll(): void;
|
||||
enableFeature(feature: string): void;
|
||||
disableFeature(feature: string): void;
|
||||
waitForLoad(waitForIntercepts?: boolean): void;
|
||||
grantBrowserPermissions(...permissions: string[]): void;
|
||||
readClipboard(): Chainable<string>;
|
||||
|
||||
Reference in New Issue
Block a user