From 2863aa5f50cb54a4644322b2cdf0566d1f627c02 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Fri, 8 Apr 2022 11:06:01 +0200
Subject: [PATCH] fix buildInfo; fix darkmode for buildInfo; add e2e Test for
 buildInfo

---
 .../buildinfo/buildinfo.e2e.component.ts      | 12 +++++++
 .../main-tests/app/buildinfo.e2e-spec.ts      | 34 +++++++++++++++++++
 .../{ => app}/login-logout.e2e-spec.ts        | 10 +++---
 .../goofy-e2e/src/page-objects/main.po.ts     |  6 ++++
 .../lib/build-info/build-info.component.html  |  2 +-
 .../lib/build-info/build-info.component.scss  |  8 +++--
 .../navigation/src/lib/navigation.module.ts   |  1 +
 ...-list-in-vorgang-list-container.theme.scss |  4 +--
 8 files changed, 67 insertions(+), 10 deletions(-)
 create mode 100644 goofy-client/apps/goofy-e2e/src/components/buildinfo/buildinfo.e2e.component.ts
 create mode 100644 goofy-client/apps/goofy-e2e/src/integration/main-tests/app/buildinfo.e2e-spec.ts
 rename goofy-client/apps/goofy-e2e/src/integration/main-tests/{ => app}/login-logout.e2e-spec.ts (68%)

diff --git a/goofy-client/apps/goofy-e2e/src/components/buildinfo/buildinfo.e2e.component.ts b/goofy-client/apps/goofy-e2e/src/components/buildinfo/buildinfo.e2e.component.ts
new file mode 100644
index 0000000000..0eb2a1cc61
--- /dev/null
+++ b/goofy-client/apps/goofy-e2e/src/components/buildinfo/buildinfo.e2e.component.ts
@@ -0,0 +1,12 @@
+export class BuildInfoE2EComponent {
+	private readonly locatorVersion: string = 'version';
+	private readonly locatorBuildTime: string = 'build-time';
+
+	getVersion() {
+		return cy.getTestElement(this.locatorVersion);
+	}
+
+	getBuildTime() {
+		return cy.getTestElement(this.locatorBuildTime);
+	}
+}
\ No newline at end of file
diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/buildinfo.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/buildinfo.e2e-spec.ts
new file mode 100644
index 0000000000..5eb8d73a7a
--- /dev/null
+++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/buildinfo.e2e-spec.ts
@@ -0,0 +1,34 @@
+import { BuildInfoE2EComponent } from "apps/goofy-e2e/src/components/buildinfo/buildinfo.e2e.component";
+import { VorgangListE2EComponent } from "apps/goofy-e2e/src/components/vorgang/vorgang-list.e2e.component";
+import { MainPage, waitForSpinnerToDisappear } from "apps/goofy-e2e/src/page-objects/main.po";
+import { dropCollections } from "apps/goofy-e2e/src/support/cypress-helper";
+import { exist } from "apps/goofy-e2e/src/support/cypress.util";
+import { loginAsSabine } from "apps/goofy-e2e/src/support/user-util";
+
+describe('Buildinfo', () => {
+	const mainPage: MainPage = new MainPage();
+	const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList();
+	const buildInfo: BuildInfoE2EComponent = mainPage.getBuildInfo();
+
+	before(() => {
+		loginAsSabine();
+
+		exist(vorgangList.getRoot());
+		waitForSpinnerToDisappear();
+	})
+
+	after(() => {
+		dropCollections();
+	})
+
+	describe('buildinfo', () => {
+
+		it('should show version', () => {
+			exist(buildInfo.getVersion());
+		})
+
+		it('should show buildTime', () => {
+			exist(buildInfo.getBuildTime());
+		})
+	})
+})
\ No newline at end of file
diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts
similarity index 68%
rename from goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts
rename to goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts
index 4280149686..af8d208a95 100644
--- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts
+++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/app/login-logout.e2e-spec.ts
@@ -1,8 +1,8 @@
-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';
+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();
diff --git a/goofy-client/apps/goofy-e2e/src/page-objects/main.po.ts b/goofy-client/apps/goofy-e2e/src/page-objects/main.po.ts
index 962687e0da..7193ae8b7e 100644
--- a/goofy-client/apps/goofy-e2e/src/page-objects/main.po.ts
+++ b/goofy-client/apps/goofy-e2e/src/page-objects/main.po.ts
@@ -1,3 +1,4 @@
+import { BuildInfoE2EComponent } from '../components/buildinfo/buildinfo.e2e.component';
 import { NavigationE2EComponent } from '../components/navigation/navigation.e2e.component';
 import { ConnectionTimeoutRetryDialogE2EComponent, ConnectionTimeoutRetryFailDialogE2EComponent } from '../components/ui/connection-timeout-retry-dialog.e2e.component';
 import { InternalServerErrorDialogE2EComponent } from '../components/ui/internal-server-error-diaog.e2e.component';
