Add automated playwright tests#112
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds automated end-to-end testing infrastructure using Playwright to test the Link Hints browser extension. The tests walk through the interactive tutorial, verifying that the extension's hint system works correctly across different modes and interactions.
Key Changes
- Adds Playwright test framework with Firefox browser support
- Implements comprehensive tutorial walkthrough test with snapshot testing
- Modifies shadow DOM mode to be "open" in development for test accessibility
- Adds CI workflow to run tests automatically on pull requests
- Includes devcontainer configuration for consistent development environment
Reviewed changes
Copilot reviewed 18 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/tutorial.spec.ts | Main test file implementing tutorial walkthrough with helper functions for hint activation and snapshotting |
| playwright.config.ts | Configures Playwright with Firefox in headed mode (required for extensions) with 60s timeout |
| package.json | Adds Playwright dependencies and test:playwright script |
| src/renderer/Program.ts | Changes shadow DOM mode from "closed" to "open" in dev mode for test accessibility |
| project.config.ts | Modifies compiled output path to "compiled-dev" when not building for production |
| .github/workflows/ci.yml | Adds test job with xvfb for headless browser testing in CI |
| .devcontainer/devcontainer.json | Configures dev container with Node 18, xvfb, and Playwright dependencies |
| .github/copilot-instructions.md | Documents project structure and conventions for AI assistants |
| .gitignore & .prettierignore | Excludes test results and snapshot directories |
| tests/-snapshots/.html | Snapshot files for visual regression testing of hint rendering |
| tests/-snapshots/.png | Screenshot snapshots for visual comparison |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ); | ||
|
|
||
| // Press 'o' | ||
| await page.keyboard.press("e"); |
There was a problem hiding this comment.
The comment says "Press 'o'" but the code presses 'e'. This inconsistency between the comment and the implementation suggests either the comment is wrong or the wrong key is being pressed.
| await page.keyboard.press("e"); | |
| await page.keyboard.press("o"); |
| undefined | ||
| ); | ||
| // UGH I want to get rid of this so bad. | ||
| await page.waitForTimeout(200); |
There was a problem hiding this comment.
This hardcoded wait timeout is a test anti-pattern that can cause flakiness. The comment indicates the author wants to remove it. Consider replacing with a proper wait condition that checks for the actual state change you're waiting for, or use Playwright's auto-waiting features.
| await page.waitForTimeout(200); |
8fdc961 to
2dfaa94
Compare
2dfaa94 to
9d79264
Compare
No description provided.