Skip to content

Commit

Permalink
test: Add test for login-logout
Browse files Browse the repository at this point in the history
  • Loading branch information
cstuncsik committed May 23, 2024
1 parent 33079d9 commit 1500d66
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
21 changes: 21 additions & 0 deletions cypress/e2e/18-user-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ describe('User Management', { disableAutoLogin: true }, () => {
cy.enableFeature('sharing');
});

it.only('should login and logout', () => {
cy.visit('/');
cy.get('input[name="email"]').type(INSTANCE_OWNER.email);
cy.get('input[name="password"]').type(INSTANCE_OWNER.password);
cy.getByTestId('form-submit-button').click();
mainSidebar.getters.logo().should('be.visible');
mainSidebar.actions.goToSettings();
settingsSidebar.getters.users().should('be.visible');

mainSidebar.actions.closeSettings();
mainSidebar.actions.openUserMenu();
cy.getByTestId('user-menu-item-logout').click();

cy.get('input[name="email"]').type(INSTANCE_MEMBERS[0].email);
cy.get('input[name="password"]').type(INSTANCE_MEMBERS[0].password);
cy.getByTestId('form-submit-button').click();
mainSidebar.getters.logo().should('be.visible');
mainSidebar.actions.goToSettings();
cy.getByTestId('menu-item').filter('#settings-users').should('not.exist');
});

it('should prevent non-owners to access UM settings', () => {
usersSettingsPage.actions.loginAndVisit(
INSTANCE_MEMBERS[0].email,
Expand Down
11 changes: 10 additions & 1 deletion cypress/e2e/39-projects.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const credentialsModal = new CredentialsModal();
const executionsTab = new WorkflowExecutionsTab();

describe('Projects', () => {
beforeEach(() => {
before(() => {
cy.resetDatabase();
cy.enableFeature('sharing');
cy.enableFeature('advancedPermissions');
Expand Down Expand Up @@ -219,4 +219,13 @@ describe('Projects', () => {
menuItems.filter('[class*=active_]').should('have.length', 1);
menuItems.filter(':contains("Development")[class*=active_]').should('exist');
});

it('should not show project add button and projects to a member if not invited to any project', () => {
cy.signout();
cy.signin(INSTANCE_MEMBERS[1]);
cy.visit(workflowsPage.url);

projects.getAddProjectButton().should('not.exist');
projects.getMenuItems().should('not.exist');
});
});
5 changes: 3 additions & 2 deletions cypress/pages/sidebar/main-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class MainSidebar extends BasePage {
getters = {
menuItem: (id: string) => cy.getByTestId('menu-item').get('#' + id),
settings: () => this.getters.menuItem('settings'),
settingsBack: () => cy.getByTestId('settings-back'),
templates: () => this.getters.menuItem('templates'),
workflows: () => this.getters.menuItem('workflows'),
credentials: () => this.getters.menuItem('credentials'),
Expand All @@ -30,8 +31,8 @@ export class MainSidebar extends BasePage {
openUserMenu: () => {
this.getters.userMenu().click();
},
openUserMenu: () => {
this.getters.userMenu().click();
closeSettings: () => {
this.getters.settingsBack().click();
},
signout: () => {
const workflowsPage = new WorkflowsPage();
Expand Down

0 comments on commit 1500d66

Please sign in to comment.