-
Notifications
You must be signed in to change notification settings - Fork 16
feat(plugin-axe): implement core plugin functionality #1141
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
base: main
Are you sure you want to change the base?
Conversation
|
View your CI Pipeline Execution ↗ for commit 6d66b16
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/nx-plugin
@code-pushup/axe-plugin
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
@code-pushup/models-transformers
commit: |
3680cce to
e4e390f
Compare
e4e390f to
72fc042
Compare
feat(plugin-axe): implement runner with Playwright/Axe integration
c8c6dd5 to
972b3f1
Compare
972b3f1 to
6d66b16
Compare
matejchalk
left a comment
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.
Very good overall 👍 I have some suggestions, but nothing major. I like that you were able to reuse a lot of logic and data types from the Lighthouse plugin.
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.
Running Axe accessibility checks for 1 URL(s)...
Axe execution failed for https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/: browserType.launch: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ npx playwright install ║
║ ║
║ <3 Playwright Team ║
╚═════════════════════════════════════════════════════════════════════════╝
browserType.launch: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ npx playwright install ║
║ ║
║ <3 Playwright Team ║
╚═════════════════════════════════════════════════════════════════════════╝
I'm guessing running npx playwright install beforehand will fix the error.
I wonder if it would make sense for the plugin itself to run this command. 🤔 Or should we leave it up to the user? In my limited experience with Playwright, forgetting to run playwright install is a common mistake when adding E2E tests to CI. I'm not sure if it can be done in a cache-friendly way, though. Something like my ts-patch solution from #1133 would be ideal.
| @@ -0,0 +1,5 @@ | |||
| import { createE2ETestConfig } from '../../testing/test-setup-config/src/index.js'; | |||
|
|
|||
| export default createE2ETestConfig('ci-e2e', { | |||
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.
| export default createE2ETestConfig('ci-e2e', { | |
| export default createE2ETestConfig('plugin-axe-e2e', { |
| it('should throw for invalid URL', () => { | ||
| expect(() => pluginUrlsSchema.parse('not-a-url')).toThrow(); | ||
| }); | ||
|
|
||
| it('should throw for array with invalid URL', () => { | ||
| expect(() => | ||
| pluginUrlsSchema.parse(['https://example.com', 'invalid']), | ||
| ).toThrow(); | ||
| }); |
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.
You could also test invalid weights and URLs in the object.
| const audit = transformRulesToAudits( | ||
| loadAxeRules('wcag21aa'), | ||
| )[0] as Audit; |
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.
Casting via non-null assertion is preferable, because it's safer (only strips null/undefined, while as T may ignore type mismatches than intended) and less verbose.
| const audit = transformRulesToAudits( | |
| loadAxeRules('wcag21aa'), | |
| )[0] as Audit; | |
| const audit = transformRulesToAudits(loadAxeRules('wcag21aa'))[0]!; |
|
|
||
| | Property | Type | Default | Description | | ||
| | -------------- | ----------- | ------------ | ----------------------------------------- | | ||
| | `preset` | `AxePreset` | `'wcag21aa'` | Accessibility ruleset preset | |
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.
A link to the Preset details section would be useful here.
Closes #1134