mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
test: Add initial e2e tests for default owner setup (#4710)
* use user-folder override consistently everywhere, including for the `.cache` folder * use consistent config for e2e tesing, skipping config loading from env and config files * simplify all the cypress commands, and run all e2e tests on master * add tests for skipping owner setup * add todos Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
parent
500775de69
commit
d46050c974
|
@ -7,7 +7,7 @@ const firstName = randFirstName();
|
|||
const lastName = randLastName();
|
||||
|
||||
describe('Authentication', () => {
|
||||
it('should sign user up', () => {
|
||||
it('should setup owner', () => {
|
||||
cy.signup(username, firstName, lastName, password);
|
||||
});
|
||||
|
||||
|
|
9
cypress/e2e/3-default-owner.cy.ts
Normal file
9
cypress/e2e/3-default-owner.cy.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
describe('Authentication', () => {
|
||||
it('should skip owner setup', () => {
|
||||
cy.skipSetup();
|
||||
});
|
||||
|
||||
// todo test for adding workflow
|
||||
// todo test for setting up UM again through settings
|
||||
// todo test that workflows migrated successfully
|
||||
});
|
18
cypress/pages/modals/message-box.ts
Normal file
18
cypress/pages/modals/message-box.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { BasePage } from "../base";
|
||||
|
||||
export class MessageBox extends BasePage {
|
||||
getters = {
|
||||
modal: () => cy.get('.el-message-box', { withinSubject: null }),
|
||||
header: () => this.getters.modal().find('.el-message-box__title'),
|
||||
confirm: () => this.getters.modal().find('.btn--confirm'),
|
||||
cancel: () => this.getters.modal().find('.btn--cancel'),
|
||||
};
|
||||
actions = {
|
||||
confirm: () => {
|
||||
this.getters.confirm().click();
|
||||
},
|
||||
cancel: () => {
|
||||
this.getters.cancel().click();
|
||||
},
|
||||
};
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { BasePage } from "./base";
|
||||
|
||||
// todo rename to setup
|
||||
export class SignupPage extends BasePage {
|
||||
url = '/setup';
|
||||
getters = {
|
||||
|
@ -9,5 +10,6 @@ export class SignupPage extends BasePage {
|
|||
lastName: () => cy.getByTestId('lastName'),
|
||||
password: () => cy.getByTestId('password'),
|
||||
submit: () => cy.get('button'),
|
||||
skip: () => cy.get('a'),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
import { WorkflowsPage, SigninPage, SignupPage } 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) => {
|
||||
return cy.get(`[data-test-id="${selector}"]`, ...args)
|
||||
|
@ -74,6 +75,7 @@ Cypress.Commands.add(
|
|||
});
|
||||
});
|
||||
|
||||
// todo rename to setup
|
||||
Cypress.Commands.add('signup', (email, firstName, lastName, password) => {
|
||||
const signupPage = new SignupPage();
|
||||
|
||||
|
@ -93,3 +95,28 @@ Cypress.Commands.add('signup', (email, firstName, lastName, password) => {
|
|||
});
|
||||
});
|
||||
})
|
||||
|
||||
Cypress.Commands.add('skipSetup', () => {
|
||||
const signupPage = new SignupPage();
|
||||
const workflowsPage = new WorkflowsPage();
|
||||
const Confirmation = new MessageBox();
|
||||
|
||||
cy.visit(signupPage.url);
|
||||
|
||||
signupPage.getters.form().within(() => {
|
||||
cy.url().then((url) => {
|
||||
if (url.endsWith(signupPage.url)) {
|
||||
signupPage.getters.skip().click();
|
||||
|
||||
|
||||
Confirmation.getters.header().should('contain.text', 'Skip owner account setup?');
|
||||
Confirmation.actions.confirm();
|
||||
|
||||
// we should be redirected to /workflows
|
||||
cy.url().should('include', workflowsPage.url);
|
||||
} else {
|
||||
cy.log('User already signed up');
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
|
@ -8,7 +8,9 @@ declare global {
|
|||
findChildByTestId(childTestId: string): Chainable<JQuery<HTMLElement>>
|
||||
createFixtureWorkflow(fixtureKey: string, workflowName: string): void;
|
||||
signin(email: string, password: string): void;
|
||||
// todo: rename to setup
|
||||
signup(email: string, firstName: string, lastName: string, password: string): void;
|
||||
skipSetup(): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue