n8n/cypress/pages/sidebar/main-sidebar.ts
Ricardo Espinoza d3f01270c7
fix(editor): Trial banner does not disappear after sign out (no-changelog) (#6930)
to test in staging use version
`PR-6930-ado-990-trial-banner-does-not-disappear-after-sign-out`

<img width="875" alt="image"
src="https://github.com/n8n-io/n8n/assets/16496553/dfffe60f-bec3-4c48-bd9c-5990c68afa52">
2023-08-17 07:57:40 -04:00

42 lines
1.4 KiB
TypeScript

import { BasePage } from '../base';
import { WorkflowsPage } from '../workflows';
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.get('div[class="action-dropdown-container"]'),
};
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();
},
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());
},
};
}