@@ -7,6 +8,7 @@ import { VorgangSearchE2EComponent } from '../components/vorgang/vorgang-search.
 import { HeaderE2EComponent } from './header.po';
 
 export class MainPage {
+	private readonly buildInfo: BuildInfoE2EComponent = new BuildInfoE2EComponent();
 	private readonly header: HeaderE2EComponent = new HeaderE2EComponent();
 	private readonly navigation: NavigationE2EComponent = new NavigationE2EComponent();
 	private readonly snackBar: SnackBarE2EComponent = new SnackBarE2EComponent();
@@ -16,6 +18,10 @@ export class MainPage {
 	private readonly connectionTimeoutRetryDialog: ConnectionTimeoutRetryDialogE2EComponent = new ConnectionTimeoutRetryDialogE2EComponent();
 	private readonly connectionTimeoutRetryFailDialog: ConnectionTimeoutRetryFailDialogE2EComponent = new ConnectionTimeoutRetryFailDialogE2EComponent();
 
+	public getBuildInfo(): BuildInfoE2EComponent {
+		return this.buildInfo;
+	}
+
 	public getHeader(): HeaderE2EComponent {
 		return this.header;
 	}
diff --git a/goofy-client/libs/navigation/src/lib/build-info/build-info.component.html b/goofy-client/libs/navigation/src/lib/build-info/build-info.component.html
index f4d9c6b132..3e99a30cf8 100644
--- a/goofy-client/libs/navigation/src/lib/build-info/build-info.component.html
+++ b/goofy-client/libs/navigation/src/lib/build-info/build-info.component.html
@@ -1 +1 @@
-<p>Version: {{ apiRoot.version }} | BuildTime: {{ apiRoot.buildTime | formatDateWithTimePipe }}</p>
\ No newline at end of file
+<p data-test-id="version"><span>Version: {{ apiRoot.version }}</span> | <span data-test-id="build-time">BuildTime: {{ apiRoot.buildTime | formatDateWithTimePipe }}</span></p>
\ No newline at end of file
diff --git a/goofy-client/libs/navigation/src/lib/build-info/build-info.component.scss b/goofy-client/libs/navigation/src/lib/build-info/build-info.component.scss
index 0c892bfb79..f41aff49a9 100644
--- a/goofy-client/libs/navigation/src/lib/build-info/build-info.component.scss
+++ b/goofy-client/libs/navigation/src/lib/build-info/build-info.component.scss
@@ -1,4 +1,4 @@
-@import "variables";
+@import 'variables';
 
 :host {
 	position: absolute;
@@ -11,8 +11,12 @@
 	transform-origin: right bottom;
 }
 
+:host-context(.dark) {
+	color: #ccc;
+}
+
 p {
 	margin: 0;
 	line-height: 1;
 	white-space: nowrap;
-}
+}
\ No newline at end of file
diff --git a/goofy-client/libs/navigation/src/lib/navigation.module.ts b/goofy-client/libs/navigation/src/lib/navigation.module.ts
index 7ed07f6933..78ac06b690 100644
--- a/goofy-client/libs/navigation/src/lib/navigation.module.ts
+++ b/goofy-client/libs/navigation/src/lib/navigation.module.ts
@@ -32,6 +32,7 @@ import { NavigationComponent } from './navigation/navigation.component';
 		UserProfileModule
 	],
 	exports: [
+		BuildInfoComponent,
 		NavigationContainerComponent,
 		HeaderContainerComponent
 	]
diff --git a/goofy-client/libs/wiedervorlage/src/lib/wiedervorlage-list-in-vorgang-list-container/_wiedervorlage-list-in-vorgang-list-container.theme.scss b/goofy-client/libs/wiedervorlage/src/lib/wiedervorlage-list-in-vorgang-list-container/_wiedervorlage-list-in-vorgang-list-container.theme.scss
index 0d7896254b..4df16c936e 100644
--- a/goofy-client/libs/wiedervorlage/src/lib/wiedervorlage-list-in-vorgang-list-container/_wiedervorlage-list-in-vorgang-list-container.theme.scss
+++ b/goofy-client/libs/wiedervorlage/src/lib/wiedervorlage-list-in-vorgang-list-container/_wiedervorlage-list-in-vorgang-list-container.theme.scss
@@ -1,4 +1,4 @@
-@import "variables";
+@import 'variables';
 
 goofy-client-wiedervorlage-list-in-vorgang-list-container .foreground {
 	background-color: $background;
@@ -6,4 +6,4 @@ goofy-client-wiedervorlage-list-in-vorgang-list-container .foreground {
 
 body.dark goofy-client-wiedervorlage-list-in-vorgang-list-container .foreground {
 	background-color: $dark-background;
-}
+}
\ No newline at end of file
-- 
GitLab