Files
huajishe-tts/apps/web/playwright.config.ts
e2hang d46dc54808 feat(multiplayer): room list UI + E2E/unit/Docker fixes
Adds the multiplayer functionality the user requested:

- LobbyRoomList UI component (create / list / join via boardgame.io's
  built-in Lobby REST API). Credentials are server-issued; no more hardcoded
  p0/p1 in OnlineConfig.
- LobbyClient re-export wrapper in @tts-like/engine (typed factory
  createLobbyClient).
- CORS origin default: dev-friendly regex list (boardgame.io's
  isOriginAllowed treats literal '*' as exact-match, which silently blocks
  everything; we now use RegExp matching localhost + Tauri schemes).
- War shuffle accepts an injected random fn so unit tests are deterministic;
  fixed a tie-handling bug where piles were cleared without redistributing
  cards (now piles stay on tie for a "war" round).
- Engine unit tests (vitest + Local master for 2-client sync):
    packages/engine/src/games/{drag-test,war,mill}.test.ts  (34 cases)
- Server REST tests (vitest + supertest, port 0 random):
    packages/server/src/server.test.ts                        (9 cases)
- Playwright E2E (apps/web/e2e/*): 3 specs covering create → join →
  sync for War / DragTest / Mill across two browser contexts.
- Dockerfile fix: pnpm deploy --prod leaves boardgame.io as a symlink to
  .pnpm/boardgame.io@…; copy -rL materialises the dist so the runtime
  image can resolve boardgame.io/server.
- Root scripts: dev:server, test:e2e, verify (ts + test + e2e).
2026-08-23 15:37:58 +08:00

43 lines
959 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from '@playwright/test';
/**
* Playwright E2E 配置
*
* 起两个 webServer
* - server : boardgame.io server 在 :8000
* - web : vite dev 在 :5173
*
* testDir: ./e2e
* workers: 12 客户端多 tab 用例需串行,避免状态污染)
*/
export default defineConfig({
testDir: './e2e',
fullyParallel: false,
workers: 1,
retries: 0,
timeout: 60_000,
expect: { timeout: 10_000 },
use: {
baseURL: 'http://localhost:5173',
trace: 'retain-on-failure',
headless: true,
},
webServer: [
{
command: 'pnpm --filter @tts-like/server start',
port: 8000,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stderr: 'pipe',
timeout: 30_000,
},
{
command: 'pnpm --filter @tts-like/web dev',
port: 5173,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stderr: 'pipe',
timeout: 30_000,
},
],
});