From 4499b9dcacf26a7ed1f69b6e3aab87cd06d3883f Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 9 Feb 2023 13:01:13 +0100
Subject: [PATCH] OZG-3365 OZG-3399 E2E test for Alfa logo

---
 .../integration/main-tests/app/login-logout.e2e-spec.ts  | 9 +++++----
 .../wiedervorlage-authorize-by-role.e2e-spec.ts          | 8 ++++----
 .../apps/goofy-e2e/src/page-objects/header.po.ts         | 6 +++---
 .../header/header-logo/header-logo.component.html        | 2 +-
 4 files changed, 13 insertions(+), 12 deletions(-)

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 ec84715d89..379ffa34b0 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
@@ -25,8 +25,8 @@ 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 { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po';
+import { exist } from '../../../support/cypress.util';
 import { getUserSabine } from '../../../support/user-util';
 
 describe('Login and Logout', () => {
@@ -49,8 +49,9 @@ describe('Login and Logout', () => {
 			.get('#kc-login').click();
 	})
 
-	it('should display Goofy', () => {
-		haveText(header.getTitle(), app.title);
+	it('should display Alfa logo', () => {
+		waitForSpinnerToDisappear();
+		exist(header.getLogo());
 	})
 
 	it('should logout', () => {
diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/wiedervorlage/wiedervorlage-authorize-by-role.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/wiedervorlage/wiedervorlage-authorize-by-role.e2e-spec.ts
index 7016e88653..d00c8922b9 100644
--- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/wiedervorlage/wiedervorlage-authorize-by-role.e2e-spec.ts
+++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/wiedervorlage/wiedervorlage-authorize-by-role.e2e-spec.ts
@@ -74,7 +74,7 @@ describe('Wiedervorlage should be authorized by role', () => {
 			visitUrl(vorgangInStatusNeuUrl);
 			waitForSpinnerToDisappear();
 
-			exist(mainPage.getHeader().getTitle());
+			exist(mainPage.getHeader().getLogo());
 			notExist(wiedervorlagePage.getRoot());
 		})
 
@@ -84,7 +84,7 @@ describe('Wiedervorlage should be authorized by role', () => {
 				visitUrl(vorgangInStatusInBearbeitungUrl);
 				waitForSpinnerToDisappear();
 
-				exist(mainPage.getHeader().getTitle());
+				exist(mainPage.getHeader().getLogo());
 				contains(snackbar.getMessage(), MessagesE2E.HTTP_STATUS_FORBIDDEN);
 				notExist(wiedervorlagePage.getRoot());
 			})
@@ -93,7 +93,7 @@ describe('Wiedervorlage should be authorized by role', () => {
 				visitUrl(vorgangInStatusAbgeschlossenUrl);
 				waitForSpinnerToDisappear();
 
-				exist(mainPage.getHeader().getTitle());
+				exist(mainPage.getHeader().getLogo());
 				notExist(wiedervorlagePage.getRoot());
 				notExist(wiedervorlageSubnavigation.getRoot());
 				contains(snackbar.getMessage(), MessagesE2E.HTTP_STATUS_FORBIDDEN);
@@ -103,7 +103,7 @@ describe('Wiedervorlage should be authorized by role', () => {
 				visitUrl(vorgangInStatusBeschiedenUrl);
 				waitForSpinnerToDisappear();
 
-				exist(mainPage.getHeader().getTitle());
+				exist(mainPage.getHeader().getLogo());
 				notExist(wiedervorlagePage.getRoot());
 				notExist(wiedervorlageSubnavigation.getRoot());
 				contains(snackbar.getMessage(), MessagesE2E.HTTP_STATUS_FORBIDDEN);
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 497a51e0e0..d70f7c5031 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
@@ -26,7 +26,7 @@ import { UserSettingsE2EComponent } from "../components/user-settings/user-setti
 
 export class HeaderE2EComponent {
 
-	private readonly locatorTitle: string = 'title';
+	private readonly locatorLogo: string = 'alfa-logo';
 	private readonly locatorRoot: string = 'header';
 	private readonly locatorNavigationToggle: string = 'navigation-toggle';
 
@@ -37,8 +37,8 @@ export class HeaderE2EComponent {
 		return cy.getTestElement(this.locatorRoot);
 	}
 
-	public getTitle() {
-		return cy.getTestElement(this.locatorTitle);
+	public getLogo() {
+		return cy.getTestElement(this.locatorLogo);
 	}
 
 	public getUserSettings(): UserSettingsE2EComponent {
diff --git a/goofy-client/libs/navigation/src/lib/header-container/header/header-logo/header-logo.component.html b/goofy-client/libs/navigation/src/lib/header-container/header/header-logo/header-logo.component.html
index 11acab1e06..8597db3469 100644
--- a/goofy-client/libs/navigation/src/lib/header-container/header/header-logo/header-logo.component.html
+++ b/goofy-client/libs/navigation/src/lib/header-container/header/header-logo/header-logo.component.html
@@ -1,3 +1,3 @@
 <a routerLink="/" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">
-	<img src="/assets/img/logo.svg" alt="Alfa Logo"/>
+	<img src="/assets/img/logo.svg" alt="Alfa Logo" data-test-id="alfa-logo" />
 </a>
-- 
GitLab