test(editor): Fix flaky e2e tests (#4779)

* test(editor): Fix default-owner and credentials saving e2e specs

* test(editor): fix webhook node test

* test(editor): add cy command for browser permissions

* test(editor): add cy command for reading clipboard

* Fix 3-default-owner spec

* Resolve review comments

* Merge spec

* Fix http node and expression editor modal specs

* Add optional param to credentials modal saving action to wait for the test endpoint

* Improve sidebar items clicking and increase credentials saving timeout

* Rename http e2e spec to fix ordering

* Fix pasting and copying of nodes e2e spec

* Make sure to only access error.cause if it exists

* Wait longer for the keyboard press

* Make sure to focus the body when typing

* Try type delay

* Use meta key based on the running platform

* Fix flaky workflowTagElements getter

Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
This commit is contained in:
OlegIvaniv
2022-12-07 18:16:38 +01:00
committed by GitHub
parent 6d5ea0634c
commit 1c36c37a12
12 changed files with 109 additions and 92 deletions

View File

@@ -24,92 +24,86 @@ const firstName = randFirstName();
const lastName = randLastName();
describe('Default owner', () => {
// todo test should redirect to setup if have not skipped
beforeEach(() => {
before(() => {
cy.resetAll();
});
beforeEach(() => {
cy.visit('/');
})
it('should be able to use n8n without user management and setup UM', () => {
describe('should skip owner setup', () => {
cy.skipSetup();
cy.url().should('include', workflowsPage.url);
});
it('should skip owner setup', () => {
cy.skipSetup();
});
describe('should be able to create workflows', () => {
workflowsPage.getters.newWorkflowButtonCard().should('be.visible');
workflowsPage.getters.newWorkflowButtonCard().click();
it('should be able to create workflows', () => {
workflowsPage.getters.newWorkflowButtonCard().should('be.visible');
workflowsPage.getters.newWorkflowButtonCard().click();
cy.createFixtureWorkflow('Test_workflow_1.json', `Test workflow`);
cy.createFixtureWorkflow('Test_workflow_1.json', `Test workflow`);
// reload page, ensure owner still has access
cy.reload();
// reload page, ensure owner still has access
cy.reload();
workflowPage.getters.workflowNameInput().should('contain.value', 'Test workflow');
});
workflowPage.getters.workflowNameInput().should('contain.value', 'Test workflow');
});
describe('should be able to add new credentials', () => {
cy.visit(credentialsPage.url);
it('should be able to add new credentials', () => {
cy.visit(credentialsPage.url);
credentialsPage.getters.emptyListCreateCredentialButton().click();
credentialsPage.getters.emptyListCreateCredentialButton().click();
credentialsModal.getters.newCredentialModal().should('be.visible');
credentialsModal.getters.newCredentialTypeSelect().should('be.visible');
credentialsModal.getters.newCredentialTypeOption('Notion API').click();
credentialsModal.getters.newCredentialModal().should('be.visible');
credentialsModal.getters.newCredentialTypeSelect().should('be.visible');
credentialsModal.getters.newCredentialTypeOption('Notion API').click();
credentialsModal.getters.newCredentialTypeButton().click();
credentialsModal.getters.newCredentialTypeButton().click();
credentialsModal.getters.connectionParameter('API Key').type('1234567890');
credentialsModal.getters.connectionParameter('API Key').type('1234567890');
credentialsModal.actions.setName('My awesome Notion account');
credentialsModal.actions.save();
credentialsModal.actions.setName('My awesome Notion account');
credentialsModal.actions.save();
credentialsModal.actions.close();
credentialsModal.actions.close();
credentialsModal.getters.newCredentialModal().should('not.exist');
credentialsModal.getters.editCredentialModal().should('not.exist');
credentialsModal.getters.newCredentialModal().should('not.exist');
credentialsModal.getters.editCredentialModal().should('not.exist');
credentialsPage.getters.credentialCards().should('have.length', 1);
});
credentialsPage.getters.credentialCards().should('have.length', 1);
});
describe('should be able to setup UM from settings', () => {
mainSidebar.getters.settings().should('be.visible');
mainSidebar.actions.goToSettings();
cy.url().should('include', settingsUsersPage.url);
it('should be able to setup UM from settings', () => {
mainSidebar.getters.settings().should('be.visible');
mainSidebar.actions.goToSettings();
cy.url().should('include', settingsUsersPage.url);
settingsUsersPage.actions.goToOwnerSetup();
settingsUsersPage.actions.goToOwnerSetup();
cy.url().should('include', signupPage.url);
});
cy.url().should('include', signupPage.url);
});
describe('should be able to setup instance and migrate workflows and credentials', () => {
cy.setup({ email, firstName, lastName, password });
it('should be able to setup instance and migrate workflows and credentials', () => {
cy.setup({ email, firstName, lastName, password });
messageBox.getters.content().should('contain.text', '1 existing workflow and 1 credential')
messageBox.getters.content().should('contain.text', '1 existing workflow and 1 credential')
messageBox.actions.confirm();
});
messageBox.actions.confirm();
cy.url().should('include', settingsUsersPage.url);
settingsSidebar.actions.back();
describe('should be redirected back to users page after setup', () => {
cy.url().should('include', settingsUsersPage.url);
// todo test users and that owner exist
});
cy.url().should('include', workflowsPage.url);
describe('can click back to workflows and have migrated workflow after setup', () => {
settingsSidebar.actions.back();
workflowsPage.getters.workflowCards().should('have.length', 1);
});
cy.url().should('include', workflowsPage.url);
it('can click back to main menu and have migrated credential after setup', () => {
cy.signin({ email, password });
cy.visit(workflowsPage.url);
workflowsPage.getters.workflowCards().should('have.length', 1);
});
mainSidebar.actions.goToCredentials();
describe('can click back to main menu and have migrated credential after setup', () => {
mainSidebar.actions.goToCredentials();
cy.url().should('include', credentialsPage.url);
cy.url().should('include', workflowsPage.url);
workflowsPage.getters.workflowCards().should('have.length', 1);
});
credentialsPage.getters.credentialCards().should('have.length', 1);
});
});