n8n/cypress/pages/sidebar/main-sidebar.ts
कारतोफ्फेलस्क्रिप्ट™ 0e071724ee
ci: Refactor e2e tests to delete boilerplate code (no-changelog) (#6524)
2023-06-23 00:38:12 +02:00

31 lines
1 KiB
TypeScript

import { BasePage } from '../base';
export class MainSidebar extends BasePage {
getters = {
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'),
userMenu: () => cy.getByTestId('main-sidebar-user-menu'),
};
actions = {
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();
},
openUserMenu: () => {
this.getters.userMenu().find('[role="button"]').last().click();
},
};
}