e2ecdc7533
New domain `browser` under frontend/functions/ with 6 Playwright helpers: - pw_launch_browser: chromium + context + page bootstrap with storageState support and baseUrl navigation. - pw_kanban_login: authenticates a Page against /api/auth/login; sets the kanban_session cookie via shared storageState; verifies login page no longer visible after navigation. - pw_drag_drop: human-like pointer drag (mousedown + activateOffset + stepped move + mouseup) compatible with @dnd-kit/core's 8px activation threshold; supports hoverMs for time-based dropzones. - pw_keyboard_sequence: ordered focus/type/press/wait steps for scripting realistic input flows (typing then arrow-key navigating autocompletes). - pw_wait_predicate: thin wrapper over page.waitForFunction with friendlier defaults and custom error messages. - pw_assert_class: poll-based assertion that a Locator has/lacks a CSS class within a timeout; useful for visual-state checks. Each function ships with vitest tests (5-8 cases each) covering both happy and error paths, plus self-documenting .md (Ejemplo + Cuando usarla + Gotchas + frontmatter with params/output schema). Adds frontend/functions/package.json with `"type": "module"` so consumers can ESM-import the .ts files from anywhere in the registry (Playwright's tsx loader respects nearest package.json). Capability page docs/capabilities/playwright.md documents the group with a canonical end-to-end example, frontiers, prerequisites, and gotchas. Index updated. First consumer (issue 0088): apps/kanban requester-input.spec.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.0 KiB
2.0 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| pw_launch_browser | function | ts | browser | 1.0.0 | impure | async (opts?: PwLaunchOptions) => Promise<PwHandles> | Launches chromium and returns a Page navigated to baseUrl. Optionally pre-authenticates via storageState. Used as the entry point for any Playwright e2e test in the registry. |
|
false | error_go_core |
|
Playwright handles {browser, context, page, close}; page is already navigated to baseUrl. | true |
|
frontend/functions/browser/pw_launch_browser.test.ts | frontend/functions/browser/pw_launch_browser.ts |
Ejemplo
import { pw_launch_browser } from "./pw_launch_browser";
const h = await pw_launch_browser({ baseUrl: "http://localhost:5180", headless: false });
await h.page.click("text=Login");
await h.close();
Cuando usarla
Cuando necesites iniciar un test e2e de Playwright para el SPA de kanban (o cualquier frontend del registry). Es el primer paso de cualquier suite: abre el browser, navega al baseUrl y devuelve los handles listos para interactuar.
Gotchas
playwrightes una peer dependency: debe estar instalada en el proyecto consumidor (pnpm add -D playwrightonpm i -D playwright). El registry no la instala.storageStatePathse ignora silenciosamente si el archivo no existe — verifica que el archivo de auth se haya generado antes de pasarlo.close()cierra context primero y luego browser; no llamesbrowser.close()manualmente antes declose()o el context quedara huerfano.- La navegacion a
baseUrlocurre dentro depw_launch_browser; si el servidor no esta levantado,page.gotolanzara un error de red.