Fix support for Capybara Playwright driver#36
Draft
gasi wants to merge 2 commits intothoughtbot:mainfrom
Draft
Conversation
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.
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
Fixes support for the Capybara Playwright driver by addressing two compatibility issues:
Driver resolution timing: The
pageobject was being bound too early during test setup, capturing theRackTest::Driverinstead of the actual driver (e.g.,Playwright::Driver) used at runtime.Symbol serialization: Playwright's
evaluate_async_scriptcannot 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.