fix(test): #542 landing review follow-up

The Run dropdown scroll browser test built WebServer on the fixed port 3290,
which the static port guard (test/test-ports-guard.test.ts, from #556) rejects
for any file outside its shrink-only legacy list, so the CI gate failed on the
landing branch. The test now binds an ephemeral port with new WebServer(0, ...)
and navigates to server.boundPort, and its header records the new convention.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-10-09 06:12:18 +02:00
parent 432bd5fc0a
commit fe1acd625e
+3 -5
View File
@@ -8,21 +8,19 @@
* Browser-driven, so excluded from `npm run test:ci` (config/test-suites.ts). Run locally:
* npm run test:browser -- test/run-mode-menu-scroll.browser.test.ts
*
* Port: 3290
* Port: ephemeral (`new WebServer(0, …)`, read back through `boundPort`)
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { chromium, type Browser, type Page } from 'playwright';
import { WebServer } from '../src/web/server.js';
const PORT = 3290;
describe('Run dropdown on a phone', () => {
let server: WebServer;
let browser: Browser;
let page: Page;
beforeAll(async () => {
server = new WebServer(PORT, false, true);
server = new WebServer(0, false, true);
await server.start();
browser = await chromium.launch({ headless: true });
const context = await browser.newContext({
@@ -32,7 +30,7 @@ describe('Run dropdown on a phone', () => {
deviceScaleFactor: 2,
});
page = await context.newPage();
await page.goto(`http://localhost:${PORT}`, { waitUntil: 'domcontentloaded' });
await page.goto(`http://localhost:${server.boundPort}`, { waitUntil: 'domcontentloaded' });
await page.waitForFunction(() => (window as any).app?.terminal, null, { timeout: 30000 });
}, 90000);