Skip to content

Comments

Fix support for Capybara Playwright driver#36

Draft
gasi wants to merge 2 commits intothoughtbot:mainfrom
collegevine:playwright-fixes
Draft

Fix support for Capybara Playwright driver#36
gasi wants to merge 2 commits intothoughtbot:mainfrom
collegevine:playwright-fixes

Conversation

@gasi
Copy link

@gasi gasi commented Jan 28, 2026

Summary

Fixes support for the Capybara Playwright driver by addressing two compatibility issues:

  1. Driver resolution timing: The page object was being bound too early during test setup, capturing the RackTest::Driver instead of the actual driver (e.g., Playwright::Driver) used at runtime.

  2. Symbol serialization: Playwright's evaluate_async_script cannot serialize Ruby symbols, causing errors when passing axe-core configuration options like [:wcag2a, :wcag2aa].

Testing

These changes allow the Playwright driver to work correctly without affecting existing RackTest and Selenium driver support as tested on the CollegeVine Rails project.

gasi added 2 commits January 28, 2026 21:37
Pass page as a proc to avoid capturing the driver state at
initialization time. This ensures the correct driver (e.g., Playwright)
is used when running audits, rather than the driver present during test
setup (e.g., RackTest).
Use `.as_json` to convert context and options hashes before passing them
to Playwright’s evaluate_async_script. This prevents serialization
errors with Ruby symbols, which Playwright cannot handle.
@gasi gasi changed the title Fixes to support Playwright driver Fix support for Capybara Playwright driver Jan 28, 2026
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