2022-12-15 07:39:59 -08:00
|
|
|
import { BasePage } from '../base';
|
2023-08-17 04:57:40 -07:00
|
|
|
import { WorkflowsPage } from '../workflows';
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2023-08-23 19:59:16 -07:00
|
|
|
const workflowsPage = new WorkflowsPage();
|
|
|
|
|
2022-11-24 14:22:09 -08:00
|
|
|
export class MainSidebar extends BasePage {
|
|
|
|
getters = {
|
2022-12-15 07:39:59 -08:00
|
|
|
menuItem: (menuLabel: string) =>
|
|
|
|
cy.getByTestId('menu-item').filter(`:contains("${menuLabel}")`),
|
2022-12-07 09:16:38 -08:00
|
|
|
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'),
|
2023-11-17 05:44:47 -08:00
|
|
|
adminPanel: () => this.getters.menuItem('Admin Panel'),
|
2023-08-17 04:57:40 -07:00
|
|
|
userMenu: () => cy.get('div[class="action-dropdown-container"]'),
|
2023-11-01 05:33:36 -07:00
|
|
|
logo: () => cy.getByTestId('n8n-logo'),
|
2022-11-24 14:22:09 -08:00
|
|
|
};
|
|
|
|
actions = {
|
2022-12-07 09:16:38 -08:00
|
|
|
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');
|
2022-12-15 07:39:59 -08:00
|
|
|
this.getters.credentials().click();
|
2022-12-07 09:16:38 -08:00
|
|
|
},
|
2023-02-08 12:41:35 -08:00
|
|
|
openUserMenu: () => {
|
2023-08-23 19:59:16 -07:00
|
|
|
this.getters.userMenu().click();
|
2023-02-08 12:41:35 -08:00
|
|
|
},
|
2023-08-17 04:57:40 -07:00
|
|
|
openUserMenu: () => {
|
|
|
|
this.getters.userMenu().click();
|
|
|
|
},
|
|
|
|
signout: () => {
|
|
|
|
const workflowsPage = new WorkflowsPage();
|
|
|
|
cy.visit(workflowsPage.url);
|
|
|
|
this.actions.openUserMenu();
|
|
|
|
cy.getByTestId('user-menu-item-logout').click();
|
|
|
|
cy.wrap(Cypress.session.clearAllSavedSessions());
|
|
|
|
},
|
2022-11-24 14:22:09 -08:00
|
|
|
};
|
|
|
|
}
|