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:
@@ -13,7 +13,8 @@ export class CredentialsModal extends BasePage {
|
||||
.find('.n8n-input input'),
|
||||
name: () => cy.getByTestId('credential-name'),
|
||||
nameInput: () => cy.getByTestId('credential-name').find('input'),
|
||||
saveButton: () => cy.getByTestId('credential-save-button'),
|
||||
// Saving of the credentials takes a while on the CI so we need to increase the timeout
|
||||
saveButton: () => cy.getByTestId('credential-save-button', { timeout: 5000 }),
|
||||
closeButton: () => this.getters.editCredentialModal().find('.el-dialog__close').first(),
|
||||
};
|
||||
actions = {
|
||||
@@ -21,12 +22,16 @@ export class CredentialsModal extends BasePage {
|
||||
this.getters.name().click();
|
||||
this.getters.nameInput().clear().type(name);
|
||||
},
|
||||
save: () => {
|
||||
save: (test = false) => {
|
||||
cy.intercept('POST', '/rest/credentials').as('saveCredential');
|
||||
cy.intercept('POST', '/rest/credentials/test').as('testCredential');
|
||||
if(test) {
|
||||
cy.intercept('POST', '/rest/credentials/test').as('testCredential');
|
||||
}
|
||||
|
||||
this.getters.saveButton().click();
|
||||
cy.wait('@saveCredential').wait('@testCredential');
|
||||
|
||||
cy.wait('@saveCredential');
|
||||
if(test) cy.wait('@testCredential')
|
||||
this.getters.saveButton().should('contain.text', 'Saved');
|
||||
},
|
||||
close: () => {
|
||||
|
||||
@@ -2,14 +2,24 @@ import { BasePage } from "../base";
|
||||
|
||||
export class MainSidebar extends BasePage {
|
||||
getters = {
|
||||
settings: () => cy.getByTestId('menu-item-settings', { timeout: 5000 }),
|
||||
templates: () => cy.getByTestId('menu-item-templates'),
|
||||
workflows: () => cy.getByTestId('menu-item-workflows'),
|
||||
credentials: () => cy.getByTestId('menu-item-credentials'),
|
||||
executions: () => cy.getByTestId('menu-item-executions'),
|
||||
menuItem: (menuLabel: string) => cy.getByTestId('menu-item').filter(`:contains("${menuLabel}")`),
|
||||
settings: () => this.getters.menuItem('Settings'),
|
||||
templates: () => this.getters.menuItem('Templates'),
|
||||
workflows: () => this.getters.menuItem('Workflows'),
|
||||
credentials: () => this.getters.menuItem('Credentials'),
|
||||
executions: () => this.getters.menuItem('Executions'),
|
||||
};
|
||||
actions = {
|
||||
goToSettings: () => this.getters.settings().click(),
|
||||
goToCredentials: () => this.getters.credentials().click(),
|
||||
goToSettings: () => {
|
||||
this.getters.settings().should('be.visible');
|
||||
// We must wait before ElementUI menu is done with its animations
|
||||
cy.get('[data-old-overflow]').should('not.exist');
|
||||
this.getters.settings().click();
|
||||
},
|
||||
goToCredentials: () => {
|
||||
this.getters.credentials().should('be.visible');
|
||||
cy.get('[data-old-overflow]').should('not.exist');
|
||||
this.getters.credentials().click()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export class WorkflowPage extends BasePage {
|
||||
workflowTags: () => cy.getByTestId('workflow-tags'),
|
||||
workflowTagsContainer: () => cy.getByTestId('workflow-tags-container'),
|
||||
workflowTagsInput: () => this.getters.workflowTagsContainer().then(($el) => cy.wrap($el.find('input').first())),
|
||||
workflowTagElements: () => this.getters.workflowTagsContainer().find('span.tags').children(),
|
||||
workflowTagElements: () => cy.get('[data-test-id="workflow-tags-container"] span.tags > span'),
|
||||
workflowTagsDropdown: () => cy.getByTestId('workflow-tags-dropdown'),
|
||||
newTagLink: () => cy.getByTestId('new-tag-link'),
|
||||
saveButton: () => cy.getByTestId('workflow-save-button'),
|
||||
@@ -22,7 +22,6 @@ export class WorkflowPage extends BasePage {
|
||||
cy.getByTestId(`parameter-input-${parameterName}`),
|
||||
ndvOutputPanel: () => cy.getByTestId('output-panel'),
|
||||
ndvRunDataPaneHeader: () => cy.getByTestId('run-data-pane-header'),
|
||||
|
||||
successToast: () => cy.get('.el-notification__title'),
|
||||
activatorSwitch: () => cy.getByTestId('workflow-activate-switch'),
|
||||
workflowMenu: () => cy.getByTestId('workflow-menu'),
|
||||
@@ -34,7 +33,6 @@ export class WorkflowPage extends BasePage {
|
||||
|
||||
nodeViewRoot: () => cy.getByTestId('node-view-root'),
|
||||
copyPasteInput: () => cy.getByTestId('hidden-copy-paste'),
|
||||
canvasNodes: () => cy.getByTestId('canvas-node'),
|
||||
};
|
||||
actions = {
|
||||
visit: () => {
|
||||
|
||||
Reference in New Issue
Block a user