From 828e2fd312569567908be282a809676c1e87bbd6 Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Mon, 13 Apr 2026 12:44:06 +0200 Subject: [PATCH] Add test cases for internationalization, orders table rendering, and error handling: - **Internationalization:** Added end-to-end test `i18n.smoke.spec.ts` to validate Danish locale translations. Ensured normalization and removed unexpected strings in the `da` locale file. - **Orders Table:** Created unit test `orders-table.spec.js` to verify sparse data handling, invoice collection preloading, and rendering correctness. - **Error Handling:** Enhanced connectivity issue UI (`ConnectivityIssue.vue`) with `data-testid` attributes for improved testability. - **E2E Playwright Tests:** Updated and simplified e2e test utilities. Replaced `seedAuthenticatedState` with `primeMockSession` for session preparation. Added new tests for `/user/orders` and `/user/invoices` pages focusing on edge cases and maintaining structure consistency. --- .../displays/boxes/ExpandableContentBox.vue | 4 +- .../displays/buttons/EditableTableColumn.vue | 31 +- .../department/pos/orders/ordersTable.vue | 133 +++- .../UserDashboard/VehiclesPagination.vue | 6 +- .../InvoiceCollectionsTable.vue | 6 +- .../displays/user/vehicles/vehiclesTable.vue | 2 +- .../token/SessionUser/Objects/Orders.vue | 71 +- src/i18n/locales/da.json | 44 +- .../modules/Pos/DepartmentPosOrder.vue | 682 ++++++++++++------ .../daily-report/DepartmentWeather.vue | 27 +- .../userDashboard/profile/UserProfile.vue | 21 +- .../displays/Passkeys/PasskeyManagement.vue | 15 +- .../TwoFactor/TwoFactorManagement.vue | 12 +- src/views/errors/ConnectivityIssue.vue | 15 +- tests/e2e/admin-daily-report.spec.ts | 69 +- tests/e2e/admin-pos-orders.spec.ts | 246 +++++-- tests/e2e/adminModuleGoals.spec.ts | 13 +- tests/e2e/connectivityIssue.spec.ts | 81 ++- tests/e2e/edge-gateways.smoke.spec.js | 13 +- tests/e2e/edge-gateways.visual.spec.js | 25 +- ...ateways-desktop-chromium-desktop-win32.png | Bin 129819 -> 161168 bytes tests/e2e/i18n.smoke.spec.ts | 103 +++ tests/e2e/invoice-distribution.smoke.spec.js | 13 +- tests/e2e/pos-flow.spec.js | 52 +- tests/e2e/pos.visual.spec.js | 4 + ...d-items-desktop-chromium-desktop-win32.png | Bin 59487 -> 60341 bytes tests/e2e/self-serve-wash.spec.js | 22 +- tests/e2e/subuserProfileSecurity.spec.ts | 265 +------ .../e2e/superuser-customer-complaints.spec.ts | 13 +- .../e2e/superuser-system-status.smoke.spec.js | 13 +- tests/e2e/superuser-vehicles.smoke.spec.js | 13 +- tests/e2e/support/mobilePos.js | 32 +- tests/e2e/support/network.js | 81 ++- tests/e2e/twoFactorAuth.spec.ts | 287 +++++--- tests/e2e/user-orders.spec.ts | 122 ++++ tests/e2e/userAuth.spec.ts | 504 +++++++++---- tests/e2e/userInvoices.spec.ts | 35 +- tests/e2e/userProfileNotifications.spec.ts | 145 +--- tests/e2e/userProfileSecurity.spec.ts | 349 +-------- tests/e2e/userVehicles.spec.ts | 114 +-- tests/e2e/workfeed-config.smoke.spec.js | 13 +- tests/unit/department-weather.spec.js | 45 +- tests/unit/orders-table.spec.js | 385 ++++++++++ vite.config.js | 5 + 44 files changed, 2484 insertions(+), 1647 deletions(-) create mode 100644 tests/e2e/i18n.smoke.spec.ts create mode 100644 tests/e2e/user-orders.spec.ts create mode 100644 tests/unit/orders-table.spec.js diff --git a/src/components/displays/boxes/ExpandableContentBox.vue b/src/components/displays/boxes/ExpandableContentBox.vue index 453cc250..b06880ce 100644 --- a/src/components/displays/boxes/ExpandableContentBox.vue +++ b/src/components/displays/boxes/ExpandableContentBox.vue @@ -15,6 +15,7 @@ const toggleIsSelected = () => { \ No newline at end of file + diff --git a/src/components/displays/buttons/EditableTableColumn.vue b/src/components/displays/buttons/EditableTableColumn.vue index d410d1c8..590fa660 100644 --- a/src/components/displays/buttons/EditableTableColumn.vue +++ b/src/components/displays/buttons/EditableTableColumn.vue @@ -46,10 +46,28 @@ const props = defineProps({ default: () => { return false; } + }, + cellTestId: { + type: String, + default: () => { + return null; + } + }, + editButtonTestId: { + type: String, + default: () => { + return null; + } } }); +const canEdit = computed(() => Boolean(props.editFunction) && props.permissionCheckFunction()); + const clickEdit = () => { + if (!canEdit.value) { + return; + } + // If the virtual column is not set, then show the edit form if (!props.virtualColumn) { isLoading.value = true; @@ -83,7 +101,8 @@ const isTooltipMultiline = computed(() => Boolean(props.hoverHtml || hasHoverHtm + :class="{'is-clickable': canEdit}" + :data-testid="props.cellTestId || null">
@@ -97,8 +116,14 @@ const isTooltipMultiline = computed(() => Boolean(props.hoverHtml || hasHoverHtm
- -
@@ -70,4 +72,4 @@ loadList(); \ No newline at end of file + diff --git a/src/components/displays/user/invoicecollections/InvoiceCollectionsTable.vue b/src/components/displays/user/invoicecollections/InvoiceCollectionsTable.vue index 9b58923a..2d4573df 100644 --- a/src/components/displays/user/invoicecollections/InvoiceCollectionsTable.vue +++ b/src/components/displays/user/invoicecollections/InvoiceCollectionsTable.vue @@ -111,7 +111,7 @@ const dropdown_content = (object) => {