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 = {
|
2024-05-17 01:53:15 -07:00
|
|
|
menuItem: (id: string) => cy.getByTestId('menu-item').get('#' + id),
|
|
|
|
settings: () => this.getters.menuItem('settings'),
|
2024-05-23 08:07:40 -07:00
|
|
|
settingsBack: () => cy.getByTestId('settings-back'),
|
2024-05-17 01:53:15 -07:00
|
|
|
templates: () => this.getters.menuItem('templates'),
|
|
|
|
workflows: () => this.getters.menuItem('workflows'),
|
|
|
|
credentials: () => this.getters.menuItem('credentials'),
|
|
|
|
executions: () => this.getters.menuItem('executions'),
|
|
|
|
adminPanel: () => this.getters.menuItem('cloud-admin'),
|
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
|
|
|
},
|
2024-05-23 08:07:40 -07:00
|
|
|
closeSettings: () => {
|
|
|
|
this.getters.settingsBack().click();
|
2023-08-17 04:57:40 -07:00
|
|
|
},
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|