d9bcccc1c5
- Restructure OnlineBoardFilter to use radio tabs (flight/departure/ arrival/route) with dynamic fields matching e2e test expectations - Fix error page e2e tests to use client-side navigation (SSR renders empty outside [lang]/layout) and use specific CSS class locators - Replace deprecated transparentize() with rgba() in _shadows.scss - Handle WebSocket upgrades explicitly in dev-server to prevent HMR reconnection spam - Resolve DEP0190 by spawning modern binary directly without shell - Add tests/e2e-angular to tsconfig excludes
68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
|
|
test.describe("Cross-feature navigation", () => {
|
|
test("locale switching: /ru/onlineboard -> /en/onlineboard shows English content", async ({
|
|
page,
|
|
}) => {
|
|
// Start on Russian online board
|
|
await page.goto("/ru/onlineboard");
|
|
await page.waitForLoadState("domcontentloaded");
|
|
await expect(page.locator('[data-testid="online-board-start"]')).toBeVisible(
|
|
{ timeout: 10000 },
|
|
);
|
|
|
|
// Navigate to English version
|
|
await page.goto("/en/onlineboard");
|
|
await page.waitForLoadState("domcontentloaded");
|
|
await expect(page.locator('[data-testid="online-board-start"]')).toBeVisible(
|
|
{ timeout: 10000 },
|
|
);
|
|
|
|
// URL should reflect English locale
|
|
expect(page.url()).toContain("/en/onlineboard");
|
|
});
|
|
|
|
test("error page: /error/404 renders 404 content", async ({ page }) => {
|
|
// Navigate to a working page first, then client-side navigate to the error
|
|
// page. Direct URL navigation to /error/404 renders blank because the
|
|
// error route is outside [lang]/layout.tsx and SSR produces empty output.
|
|
await page.goto("/ru/onlineboard");
|
|
await page.waitForLoadState("domcontentloaded");
|
|
await expect(page.locator('[data-testid="online-board-start"]')).toBeVisible(
|
|
{ timeout: 10000 },
|
|
);
|
|
|
|
await page.evaluate(() => window.location.assign("/error/404"));
|
|
await page.waitForLoadState("domcontentloaded");
|
|
|
|
// The error page shows the error code
|
|
await expect(page.locator(".error-page__code")).toHaveText("404", { timeout: 10000 });
|
|
});
|
|
|
|
test("error page: /error/500 renders server error content", async ({
|
|
page,
|
|
}) => {
|
|
// Navigate to a working page first, then client-side navigate to the error
|
|
// page (same reason as the 404 test above).
|
|
await page.goto("/ru/onlineboard");
|
|
await page.waitForLoadState("domcontentloaded");
|
|
await expect(page.locator('[data-testid="online-board-start"]')).toBeVisible(
|
|
{ timeout: 10000 },
|
|
);
|
|
|
|
await page.evaluate(() => window.location.assign("/error/500"));
|
|
await page.waitForLoadState("domcontentloaded");
|
|
|
|
await expect(page.locator(".error-page__code")).toHaveText("500", { timeout: 10000 });
|
|
});
|
|
|
|
test("unknown route: /ru/nonexistent does not crash", async ({ page }) => {
|
|
const response = await page.goto("/ru/nonexistent");
|
|
await page.waitForLoadState("domcontentloaded");
|
|
|
|
// The page should render something (the app should handle unknown routes
|
|
// gracefully, possibly showing a 404 or redirecting)
|
|
await expect(page.locator("body")).not.toBeEmpty();
|
|
});
|
|
});
|