Skip to content

Comments

feat: consolidate Playwright visual test suite#140

Merged
nvandessel merged 1 commit intomainfrom
feat/playwright-test-suite
Feb 20, 2026
Merged

feat: consolidate Playwright visual test suite#140
nvandessel merged 1 commit intomainfrom
feat/playwright-test-suite

Conversation

@nvandessel
Copy link
Owner

Summary

  • Consolidate scattered Playwright test scripts into scripts/tests/ with shared helpers, a suite runner, and make graph-test target
  • Migrate test-focus.js and test-drag.js from scripts/, recreate electric mode test from deleted test_electric.mjs + test_sparks.mjs (CJS, no hardcoded paths)
  • All 56 assertions pass across 3 test files (focus: 36, drag: 2, electric: 18)

Test plan

  • make graph-test runs full suite — 3/3 pass
  • Individual tests runnable standalone with NODE_PATH=build/node_modules
  • Screenshots generated in build/playwright/ (gitignored)
  • Electric test manages its own server lifecycle via startServer() helper

🤖 Generated with Claude Code

Migrate scattered test scripts into an organized test suite with shared
helpers, a suite runner, and a Makefile target. All 56 assertions pass
across 3 test files (focus, drag, electric).

- Create scripts/tests/helpers.js with shared utilities (makeCounter,
  launchBrowser, waitForGraph with physics settle, startServer, etc.)
- Migrate test-focus.js and test-drag.js from scripts/ to scripts/tests/,
  refactored to use shared helpers
- Recreate electric mode test from deleted test_electric.mjs + test_sparks.mjs,
  converted to CJS with no hardcoded paths
- Add run-all.sh suite runner (builds, generates HTML, runs all tests)
- Add `make graph-test` Makefile target
- Screenshots output to build/playwright/ (gitignored)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link

greptile-apps bot commented Feb 20, 2026

Greptile Summary

Consolidates scattered Playwright test scripts into a unified test suite under scripts/tests/ with shared helper utilities and a suite runner.

Key changes:

  • Extracted common test utilities (makeCounter, launchBrowser, waitForGraph, startServer) into scripts/tests/helpers.js
  • Migrated test-focus.js and test-drag.js from scripts/ to scripts/tests/, refactored to use shared helpers
  • Recreated electric mode test from previously deleted test_electric.mjs and test_sparks.mjs as CommonJS test-electric.js
  • Added scripts/tests/run-all.sh suite runner that builds binary, generates HTML, and runs all 3 tests
  • Added make graph-test target for convenient test execution
  • All tests use relative paths via SCREENSHOT_DIR constant instead of hardcoded paths
  • Test suite reports 56 total assertions across 3 files (focus: 36, drag: 2, electric: 18)

Migration details:

  • Removed inline assert() and browser setup from individual test files
  • test-electric.js now manages its own server lifecycle via startServer() helper
  • Screenshots generated in build/playwright/ (already gitignored via build/)
  • Individual tests remain runnable standalone with NODE_PATH=build/node_modules

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Well-structured refactoring that improves maintainability by consolidating test code. All changes are test-only, with no production code modifications. The shared helpers eliminate code duplication and the suite runner provides better test orchestration. Author reports all 56 assertions passing.
  • No files require special attention

Important Files Changed

Filename Overview
scripts/tests/helpers.js New shared helper module for Playwright tests with browser launch, graph waiting, server management, and assertion utilities
scripts/tests/test-focus.js Migrated from scripts/, refactored to use shared helpers, removed inline utilities
scripts/tests/test-drag.js Migrated from scripts/, refactored to use shared helpers for browser and assertions
scripts/tests/test-electric.js New test recreated from deleted test files, validates electric mode activation, animation, and spark rendering
scripts/tests/run-all.sh New suite runner that builds binary, generates HTML, and runs all 3 test files with summary reporting
Makefile Added graph-test target that invokes the new test suite runner script
.beads/issues.jsonl Updated issue tracking metadata (timestamps, priorities, status changes)

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[make graph-test] --> B[run-all.sh]
    B --> C[Install Playwright]
    B --> D[Build floop binary]
    B --> E[Generate graph.html]
    C --> F[Run test suite]
    D --> F
    E --> F
    
    F --> G[test-focus.js]
    F --> H[test-drag.js]
    F --> I[test-electric.js]
    
    G --> J[helpers.js]
    H --> J
    I --> J
    
    J --> K[makeCounter]
    J --> L[launchBrowser]
    J --> M[waitForGraph]
    J --> N[waitForElectric]
    J --> O[startServer]
    
    G -->|36 assertions| P[Screenshots]
    H -->|2 assertions| P
    I -->|18 assertions| P
    
    P --> Q[build/playwright/*.png]
Loading

Last reviewed commit: 5f0c499

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nvandessel nvandessel merged commit 6fec864 into main Feb 20, 2026
12 of 13 checks passed
@nvandessel nvandessel deleted the feat/playwright-test-suite branch February 20, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant