From cc0607a6c6c90f0519b63a41c7c82c73a4b48f7d Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Tue, 18 Jun 2024 15:41:49 +0200
Subject: [PATCH] OZG-5243 add method to get historie entry by index

---
 .../vorgang/vorgang-formular.e2e.component.ts |  9 ++++++++-
 .../vorgang-bescheid-historie.cy.ts           | 20 ++++++++-----------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-formular.e2e.component.ts b/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-formular.e2e.component.ts
index 262f8449c3..7cbf56b323 100644
--- a/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-formular.e2e.component.ts
+++ b/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-formular.e2e.component.ts
@@ -23,7 +23,10 @@
  */
 import { getElement, getTestElement } from '../../support/cypress-helper';
 import { ExpansionPanelE2Eomponent } from '../ui/expansion-panel.e2e.component';
-import { VorgangFormularDatenHistorieE2EComponent } from './vorgang.formular-daten.historie.e2e.component';
+import {
+  VorgangFormularDatenHistorieE2EComponent,
+  VorgangFormularDatenHistorieItemE2EComponent,
+} from './vorgang.formular-daten.historie.e2e.component';
 
 export class VorgangFormularDatenE2EComponent {
   private readonly locatorRoot: string = 'formulardaten-panel';
@@ -85,4 +88,8 @@ export class VorgangFormularDatenE2EComponent {
   public getHistorieContainer(): VorgangFormularDatenHistorieE2EComponent {
     return this.historieContainer;
   }
+
+  public getHistorieItemByIndex(index: number): VorgangFormularDatenHistorieItemE2EComponent {
+    return this.getHistorieContainer().getListItemByIndex(index);
+  }
 }
diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-historie.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-historie.cy.ts
index 40a3734230..c0b57b82ea 100644
--- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-historie.cy.ts
+++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-historie.cy.ts
@@ -102,18 +102,16 @@ describe('Bescheid History', () => {
         waitForSpinnerToDisappear();
         vorgangDatenFormular.getHistorieTab().click();
 
-        const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular
-          .getHistorieContainer()
-          .getListItemByIndex(0);
+        const historieItem: VorgangFormularDatenHistorieItemE2EComponent =
+          vorgangDatenFormular.getHistorieItemByIndex(0);
 
         contains(historieItem.getHeadline(), HistorieHeadlineE2E.BESCHEID_ERSTELLT);
         contains(historieItem.getUser(), userName);
       });
 
       it('should show detailed info after click on arrow', () => {
-        const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular
-          .getHistorieContainer()
-          .getListItemByIndex(0);
+        const historieItem: VorgangFormularDatenHistorieItemE2EComponent =
+          vorgangDatenFormular.getHistorieItemByIndex(0);
         const bescheidItem: BescheidHistorieItemE2EComponent = historieItem.getBescheid();
         historieItem.getExpandButton().click();
 
@@ -139,9 +137,8 @@ describe('Bescheid History', () => {
         waitForSpinnerToDisappear();
         vorgangDatenFormular.getHistorieTab().click();
 
-        const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular
-          .getHistorieContainer()
-          .getListItemByIndex(0);
+        const historieItem: VorgangFormularDatenHistorieItemE2EComponent =
+          vorgangDatenFormular.getHistorieItemByIndex(0);
         const bescheidItem: BescheidHistorieItemE2EComponent = historieItem.getBescheid();
         historieItem.getExpandButton().click();
 
@@ -186,9 +183,8 @@ describe('Bescheid History', () => {
       });
 
       it('should show history entries for sent Bescheid and message', () => {
-        const historieItemSent: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular
-          .getHistorieContainer()
-          .getListItemByIndex(1);
+        const historieItemSent: VorgangFormularDatenHistorieItemE2EComponent =
+          vorgangDatenFormular.getHistorieItemByIndex(1);
         contains(historieItemSent.getHeadline(), HistorieHeadlineE2E.BESCHEID_VERSCHICKT);
         contains(historieItemSent.getUser(), userName);
 
-- 
GitLab