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
|
|
|
|
|
|
|
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-08-17 04:57:40 -07:00
|
|
|
userMenu: () => cy.get('div[class="action-dropdown-container"]'),
|
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: () => {
|
|
|
|
this.getters.userMenu().find('[role="button"]').last().click();
|
|
|
|
},
|
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
|
|
|
};
|
|
|
|
}
|