From 60742bf9470d5614a13402111a1911e412f7fec1 Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Thu, 19 Mar 2026 12:46:47 +0100 Subject: [PATCH] Refactor and migrate Playwright E2E tests: - Remove `playwright.config.js` to clean up configuration. - Add new E2E test suites (`admin-pos-orders`, `admin-module-goals`, `admin-module-pos-mobile-order-flow`) to structure Admin module tests. - Introduce reusable authentication and data seeding utilities in `fixtures` for streamlined test flows and maintainability. --- package-lock.json | 27 + package.json | 1 + playwright.config.js => playwright.config.ts | 16 +- playwright.local.config.ts | 0 .../PosDepartmentStepMobileAttachment.vue | 79 ++- .../PosDepartmentStepMobileButtonNextStep.vue | 96 ++-- tests/e2e/admin-pos-orders.spec.ts | 23 + tests/e2e/adminModuleGoals.spec.ts | 317 +++++++++++ .../e2e/adminModulePosMobileOrderFlow.spec.ts | 493 ++++++++++++++++++ tests/e2e/connectivityIssue.spec.ts | 34 ++ tests/e2e/example.spec.ts | 18 + tests/e2e/fixtures/authHelpers.ts | 240 +++++++++ tests/e2e/fixtures/index.ts | 13 + tests/e2e/fixtures/otp.ts | 19 + tests/e2e/fixtures/testData.ts | 111 ++++ tests/e2e/passkeyAuth.spec.ts | 170 ++++++ tests/e2e/pos-flow.spec.js | 3 +- tests/e2e/subuserProfileContact.spec.ts | 135 +++++ tests/e2e/subuserProfileGrant.spec.ts | 35 ++ tests/e2e/subuserProfileInformation.spec.ts | 141 +++++ tests/e2e/subuserProfileSecurity.spec.ts | 203 ++++++++ tests/e2e/subuserProfileUsername.spec.ts | 37 ++ tests/e2e/twoFactorAuth.spec.ts | 147 ++++++ tests/e2e/userAuth.spec.ts | 172 ++++++ tests/e2e/userBookWash.spec.ts | 81 +++ tests/e2e/userBookings.spec.ts | 80 +++ tests/e2e/userHome.spec.ts | 50 ++ tests/e2e/userInvoices.spec.ts | 42 ++ tests/e2e/userMyWashStart.spec.ts | 55 ++ tests/e2e/userProfileInvoicing.spec.ts | 52 ++ tests/e2e/userProfileNotifications.spec.ts | 139 +++++ tests/e2e/userProfileSecurity.spec.ts | 313 +++++++++++ tests/e2e/userProfileVisibility.spec.ts | 34 ++ tests/e2e/userVehicles.spec.ts | 107 ++++ 34 files changed, 3408 insertions(+), 75 deletions(-) rename playwright.config.js => playwright.config.ts (77%) create mode 100644 playwright.local.config.ts create mode 100644 tests/e2e/admin-pos-orders.spec.ts create mode 100644 tests/e2e/adminModuleGoals.spec.ts create mode 100644 tests/e2e/adminModulePosMobileOrderFlow.spec.ts create mode 100644 tests/e2e/connectivityIssue.spec.ts create mode 100644 tests/e2e/example.spec.ts create mode 100644 tests/e2e/fixtures/authHelpers.ts create mode 100644 tests/e2e/fixtures/index.ts create mode 100644 tests/e2e/fixtures/otp.ts create mode 100644 tests/e2e/fixtures/testData.ts create mode 100644 tests/e2e/passkeyAuth.spec.ts create mode 100644 tests/e2e/subuserProfileContact.spec.ts create mode 100644 tests/e2e/subuserProfileGrant.spec.ts create mode 100644 tests/e2e/subuserProfileInformation.spec.ts create mode 100644 tests/e2e/subuserProfileSecurity.spec.ts create mode 100644 tests/e2e/subuserProfileUsername.spec.ts create mode 100644 tests/e2e/twoFactorAuth.spec.ts create mode 100644 tests/e2e/userAuth.spec.ts create mode 100644 tests/e2e/userBookWash.spec.ts create mode 100644 tests/e2e/userBookings.spec.ts create mode 100644 tests/e2e/userHome.spec.ts create mode 100644 tests/e2e/userInvoices.spec.ts create mode 100644 tests/e2e/userMyWashStart.spec.ts create mode 100644 tests/e2e/userProfileInvoicing.spec.ts create mode 100644 tests/e2e/userProfileNotifications.spec.ts create mode 100644 tests/e2e/userProfileSecurity.spec.ts create mode 100644 tests/e2e/userProfileVisibility.spec.ts create mode 100644 tests/e2e/userVehicles.spec.ts diff --git a/package-lock.json b/package-lock.json index 376d12aa..2e4fe2b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,6 +65,7 @@ "@vitejs/plugin-vue-jsx": "^4.1.2", "@vue/test-utils": "^2.4.6", "jsdom": "^29.0.0", + "otpauth": "^9.5.0", "sass-embedded": "^1.81.0", "vite": "7.1.11", "vite-plugin-pwa": "^1.0.2", @@ -3126,6 +3127,19 @@ "@types/gapi.client.discovery-v1": "*" } }, + "node_modules/@noble/hashes": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz", + "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@one-ini/wasm": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@one-ini/wasm/-/wasm-0.1.1.tgz", @@ -9440,6 +9454,19 @@ "node": ">=0.10.0" } }, + "node_modules/otpauth": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/otpauth/-/otpauth-9.5.0.tgz", + "integrity": "sha512-Ldhc6UYl4baR5toGr8nfKC+L/b8/RgHKoIixAebgoNGzUUCET02g04rMEZ2ZsPfeVQhMHcuaOgb28nwMr81zCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "2.0.1" + }, + "funding": { + "url": "https://github.com/hectorm/otpauth?sponsor=1" + } + }, "node_modules/own-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", diff --git a/package.json b/package.json index baeba7bf..90e4d211 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "@vitejs/plugin-vue-jsx": "^4.1.2", "@vue/test-utils": "^2.4.6", "jsdom": "^29.0.0", + "otpauth": "^9.5.0", "sass-embedded": "^1.81.0", "vite": "7.1.11", "vite-plugin-pwa": "^1.0.2", diff --git a/playwright.config.js b/playwright.config.ts similarity index 77% rename from playwright.config.js rename to playwright.config.ts index c7594f80..31dd6554 100644 --- a/playwright.config.js +++ b/playwright.config.ts @@ -1,6 +1,6 @@ import { defineConfig, devices } from "@playwright/test"; -const baseURL = process.env.PLAYWRIGHT_BASE_URL || "http://127.0.0.1:4173"; +const baseURL = process.env.PLAYWRIGHT_BASE_URL || "http://localhost:5173"; const isCI = !!process.env.CI; export default defineConfig({ @@ -22,8 +22,8 @@ export default defineConfig({ video: "retain-on-failure" }, webServer: { - command: "npm run dev -- --host 127.0.0.1 --port 4173", - port: 4173, + command: "npm run dev", + port: 5173, timeout: 120_000, reuseExistingServer: !isCI }, @@ -37,7 +37,7 @@ export default defineConfig({ { name: "chromium-mobile", use: { - ...devices["Pixel 7"] + ...devices["Pixel 5"] } }, { @@ -46,10 +46,16 @@ export default defineConfig({ ...devices["Desktop Firefox"] } }, + { + name: "webkit-desktop", + use: { + ...devices["Desktop Safari"] + } + }, { name: "webkit-mobile", use: { - ...devices["iPhone 13"] + ...devices["iPhone 12"] } } ] diff --git a/playwright.local.config.ts b/playwright.local.config.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobileAttachment.vue b/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobileAttachment.vue index 91b2211c..7d67a7c5 100644 --- a/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobileAttachment.vue +++ b/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobileAttachment.vue @@ -1,5 +1,5 @@