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 index acea5dec2e0d44927ffea6e5f83d2289010f8655..f8576004728ef910895cefaa6807368eeb50756f 100644 --- 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 @@ -1,7 +1,10 @@ -import { UserProfileE2EComponent } from "./user-profile.component.e2e"; +import { UserProfileE2EComponent } from './user-profile.component.e2e'; export class CurrentUserProfileE2EComponent { + private readonly locatorUserIconButton: string = 'user-icon-button'; + private readonly locatorLogoutButton: string = 'logout-button'; + private readonly locatorRoot: string = 'current-user'; public getRoot() { @@ -11,4 +14,17 @@ export class CurrentUserProfileE2EComponent { public getUserProfile(): UserProfileE2EComponent { return new UserProfileE2EComponent(this.locatorRoot); } + + public logout(): void { + this.getUserIconButton().click(); + this.getLogoutButton().click(); + } + + private getUserIconButton() { + return cy.getTestElement(this.locatorUserIconButton); + } + + private getLogoutButton() { + return cy.getTestElement(this.locatorLogoutButton); + } } \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts index f3cca66e65178ddd12d7504fa2ffb8310649a7e3..0223e6b2cf65832b7027f9abf4d1b21c9fdff722 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts @@ -1,13 +1,16 @@ +import { App } from 'apps/goofy-e2e/src/model/app'; +import { getApp } from 'apps/goofy-e2e/src/support/app-util'; import { UserE2E } from '../../../model/user'; import { HeaderE2EComponent } from '../../../page-objects/header.po'; import { MainPage } from '../../../page-objects/main.po'; import { exist, haveText } from '../../../support/cypress.util'; import { getUserSabine } from '../../../support/user-util'; -const mainFixture = require('../../../fixtures/main.json'); -const user: UserE2E = getUserSabine(); - describe('Login and Logout', () => { + + const app: App = getApp(); + const user: UserE2E = getUserSabine(); + const mainPage: MainPage = new MainPage(); const header: HeaderE2EComponent = mainPage.getHeader(); @@ -24,11 +27,11 @@ describe('Login and Logout', () => { }) it('should display Goofy', () => { - haveText(header.getTitle(), mainFixture.title); + haveText(header.getTitle(), app.title); }) - it.skip('FIXME(OZG-2950 UserManager) should logout', () => { - header.logout(); + it('should logout', () => { + header.getCurrentUserProfile().logout(); exist(cy.get('#kc-login')); }) diff --git a/goofy-client/apps/goofy-e2e/src/model/app.ts b/goofy-client/apps/goofy-e2e/src/model/app.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e0f1e90ea345f6b76080b78940354133b09f16e --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/model/app.ts @@ -0,0 +1,3 @@ +export class App { + title: string +} \ 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 869c93eec346ca5263731eb7f1e503d850422636..96a927b8f6022e8610dc9bd0c885b1fc4f0ab839 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 @@ -3,8 +3,6 @@ import { UserSettingsE2EComponent } from "../components/user-settings/user-setti 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'; @@ -19,20 +17,6 @@ export class HeaderE2EComponent { return cy.getTestElement(this.locatorTitle); } - //TODO: in CurrentUserProfileE2EComponent verschieben - public logout(): void { - this.getUserIconButton().click(); - this.getLogoutButton().click(); - } - - private getUserIconButton() { - return cy.getTestElement(this.locatorUserIconButton); - } - - private getLogoutButton() { - return cy.getTestElement(this.locatorLogoutButton); - } - // public getUserSettings(): UserSettingsE2EComponent { return this.userSettings; } diff --git a/goofy-client/apps/goofy-e2e/src/support/app-util.ts b/goofy-client/apps/goofy-e2e/src/support/app-util.ts new file mode 100644 index 0000000000000000000000000000000000000000..98758452698ecf8a460ebc892b31a3d6da4dc427 --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/support/app-util.ts @@ -0,0 +1,8 @@ +import { App } from '../model/app'; + +//TODO main.json in app.json umbenennen +const appFixture: App = require('../fixtures/main.json'); + +export function getApp(): App { + return appFixture; +} \ No newline at end of file