-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(accessibility-testing): create accessibility testing guide for Java #16107
Conversation
Requesting review from @dgozman since he reviewed the related #15154. /cc @debs-obrien |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, let's update the fixtures section to be more self contain instead of referring to TestFixture class which is not a part of Playwright Java at the moment.
### Example 1: Scanning an entire page | ||
|
||
This example demonstrates how to test an entire page for automatically detectable accessibility violations. The test: | ||
1. Imports the `com.deque.html.axe-core/playwright` package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it: linkify the package reference?
public class HomepageTests { | ||
@Test // 2 | ||
void shouldNotHaveAutomaticallyDetectableAccessibilityIssues() throws Exception { | ||
Playwright playwright = Playwright.create(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrap it into try (Playwright playwright = Playwright.create()) {
to ensure that playwright is closed after running the test.
|
||
## Using a test fixture for common axe configuration | ||
|
||
A [`TestFixtures` class](./test-runners#running-tests-in-parallel) is a good way to share common `AxeBuilder` configuration across many tests. Some scenarios where this might be useful include: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playwright Java currently doesn't provide standard fixtures (with page, context, browser etc objects) and the reference to the test runner section may be confusing. We may add such fixtures in the future (discussed this just today in the team meeting) but before that perhaps it's better to just recommend moving the code into a shared utility method and have the callsite pass page
as an explicit argument makeAxeBuilder(page)
?
This continues the (Accessibility Insights) team's progress towards #14112, and focuses on adding a new "Accessibility testing" guide for Java.
We plan to follow a similar approach to #15154, and once we're all satisfied with the documentation changes, our team can create a PR in the Playwright.dev repo to add this to the relevant sidebar.
We tested that
npm run doc
passes, per theCONTRIBUTING.MD
file for this repo.