- Implement release update detection, asset preloading, and frontend version management. - Add unit and E2E tests for release update workflows, widget behavior, and failure scenarios. - Introduce new services for handling release ping, error reporting, and update installation workflows. - Extend i18n for release-related components and error report localization. - Add `ReleaseFrontendVersionBadge.vue` and related styles to display frontend update statuses.
58 lines
2.5 KiB
TypeScript
58 lines
2.5 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
|
|
const PING_URL =
|
|
/(?:https:\/\/api\.truckwash\.io:4433|https:\/\/api-v2\.truckwash\.io\/master\/api|https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?\/api)\/ping(?:\?.*)?$/;
|
|
const CONNECTIVITY_PAGE_TIMEOUT_MS = 30_000;
|
|
|
|
function installPingFailure(page, onPing) {
|
|
return page.route(PING_URL, async (route) => {
|
|
onPing();
|
|
await route.fulfill({
|
|
status: 500,
|
|
contentType: "application/json",
|
|
body: JSON.stringify({ message: "Connectivity check failed" }),
|
|
});
|
|
});
|
|
}
|
|
|
|
test.describe("Connectivity issue", () => {
|
|
test("renders the recovery state when ping fails", async ({ page }) => {
|
|
let pingCount = 0;
|
|
await installPingFailure(page, () => {
|
|
pingCount += 1;
|
|
});
|
|
|
|
await page.goto("/connectivity-issue");
|
|
|
|
await expect(page.getByTestId("connectivity-issue")).toBeVisible({ timeout: CONNECTIVITY_PAGE_TIMEOUT_MS });
|
|
await expect(page.getByTestId("connectivity-icon")).toBeVisible();
|
|
await expect(page.getByTestId("connectivity-title")).toHaveText("Forbindelsesproblem");
|
|
await expect(page.getByTestId("connectivity-subtitle")).toContainText("internetforbindelse");
|
|
await expect(page.getByTestId("connectivity-subtitle")).toContainText("vores server");
|
|
await expect(page.getByTestId("connectivity-description")).toContainText("Vent venligst");
|
|
await expect(page.getByTestId("connectivity-description")).toContainText("serveren");
|
|
await expect(page.getByTestId("connectivity-retry-timer")).toContainText("Pr");
|
|
await expect(page.getByTestId("connectivity-retry-button")).toHaveText("Prøv igen");
|
|
await expect(page.getByTestId("connectivity-footer")).toContainText("kontakt venligst support");
|
|
await expect.poll(() => pingCount).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("retry button triggers a fresh ping attempt and keeps the recovery screen visible", async ({ page }) => {
|
|
let pingCount = 0;
|
|
await installPingFailure(page, () => {
|
|
pingCount += 1;
|
|
});
|
|
|
|
await page.goto("/connectivity-issue");
|
|
await expect(page.getByTestId("connectivity-issue")).toBeVisible({ timeout: CONNECTIVITY_PAGE_TIMEOUT_MS });
|
|
await expect.poll(() => pingCount).toBeGreaterThan(0);
|
|
|
|
const initialPingCount = pingCount;
|
|
await page.getByTestId("connectivity-retry-button").click();
|
|
|
|
await expect.poll(() => pingCount).toBeGreaterThan(initialPingCount);
|
|
await expect(page.getByTestId("connectivity-issue")).toBeVisible();
|
|
await expect(page.getByTestId("connectivity-title")).toHaveText("Forbindelsesproblem");
|
|
});
|
|
});
|