Skip to content

Conversation

@mroderick
Copy link
Collaborator

Summary

Migrates from Selenium to Playwright for JavaScript browser automation in feature specs.

Changes

  • Replace selenium-webdriver with capybara-playwright-driver gem
  • Update Capybara driver configuration to use Playwright
  • Install Playwright browsers in Docker and CI
  • Fix test compatibility issues
  • Update documentation

Benefits

  • Better debugging tools (Playwright Inspector, trace viewer)
  • Improved test stability
  • Modern, actively-developed browser automation
  • Cross-browser testing support (Chromium, Firefox, WebKit)

Testing

  • All 6 JavaScript tests pass locally and in Docker
  • Full test suite passes (777 examples, 0 failures)
  • CI updated with browser caching

Developer Impact

  • Default behavior unchanged (headless tests)
  • Use PLAYWRIGHT_HEADLESS=false for visible debugging
  • Use PWDEBUG=1 for Playwright Inspector
  • Docker: bin/drspec continues to work as before

- Document complete design for migrating from Selenium to Playwright
- Include technical approach, validation plan, and cost-benefit analysis
- Add development workflow section to CLAUDE.md specifying PR-only changes
13 task implementation plan with step-by-step instructions:
- Dependency updates
- Configuration changes
- Docker and CI integration
- Test validation
- Documentation updates
Switch to Playwright for JavaScript browser automation.
Provides better debugging tools and improved test stability.
Replace Selenium Chrome driver with Playwright.
Supports chromium (default), firefox, and webkit browsers.
Headless by default, override with PLAYWRIGHT_HEADLESS=false.
Update test code to work with Playwright driver:
- Fix select_from_chosen helper to use JavaScript API instead of native send_keys (Playwright ElementHandle incompatibility)
- Update admin members test: change expected subscription count from 0 to -1 (subscription is correctly deleted)
- Update manage workshop attendances test: use select_from_chosen helper for Chosen.js dropdown
- Replace Selenium window switching with Capybara window_opened_by and within_window for cross-window navigation

All 6 JavaScript tests now pass with Playwright driver.
Add Playwright browser installation to Dockerfile.
Ensures JavaScript tests work in Docker environment.
Add Playwright installation to bin/dup for initial setup.
Ensures new developers have browsers installed.
Add Playwright browser installation to GitHub Actions:
- Cache browsers at ~/.cache/ms-playwright (~100MB)
- Install browsers and deps on cache miss
- Only install system deps on cache hit
- Set PLAYWRIGHT_HEADLESS=true for CI runs
Document Playwright as JavaScript driver.
Add instructions for debugging and cross-browser testing.
@mroderick
Copy link
Collaborator Author

Anecdotal benchmarks from running time bundle exec rspec on an M4 MacBook Air.

Before

real	2m50.943s
user	2m14.238s
sys	0m18.994s

Intermittent failures

After

real	2m33.875s
user	2m8.596s
sys	0m15.587s

No failures

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