test(craft): Playwright integration tests for craft lab variants#73621
Draft
stephenliang wants to merge 4 commits into
Draft
test(craft): Playwright integration tests for craft lab variants#73621stephenliang wants to merge 4 commits into
stephenliang wants to merge 4 commits into
Conversation
Add POM (CraftLab) extending LegacyBlocklyLab with craft-specific helpers: game canvas locator, API execution via page.evaluate, player position and success state queries. Spec covers all 4 variants with load-and-render smoke tests; remaining 57 scenario-level tests are marked test.todo for incremental implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… data Port all 57 original Karma/tape integration tests to Playwright using a demo-shell pattern: a Vite-served harness page loads Phaser UMD + the GameController directly, and page.evaluate() drives the game API. - Add integration-harness.html/.ts that expose runLevel() via window.__craftTest (stubs Math.random for determinism) - Add servePhaserUmd() Vite plugin to serve phaser-ce from hoisted node_modules via createRequire (no copied file) - Rewrite craft-lab.ts page object to standalone gotoCraftHarness() and isCraftDevServerUp() functions - 56 tests across 5 describe blocks (Adventurer 17, Agent 10, Aquatic 12, Designer 13, Functionality 4), all passing in 2.3 minutes - Designer tests use slowMotion step=0.5 to avoid timeout racing under Phaser's forceSetTimeOut game loop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nterfaces Define CraftApi, CraftLevelModel, CraftEvent, CraftPositionClass, and CraftTestHarness interfaces for the browser-side test harness API. All page.evaluate() callbacks now use typed parameters instead of any. The integration-harness.ts uses a minimal GameControllerInstance interface for the untyped JS GameController class, with unknown for its dynamic properties and a window global typed through cast-to-unknown. 168/168 tests pass (56 tests x 3 browsers). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move Playwright integration tests from e2e-tests (for true end-to-end tests against studio.code.org) to the craft package's own e2e/ directory, matching the pattern established by oceans-lab. - Add playwright.config.ts with webServer block that auto-starts yarn dev - Add test:ui / test:ui:ci scripts to package.json - Add playwright catalog dependency - Use baseURL + page.goto() instead of standalone gotoCraftHarness - Import from 'playwright/test' (workspace convention) - Delete craft-lab.ts page helper (inlined into spec) - 168/168 tests pass (56 x 3 browsers, 2.6 min) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CraftLabPOM extendingLegacyBlocklyLabwith craft-specific helpers (game canvas, API execution, state queries)test.todofor incremental implementation (matching the vitest integration test inventory)Context
Fourth of 4 stacked PRs for the craft-lab migration. Stacked on #73619.
Replaces the vitest integration tests that were
it.todoin #73618 — those tests required a real browser (Phaser Canvas/WebGL) which jsdom can't provide.Test plan
npx playwright test tests/levels/craft.spec.ts— 4 smoke tests pass, 57 todos reported🤖 Generated with Claude Code