diff --git a/goofy-client/apps/goofy-e2e/src/components/user-profile/current-user-profile.component.e2e.ts b/goofy-client/apps/goofy-e2e/src/components/user-profile/current-user-profile.component.e2e.ts new file mode 100644 index 0000000000000000000000000000000000000000..acea5dec2e0d44927ffea6e5f83d2289010f8655 --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/components/user-profile/current-user-profile.component.e2e.ts @@ -0,0 +1,14 @@ +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 diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-current-user-icon.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-current-user-icon.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0d340d4fd447a77ae64b9ed69327d22376d8075 --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-current-user-icon.e2e-spec.ts @@ -0,0 +1,44 @@ +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 diff --git a/goofy-client/apps/goofy-e2e/src/page-objects/header.po.ts b/goofy-client/apps/goofy-e2e/src/page-objects/header.po.ts index b2527afde30ccc7d93e5b2680044509d7f24261d..869c93eec346ca5263731eb7f1e503d850422636 100644 --- a/goofy-client/apps/goofy-e2e/src/page-objects/header.po.ts +++ b/goofy-client/apps/goofy-e2e/src/page-objects/header.po.ts @@ -1,3 +1,4 @@ +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 diff --git a/goofy-client/libs/navigation/src/lib/header-container/header/header.component.html b/goofy-client/libs/navigation/src/lib/header-container/header/header.component.html index 44beeb8de47346ca9eec1d8d6b1a7fcaf239c197..d1a44c1627d422a791c7aa862ab0be58cd7e2e97 100644 --- a/goofy-client/libs/navigation/src/lib/header-container/header/header.component.html +++ b/goofy-client/libs/navigation/src/lib/header-container/header/header.component.html @@ -1,4 +1,4 @@ -<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>