Files
flights_web/tests/e2e/navigation.spec.ts
T
gnezim d9bcccc1c5
CI / ci (push) Failing after 38s
Deploy / build-and-deploy (push) Failing after 6s
Fix all e2e failures, sass warnings, and HMR websocket errors
- 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
2026-04-16 00:23:10 +03:00

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();
});
});