import { expect, test } from "@playwright/test"; for (const path of ["/", "/deep/nested/token/"]) { test(`edits and exports locally at ${path}`, async ({ page }) => { const external: string[] = []; page.on("request", (request) => { if (!request.url().startsWith("http://127.0.0.1:4183")) external.push(request.url()); }); await page.goto(path); await expect( page.getByRole("heading", { name: "One token source, honest platform output.", }), ).toBeVisible(); await expect(page.getByLabel("Export output")).toContainText( "--color-brand", ); await page .getByRole("combobox", { name: "Theme", exact: true }) .selectOption("dark"); await expect( page.locator(".resolved-table tr").filter({ hasText: "color.text" }), ).toContainText("#f4f2ff"); expect(external).toEqual([]); }); } test("keeps the installed application available offline", async ({ page, context, }) => { await page.goto("/"); await page.evaluate(async () => navigator.serviceWorker.ready); await page.reload(); await context.setOffline(true); try { await page.reload(); await expect( page.getByRole("heading", { name: "One token source, honest platform output.", }), ).toBeVisible(); } finally { await context.setOffline(false); } });