Files
meshcore-hub/e2e/tests/mobile.spec.ts
T
Louis King ec199e4e2b test(e2e): expand Playwright coverage for UI regression protection
Grow the suite from 41 to 77 specs covering previously untested UI
surfaces: channels admin CRUD with QR codes and keyboard nav, node
detail adoption/tag editing with the role permission matrix, SPA 404
page, sortable tables with URL-synced sort state, pagination with
filter-preserving links, mobile viewport (hamburger nav, mobile cards,
sort select), anonymous/member auth gating, raw packet detail, and
empty states. Route cards now assert history chart, recent-match links
and owner profile links.

Supporting changes: purposeful data-testids on channels/node-detail/
pagination/sort headers (plus aria-sort) and mobile nav; seed_data adds
30 trace_data filler groups for pagination, channels at every
visibility tier incl. one disabled, and a pw-operator profile.
2026-08-30 12:27:48 +01:00

39 lines
1.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
test.use({ viewport: { width: 375, height: 667 } });
test.describe("mobile layout", () => {
test("hamburger menu opens and navigates", async ({ page }) => {
await page.goto("/");
const menu = page.getByTestId("mobile-nav-menu");
await expect(menu).not.toBeVisible();
await page.getByTestId("mobile-nav-toggle").click();
await expect(menu).toBeVisible();
await expect(menu.getByTestId("nav-link").first()).toBeVisible();
await menu.locator('[data-testid="nav-link"][data-nav-href="/messages"]').click();
await expect(page).toHaveURL("/messages");
await expect(page.getByTestId("list-row").first()).toBeVisible();
});
test("nodes list renders mobile cards with the sort select", async ({
page,
}) => {
await page.goto("/nodes");
// Desktop table is hidden on small screens; mobile cards render instead.
await expect(page.locator("table")).toBeHidden();
await expect(page.getByTestId("mobile-sort-select")).toBeVisible();
const sortSelect = page.getByTestId("mobile-sort-select");
await sortSelect.selectOption("name:asc");
await expect(page).toHaveURL(/sort=name/);
await expect(page).toHaveURL(/order=asc/);
const firstCard = page.locator("a.card").first();
await expect(firstCard).toContainText("Alpha Node");
});
});