From 22c0a7d5d954606ffad18c7c301b3eb0d0591c4d Mon Sep 17 00:00:00 2001 From: Lorenz Hilpert Date: Thu, 24 Apr 2025 21:39:23 +0200 Subject: [PATCH] feat(e2e): add data attributes for improved test stability Add data-what and data-which attributes to key UI elements: - Add back button attributes to return details and process components - Add filter button attributes to the filter menu component - Add sort button attributes for both desktop and mobile views - Add result count element attributes for better selection - Add attributes to search result items for identification - Add attributes to loading spinners for state verification These attributes improve E2E test stability by providing reliable selectors that are not tied to styling or DOM structure changes. Ref: #5052 --- .../src/lib/return-details.component.html | 1 + .../lib/return-process-feature.component.html | 1 + .../return-search-result-item.component.html | 2 +- .../return-search-result.component.html | 21 ++++++++++++++++--- .../filter-menu-button.component.html | 1 + .../order-by/order-by-toolbar.component.html | 2 ++ 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/libs/oms/feature/return-details/src/lib/return-details.component.html b/libs/oms/feature/return-details/src/lib/return-details.component.html index 73992f154..7d2483dbe 100644 --- a/libs/oms/feature/return-details/src/lib/return-details.component.html +++ b/libs/oms/feature/return-details/src/lib/return-details.component.html @@ -17,6 +17,7 @@ size="small" class="px-[0.875rem] py-1 min-w-0 bg-white gap-1" (click)="location.back()" + data-what="back-button" > zurück diff --git a/libs/oms/feature/return-process/src/lib/return-process-feature.component.html b/libs/oms/feature/return-process/src/lib/return-process-feature.component.html index 8de4c17ed..53e0e5e71 100644 --- a/libs/oms/feature/return-process/src/lib/return-process-feature.component.html +++ b/libs/oms/feature/return-process/src/lib/return-process-feature.component.html @@ -1,4 +1,5 @@ @@ -31,10 +33,11 @@ } - + {{ entityHits() }} Einträge @@ -54,13 +57,20 @@ } } @if (renderPagingLoader()) {
- +
} @else if (renderPageTrigger()) {
@@ -68,7 +78,12 @@ } @else if (renderSearchLoader()) {
- +
} @else { diff --git a/libs/shared/filter/src/lib/order-by/order-by-toolbar.component.html b/libs/shared/filter/src/lib/order-by/order-by-toolbar.component.html index 01c1b9286..66b1324dd 100644 --- a/libs/shared/filter/src/lib/order-by/order-by-toolbar.component.html +++ b/libs/shared/filter/src/lib/order-by/order-by-toolbar.component.html @@ -7,6 +7,8 @@ uiTextButton type="button" (click)="toggleOrderBy(orderBy)" + data-what="sort-button" + [attr.data-which]="orderBy.by" >
{{ orderBy.label }}