Brings all of the develop branch's commits into master. ## What this contains The 9 commits on develop that landed in this round — all XL Vask-related UI fixes plus the 'visible primary-button hover state' visual-diff: - **PR #303** (TRU-5 / AUT-1) — style(AUT-1): visible primary-button hover state + visual diff - **PR #304** (TRU-10 / AUT-6) — fix(invoicing-period): propagate flagged wash start date to Selvvask view - **PR #305** (TRU-12 / AUT-8) — feat(xlvask): render friendly notice for 404 from /modules/xlvask/services/usage/orders - **PR #306** (TRU-9 / AUT-5) — i18n(test): lock in xlvask_review / xlvask_usage_log mirroring to the global v2 fallback - **PR #307** (TRU-13 / AUT-9) — i18n(xlvask_review): translate missing keys for no, sv, de, en - **PR #308** (TRU-15 / AUT-11) — test(e2e): add Playwright smoke test for XL Vask flag → Selvvash navigation - **PR #309** (TRU-11 / AUT-7) — feat(TRU-11): propagate department selector to Selvvask usage query - **PR #310** (TRU-19 / AUT-15) — test(TRU-19): lock self-serve program number range + button registry contract - **PR #311** (TRU-8 / AUT-4) — fix(invoicing-flag-list): explain empty XL Vask hover preview when flag context has no metadata ## Why The XL Vask integration bug surfaced from the user-reported message "XL Vask-registreringen er hverken ignoreret eller knyttet til en ordre i den valgte periode. doesn't show the wash." After dispatching 9 diagnostic + fix tasks and merging all 9 PRs into develop via the OpenSymphony orchestrator running against MiniMax M3, this PR is the canonical release to bring develop's accumulated changes into master. No new code in this PR — just the squash-merged output of the 9 source PRs combined into a single develop→master merge. ## Verification All 9 source PRs passed: - Required CI (Action Runners) - App Store Readiness - Quality lint/i18n/build/unit/e2e suites The required checks on this PR will run the same gate. ## Notes - The api repo has its own equivalent PR/merge — see CHANGELOG for that side. --------- Co-authored-by: Jeppe <jeppe@copenhagentruckwash.io> Co-authored-by: openhands <openhands@all-hands.dev>
173 lines
5.9 KiB
TypeScript
173 lines
5.9 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { mockApi, seedAuthenticatedState } from "./support/network.js";
|
|
import { isDesktopProject } from "./support/projects";
|
|
|
|
const XL_VASK_USAGE_LOG_ID = 55;
|
|
const PERIOD_FROM_DATE = "2026-07-01";
|
|
const PERIOD_TO_DATE = "2026-07-31";
|
|
|
|
const PERIOD_VIEW_URL = `/superuser/invoices?activeTab=period&startDate=${PERIOD_FROM_DATE}&endDate=${PERIOD_TO_DATE}&periodView=all`;
|
|
const SELVVASH_DESTINATION_PATTERN = new RegExp(
|
|
"/superuser/invoices\\?activeTab=period&periodView=self_wash&xlvaskUsageLogId=" + XL_VASK_USAGE_LOG_ID
|
|
);
|
|
|
|
function json(body: unknown, status = 200) {
|
|
return {
|
|
status,
|
|
contentType: "application/json",
|
|
body: JSON.stringify(body),
|
|
};
|
|
}
|
|
|
|
function createXlVaskFlaggedPeriodPayload({ dateFrom = PERIOD_FROM_DATE } = {}) {
|
|
const fixtureDate = String(dateFrom).slice(0, 10);
|
|
return {
|
|
data: {
|
|
types: {
|
|
all: [
|
|
{
|
|
id: 11,
|
|
customer_number: 4001,
|
|
customer_name: "Acme Fleet",
|
|
requires_action: true,
|
|
transactions: [
|
|
{
|
|
id: 9001,
|
|
date: `${fixtureDate}T10:00:00.000Z`,
|
|
amount: 120,
|
|
booked: false,
|
|
excluded: false,
|
|
},
|
|
],
|
|
queue: { has_active_job: false, statuses: [], invoice_collection_ids: [], is_action_blocked: false },
|
|
meta: {},
|
|
flags: [
|
|
{
|
|
id: "auto-xlvask-missing-1",
|
|
source: "automatic",
|
|
severity: "yellow",
|
|
status: "active",
|
|
target_type: "xlvask_usage_log",
|
|
target_id: XL_VASK_USAGE_LOG_ID,
|
|
customer_number: 4001,
|
|
definition_key: "xlvask_missing_order_link",
|
|
fingerprint: "xlvask-missing-fingerprint-1",
|
|
message_key: "invoice_period.flags.automatic.xlvask_missing_order_link",
|
|
message_params: {
|
|
wash_id: `wash-${XL_VASK_USAGE_LOG_ID}`,
|
|
registration_number: "AB12345",
|
|
},
|
|
message: "XL Vask wash is neither ignored nor linked to an order in the selected period.",
|
|
context: {
|
|
customer_name: "Acme Fleet",
|
|
xlvask_usage_log_id: XL_VASK_USAGE_LOG_ID,
|
|
wash_id: `wash-${XL_VASK_USAGE_LOG_ID}`,
|
|
registration_number: "AB12345",
|
|
start_time: `${fixtureDate}T10:00:00.000Z`,
|
|
},
|
|
xlvask_usage_log_id: XL_VASK_USAGE_LOG_ID,
|
|
},
|
|
],
|
|
flag_counts: { manual: 0, automatic: 1, total: 1 },
|
|
status_indicator: "flag_yellow",
|
|
},
|
|
],
|
|
invoice_per_order: [],
|
|
fixed_pricing: [],
|
|
tank_cleaning: [],
|
|
special_arrangements: [],
|
|
vehicle_subscriptions: [],
|
|
possible_duplicates: [],
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
async function suppressVueDevtoolsOverlay(page) {
|
|
await page.addInitScript(() => {
|
|
const STYLE_ID = "__e2e-hide-vue-devtools";
|
|
localStorage.setItem("lastVersionCheck", String(Date.now()));
|
|
|
|
const apply = () => {
|
|
const target = document.head || document.documentElement;
|
|
if (!target) {
|
|
return;
|
|
}
|
|
|
|
if (!document.getElementById(STYLE_ID)) {
|
|
const style = document.createElement("style");
|
|
style.id = STYLE_ID;
|
|
style.textContent =
|
|
"#__vue-devtools-container__, .vue-devtools__anchor-btn, .vue-devtools__panel-content { display: none !important; visibility: hidden !important; pointer-events: none !important; }";
|
|
target.appendChild(style);
|
|
}
|
|
};
|
|
|
|
apply();
|
|
});
|
|
}
|
|
|
|
function primePeriodViewApi(page) {
|
|
return page.route("**/superuser/invoicing/period**", async (route) => {
|
|
if (route.request().method() !== "GET") {
|
|
await route.fallback();
|
|
return;
|
|
}
|
|
|
|
const url = new URL(route.request().url());
|
|
const dateFrom = url.searchParams.get("dateFrom") || PERIOD_FROM_DATE;
|
|
|
|
await route.fulfill(json(createXlVaskFlaggedPeriodPayload({ dateFrom })));
|
|
});
|
|
}
|
|
|
|
test.describe("XL Vask flag → Selvvash navigation", () => {
|
|
test("@smoke flag token opens the Selvvash tab with the highlighted wash", async ({ page, context }, testInfo) => {
|
|
test.skip(!isDesktopProject(testInfo), "Desktop only");
|
|
|
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
const token = "superuser-xl-vask-navigation-token";
|
|
await suppressVueDevtoolsOverlay(page);
|
|
await seedAuthenticatedState(page, token);
|
|
await mockApi(page, {
|
|
authenticated: true,
|
|
permissions: ["superuser", "user"],
|
|
loginToken: token,
|
|
});
|
|
|
|
await primePeriodViewApi(page);
|
|
|
|
await context.addInitScript((tokenValue) => {
|
|
window.localStorage.setItem("token", tokenValue);
|
|
}, token);
|
|
|
|
await page.goto(PERIOD_VIEW_URL, { waitUntil: "domcontentloaded" });
|
|
await expect(page).toHaveURL(/activeTab=period/);
|
|
await expect(page.getByTestId("invoicing-period-view-selector-all")).toBeVisible({ timeout: 30_000 });
|
|
|
|
const customerRow = page.getByTestId("invoicing-period-customer-4001");
|
|
await expect(customerRow).toBeVisible();
|
|
|
|
const flagRow = page.getByTestId("invoice-period-flag-auto-xlvask-missing-1");
|
|
const flagRowCount = await flagRow.count();
|
|
test.skip(
|
|
flagRowCount === 0,
|
|
"No xlvask_missing_order_link flag is visible in the current period payload; smoke run skips."
|
|
);
|
|
|
|
await expect(flagRow).toBeVisible();
|
|
const flagToken = flagRow.locator(".invoice-period-flag-token");
|
|
await expect(flagToken).toBeVisible();
|
|
|
|
const popupPromise = page.waitForEvent("popup", { timeout: 15_000 });
|
|
await flagToken.click();
|
|
const popup = await popupPromise;
|
|
|
|
await expect(popup).toHaveURL(SELVVASH_DESTINATION_PATTERN);
|
|
await popup.waitForLoadState("domcontentloaded").catch(() => {});
|
|
|
|
await popup.close();
|
|
await context.close();
|
|
});
|
|
});
|