import { expect, test } from "@playwright/test"; import { advanceTo, dismissLogbook, dispatchFromEarthBoard, playToDeal, state } from "./support"; test.describe("the game runs on the device (CR-014 Step 14.7)", () => { test("plays the opening with every network request outside the app's own files blocked", async ({ page, baseURL, }) => { const origin = new URL(baseURL!).origin; const blocked: string[] = []; await page.route("**/*", (route) => { const url = new URL(route.request().url()); // Only the app's own static files may load; there is no API any more. if (url.origin === origin && !url.pathname.startsWith("/api/")) return route.continue(); blocked.push(url.href); return route.abort("internetdisconnected"); }); // Start a company, fly the tutorial, shake on the deal, dispatch a contract. const owner = await playToDeal(page); expect(owner.tutorial).toBeNull(); expect(owner.ships.map((s) => s.modelId)).toEqual(["courier", "clipper"]); const dispatchId = await dispatchFromEarthBoard(page); const flight = (await state(page)).activeDispatches.find((d) => d.id === dispatchId)!; await advanceTo(page, flight.arrivalAt); await page.reload(); await dismissLogbook(page); expect((await state(page)).activeDispatches).toEqual([]); expect(blocked).toEqual([]); }); });