mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-12 02:09:42 +02:00
test: build every in-process WebServer on port 0 (#440)
The files on the guard's legacy list build new WebServer(0, …) and read server.boundPort after start(), as sse-tile-grid-filter does. Files with several servers read each server's own port; quick-start's local helper lost its port parameter so the literal 0 sits where the server is built. Header comments that named a port say "ephemeral". No assertion changed except where it embedded the port. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3a0cee6b90
commit
aa4217b8b1
@@ -6,7 +6,7 @@
|
||||
* - Close modal shows "Kill Tmux & OpenCode" (not "Claude Code")
|
||||
* - needsRefresh handler sends resize
|
||||
*
|
||||
* Port: 3211 (opencode UI tests)
|
||||
* Port: ephemeral
|
||||
*
|
||||
* Run: npx vitest run test/opencode-resize.test.ts
|
||||
*/
|
||||
@@ -16,8 +16,7 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
||||
import { chromium, type Browser, type BrowserContext, type Page } from 'playwright';
|
||||
import { WebServer } from '../src/web/server.js';
|
||||
|
||||
const PORT = 3211;
|
||||
const BASE_URL = `http://localhost:${PORT}`;
|
||||
let baseUrl: string;
|
||||
|
||||
const HAS_OPENCODE = (() => {
|
||||
try {
|
||||
@@ -40,15 +39,16 @@ async function freshPage(): Promise<{ context: BrowserContext; page: Page }> {
|
||||
}
|
||||
|
||||
async function navigateAndWait(page: Page): Promise<void> {
|
||||
await page.goto(BASE_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(baseUrl, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForFunction(() => document.body.classList.contains('app-loaded'), {
|
||||
timeout: 5000,
|
||||
});
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
server = new WebServer(PORT, false, true); // testMode
|
||||
server = new WebServer(0, false, true); // testMode
|
||||
await server.start();
|
||||
baseUrl = `http://localhost:${server.boundPort}`;
|
||||
browser = await chromium.launch({ headless: true });
|
||||
}, 30_000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user