Fix frontend test gate expectations

This commit is contained in:
Jeppe B
2026-07-07 22:16:25 +02:00
parent 1123b34e10
commit 4cc2c3310c
7 changed files with 51 additions and 32 deletions
+3
View File
@@ -20,6 +20,7 @@ export const ownedFilesByRole = {
"auth.smoke.spec.js",
"booking-selfserve.smoke.spec.js",
"connectivityIssue.spec.ts",
"date-period-selector.smoke.spec.js",
"example.spec.ts",
"guest-book-wash-mobile.spec.ts",
"i18n-v2-integrity.spec.ts",
@@ -101,12 +102,14 @@ export const ownedFilesByRole = {
"superuser-customer-complaints.spec.ts",
"superuser-customers-mass-import.spec.ts",
"superuser-department-branding.spec.js",
"superuser-department-shells.spec.js",
"superuser-department-overview.spec.js",
"superuser-department-gates.spec.ts",
"superuser-department-lanes.spec.ts",
"superuser-department-pricing-custom-only.spec.ts",
"superuser-departments-archive.spec.ts",
"superuser-drafts.spec.ts",
"superuser-orders-date-filters.spec.ts",
"superuser-products-layout.spec.ts",
"superuser-roles-permissions.spec.ts",
"superuser-system-status.smoke.spec.js",
@@ -1114,9 +1114,10 @@ function modulePath(key) {
}
.module-card__top {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
display: flex;
flex-wrap: wrap;
align-items: start;
justify-content: space-between;
column-gap: 0.75rem;
row-gap: 0.35rem;
}
@@ -1131,6 +1132,7 @@ function modulePath(key) {
.module-card__title {
margin: 0;
flex: 1 1 12rem;
min-width: 0;
text-transform: none;
letter-spacing: 0.04em;
@@ -1139,8 +1141,8 @@ function modulePath(key) {
}
.module-card__top .status-pill {
justify-self: end;
align-self: start;
flex: 0 0 auto;
margin-left: auto;
}
.gateway-card__title {
+3 -15
View File
@@ -1,6 +1,5 @@
import { expect, test } from "@playwright/test";
import { mockApi, seedAuthenticatedState } from "./support/network.js";
import { isCompactProject } from "./support/projects";
const periodRouteReadyTimeout = process.env.CI ? 30_000 : 15_000;
@@ -2306,24 +2305,13 @@ test.describe("Invoicing period tab", () => {
});
});
test("@smoke period month shortcuts select whole calendar months", async ({ page }, testInfo) => {
const isCompact = isCompactProject(testInfo);
test("@smoke period month shortcuts select whole calendar months", async ({ page }) => {
await page.clock.setFixedTime(new Date("2026-05-04T10:00:00.000Z"));
const { periodRequests } = await openPeriodView(page);
const initialRequestCount = periodRequests.length;
if (isCompact) {
const select = page.getByTestId("date-period-shortcuts");
const label = await select
.locator("option")
.filter({ hasText: /sidste måned|last month/i })
.first()
.textContent();
await select.selectOption({ label: label.trim() });
} else {
await page.getByRole("button", { name: /last month|sidste måned/i }).click();
}
await page.getByTestId("date-period-other-dropdown-trigger").click();
await page.getByTestId("date-period-other-last_month").click();
await expect.poll(() => periodRequests.length).toBeGreaterThan(initialRequestCount);
await expect
+5 -2
View File
@@ -384,7 +384,7 @@ describe("DatePeriodSelector month warning", () => {
);
});
it("opens the month selector from Other month on mobile", async () => {
it("opens the month modal from Other month on mobile", async () => {
sharedState.width.value = 480;
const wrapper = mountWithApp(DatePeriodSelector, {
messages,
@@ -405,12 +405,15 @@ describe("DatePeriodSelector month warning", () => {
},
});
await wrapper.get("[data-testid='date-period-other-dropdown-trigger']").trigger("click");
expect(wrapper.get("[data-testid='date-period-other-other_month']").text()).toContain("Other month");
expect(wrapper.find("[data-testid='date-period-month']").exists()).toBe(false);
await wrapper.get("[data-testid='date-period-other-other_month']").trigger("click");
expect(wrapper.get("[data-testid='date-period-month']").exists()).toBe(true);
expect(wrapper.get("[data-testid='date-period-other-month-modal']").exists()).toBe(true);
expect(wrapper.get("[data-testid='date-period-other-month-picker']").exists()).toBe(true);
});
it("selects Anytime for empty ranges without highlighting Today", () => {
@@ -91,9 +91,12 @@ const formatDisplayedDate = (isoDate) => {
return "";
}
return `${day}/${month}/${year}`;
return `${month}/${day}/${year}`;
};
const getWashDateInput = (wrapper) =>
wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').get("input");
describe("DepartmentDashboardDailyReportComplaints", () => {
beforeEach(() => {
vi.useFakeTimers();
@@ -129,7 +132,7 @@ describe("DepartmentDashboardDailyReportComplaints", () => {
await flushPromises();
expect(wrapper.get('[data-testid="daily-report-complaints-department-select"]').element.value).toBe("1");
expect(wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').element.value).toBe("23/03/2026");
expect(getWashDateInput(wrapper).element.value).toBe("03/23/2026");
expect(wrapper.find('[data-testid="daily-report-complaints-date-note"]').exists()).toBe(false);
});
@@ -143,7 +146,7 @@ describe("DepartmentDashboardDailyReportComplaints", () => {
await flushPromises();
expect(wrapper.get('[data-testid="daily-report-complaints-department-select"]').element.value).toBe("2");
expect(wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').element.value).toBe("");
expect(getWashDateInput(wrapper).element.value).toBe("");
expect(wrapper.get('[data-testid="daily-report-complaints-date-note"]').text()).toContain("konkrete vask");
});
@@ -160,7 +163,7 @@ describe("DepartmentDashboardDailyReportComplaints", () => {
await wrapper.get('[data-testid="daily-report-complaints-add-button"]').trigger("click");
await flushPromises();
expect(wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').element.value).toBe("23/03/2026");
expect(getWashDateInput(wrapper).element.value).toBe("03/23/2026");
expect(wrapper.get('[data-testid="daily-report-complaints-category-select"]').element.value).toBe("");
expect(wrapper.get('[data-testid="daily-report-complaints-description-textarea"]').element.value).toBe("");
expect(wrapper.find('[data-testid="daily-report-complaints-customer-selected"]').exists()).toBe(false);
@@ -180,7 +183,7 @@ describe("DepartmentDashboardDailyReportComplaints", () => {
expect(createComplaintMock).not.toHaveBeenCalled();
expect(wrapper.get('[data-testid="daily-report-complaints-validation-error"]').text()).toContain("Dato for vask");
await wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').setValue("21/03/2026");
await getWashDateInput(wrapper).setValue("03/21/2026");
await wrapper.get('[data-testid="daily-report-complaints-submit"]').trigger("click");
await flushPromises();
@@ -203,9 +206,7 @@ describe("DepartmentDashboardDailyReportComplaints", () => {
await wrapper.get('[data-testid="daily-report-complaints-add-button"]').trigger("click");
await flushPromises();
expect(wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').element.value).toBe(
formatDisplayedDate(today)
);
expect(getWashDateInput(wrapper).element.value).toBe(formatDisplayedDate(today));
await wrapper.get('[data-testid="daily-report-complaints-category-select"]').setValue("service");
await wrapper.get('[data-testid="daily-report-complaints-description-textarea"]').setValue("Machine damaged cargo");
await wrapper.get('[data-testid="daily-report-complaints-submit"]').trigger("click");
@@ -243,7 +244,7 @@ describe("DepartmentDashboardDailyReportComplaints", () => {
expect(wrapper.get('[data-testid="daily-report-complaints-customer-selected"]').element.value).toBe(
"Acme Transport - 12345"
);
expect(wrapper.get('[data-testid="daily-report-complaints-wash-date-input"]').element.value).toBe("23/03/2026");
expect(getWashDateInput(wrapper).element.value).toBe("03/23/2026");
await wrapper.get('[data-testid="daily-report-complaints-category-select"]').setValue("wash_quality");
await wrapper
@@ -16,7 +16,6 @@ describe("DepartmentModulesSetup self-serve management regression", () => {
});
it("renders a dedicated self-serve module switch in setup UI", () => {
expect(source).toContain('subtitle="Selvvask"');
expect(source).toContain('title="Selvvask"');
expect(source).toContain("Aktiver selvvask i denne afdeling.");
});
@@ -47,6 +47,29 @@ vi.mock("@/components/session/token/SessionUser.vue", () => ({
toLocal: (value) => `local:${value}`,
},
},
objects: {
global: {
language: {
text: {
today: "Today",
anytime: "Anytime",
yesterday: "Yesterday",
last_7_days: "Last 7 days",
this_week: "This week",
last_week: "Last week",
this_month: "This month",
last_month: "Last month",
other_month: "Other month",
same_week_last_year: "Same week last year",
same_month_last_year: "Same month last year",
date_from: "From",
date_to: "To",
month: "Month",
year: "Year",
},
},
},
},
},
}));
@@ -276,6 +299,6 @@ describe("Superuser department overview", () => {
const tabs = wrapper.findAll(".tabs li");
await tabs.find((tab) => tab.text() === "Pricing").trigger("click");
expect(mocks.router.push).toHaveBeenCalledWith("/superuser/departments/1/pricing");
expect(mocks.router.push).toHaveBeenCalledWith("/superuser/departments/1/prices");
});
});