Skip to content
Snippets Groups Projects
Commit 1d1f4533 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-1414 OZG-3106 add test for current user

parent f4631579
No related branches found
No related tags found
No related merge requests found
import { UserProfileE2EComponent } from "./user-profile.component.e2e";
export class CurrentUserProfileE2EComponent {
private readonly locatorRoot: string = 'current-user';
public getRoot() {
return cy.getTestElement(this.locatorRoot);
}
public getUserProfile(): UserProfileE2EComponent {
return new UserProfileE2EComponent(this.locatorRoot);
}
}
\ No newline at end of file
import { CurrentUserProfileE2EComponent } from "apps/goofy-e2e/src/components/user-profile/current-user-profile.component.e2e";
import { UserE2E } from "apps/goofy-e2e/src/model/user";
import { HeaderE2EComponent } from "apps/goofy-e2e/src/page-objects/header.po";
import { MainPage, waitForSpinnerToDisappear } from "apps/goofy-e2e/src/page-objects/main.po";
import { dropCollections } from "apps/goofy-e2e/src/support/cypress-helper";
import { exist, haveText } from "apps/goofy-e2e/src/support/cypress.util";
import { getUserManagerUserSabine, getUserSabine, initUsermanagerUsers, loginAsSabine } from "apps/goofy-e2e/src/support/user-util";
describe('Current User Profile', () => {
const mainPage: MainPage = new MainPage();
const header: HeaderE2EComponent = mainPage.getHeader();
const currentUserProfile: CurrentUserProfileE2EComponent = header.getCurrentUserProfile();
const userSabine: UserE2E = getUserSabine();
describe('for sabine', () => {
before(() => {
initUsermanagerUsers([getUserManagerUserSabine()]);
loginAsSabine();
waitForSpinnerToDisappear();
exist(header.getRoot());
})
after(() => {
dropCollections();
})
it('should show current user profile', () => {
exist(currentUserProfile.getRoot());
})
it('should show assigned icon', () => {
exist(currentUserProfile.getUserProfile().getIconContainer().getAssignedIcon());
})
it('should show initials', () => {
haveText(currentUserProfile.getUserProfile().getIconContainer().getAssignedIcon(), userSabine.initials)
})
})
})
\ No newline at end of file
import { CurrentUserProfileE2EComponent } from "../components/user-profile/current-user-profile.component.e2e";
import { UserSettingsE2EComponent } from "../components/user-settings/user-settings.component.e2e";
export class HeaderE2EComponent {
......@@ -5,13 +6,20 @@ export class HeaderE2EComponent {
private readonly locatorUserIconButton: string = 'user-icon-button';
private readonly locatorLogoutButton: string = 'logout-button';
private readonly locatorTitle: string = 'title';
private readonly locatorRoot: string = 'header';
private readonly userSettings: UserSettingsE2EComponent = new UserSettingsE2EComponent();
private readonly currentUserProfile: CurrentUserProfileE2EComponent = new CurrentUserProfileE2EComponent();
public getRoot() {
return cy.getTestElement(this.locatorRoot);
}
public getTitle() {
return cy.getTestElement(this.locatorTitle);
}
//TODO: in CurrentUserProfileE2EComponent verschieben
public logout(): void {
this.getUserIconButton().click();
this.getLogoutButton().click();
......@@ -24,8 +32,12 @@ export class HeaderE2EComponent {
private getLogoutButton() {
return cy.getTestElement(this.locatorLogoutButton);
}
//
public getUserSettings(): UserSettingsE2EComponent {
return this.userSettings;
}
public getCurrentUserProfile(): CurrentUserProfileE2EComponent {
return this.currentUserProfile;
}
}
\ No newline at end of file
<header>
<header data-test-id="header">
<div class="left">
<goofy-client-icon-button-with-spinner icon="menu" toolTip="Hauptmenü umschalten" (clickEmitter)="toggleMenuEvent.emit(!this.navigationCollapse)">
</goofy-client-icon-button-with-spinner>
......@@ -16,7 +16,7 @@
<div class="right">
<goofy-client-user-settings-container data-test-id="user-settings"></goofy-client-user-settings-container>
<goofy-client-user-profile-in-header-container></goofy-client-user-profile-in-header-container>
<goofy-client-user-profile-in-header-container data-test-id="current-user"></goofy-client-user-profile-in-header-container>
</div>
</header>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment