test: harden flaky chromium smoke specs

This commit is contained in:
Jeppe B
2026-06-10 15:27:14 +02:00
parent 724ad8e7a1
commit d42b58c4fe
4 changed files with 22 additions and 11 deletions
+7 -3
View File
@@ -534,6 +534,7 @@ test.describe("Edge gateway management smoke", () => {
});
test("@smoke manages discovery, bindings, tasks, logs, statistics, uninstall, and delete", async ({ page }) => {
test.slow();
await page.addInitScript(() => {
Object.defineProperty(navigator, "clipboard", {
configurable: true,
@@ -637,6 +638,7 @@ test.describe("Edge gateway management smoke", () => {
});
test("@smoke updates the integrated workspace after binding and scanner assignment changes", async ({ page }) => {
test.slow();
await mockApi(page, {
authenticated: true,
permissions: ["superuser", "user"],
@@ -1223,14 +1225,16 @@ test.describe("Edge gateway management smoke", () => {
await expect(page.getByTestId("gateway-terminal-page")).toBeVisible();
await expect(page.getByTestId("gateway-terminal-status")).toContainText(/connecting|open/i);
await expect(page.getByTestId("gateway-terminal-output")).toContainText("Connected to CPH Edge 01", {
timeout: 5_000,
});
await expect(page.getByTestId("gateway-terminal-output")).toContainText("Connected to CPH Edge 01");
await expect(page.getByTestId("gateway-terminal-send")).toBeDisabled();
await expect(page.getByTestId("gateway-terminal-input")).toBeEnabled();
await page.getByTestId("gateway-terminal-input").fill("pwd");
await expect(page.getByTestId("gateway-terminal-send")).toBeEnabled();
await page.getByTestId("gateway-terminal-send").click();
await expect(page.getByTestId("gateway-terminal-output")).toContainText("/opt/truckwash-edge-agent");
await expect(page.getByTestId("gateway-terminal-close")).toBeEnabled();
await page.getByTestId("gateway-terminal-close").click();
await expect(page.getByTestId("gateway-terminal-status")).toContainText(/closed|idle/i);
});
+9 -4
View File
@@ -76,16 +76,21 @@ test.describe("Invoice distribution smoke", () => {
const openMonthButton = page.getByTestId("distribution-overview-open-month").first();
await expect(openMonthButton).toBeVisible({ timeout: 15_000 });
const popupPromise = page.waitForEvent("popup", { timeout: 3000 }).catch(() => null);
const distributionMonthUrl = /\/superuser\/invoices\/distribution\/\d+\/\d+/;
const popupPromise = page.waitForEvent("popup", { timeout: 10_000 }).catch(() => null);
const samePageNavigationPromise = page
.waitForURL(distributionMonthUrl, { timeout: 10_000 })
.then(() => null)
.catch(() => null);
await openMonthButton.click();
const popup = await popupPromise;
const popup = await Promise.race([popupPromise, samePageNavigationPromise]);
if (popup) {
await expect(popup).toHaveURL(/\/superuser\/invoices\/distribution\/\d+\/\d+/);
await expect(popup).toHaveURL(distributionMonthUrl);
return;
}
await expect(page).toHaveURL(/\/superuser\/invoices\/distribution\/\d+\/\d+/);
await expect(page).toHaveURL(distributionMonthUrl);
});
test("@smoke monthly tabs keep URL query-state in sync", async ({ page }) => {
@@ -384,8 +384,10 @@ test.describe("Invoice transfer queue history reliability", () => {
await expect(page.getByTestId("economic-queue-history-retry-9401")).toHaveCount(0);
await expect(page.getByTestId("economic-queue-history-retry-9403")).toBeDisabled();
await page.getByTestId("economic-queue-history-retry-9402").click();
await expect.poll(() => retryCalls, { timeout: 8_000 }).toBe(1);
const retryButton = page.getByTestId("economic-queue-history-retry-9402");
await expect(retryButton).toBeEnabled();
await retryButton.click();
await expect.poll(() => retryCalls, { timeout: 15_000 }).toBe(1);
await expect(page.getByTestId("economic-queue-history-status-9402")).toContainText("QUEUED");
await expect(page.getByTestId("economic-queue-history-retry-9402")).toHaveCount(0);
});
+2 -2
View File
@@ -19,8 +19,8 @@ test.describe("Superuser vehicles smoke", () => {
await page.goto("/superuser/vehicles");
await expect(page).toHaveURL(/\/superuser\/vehicles$/);
await expect(page.getByRole("heading", { name: /registrerede køretøjer/i })).toBeVisible();
await expect(page.locator("body")).toContainText(/registrerede/i);
await expect(page.getByRole("heading", { name: /registrerede køretøjer|registered vehicles/i })).toBeVisible();
await expect(page.locator("body")).toContainText(/registrerede|registered/i);
await expect(page.locator("body")).not.toContainText(/Order ID is required/i);
});
});