Skip to content
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

Add WCAG PR check #274

Merged
merged 39 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
37874b6
Add WCAG PR check
nmanu1 Aug 2, 2022
8780aec
Automated update to THIRD-PARTY-NOTICES from github action's 3rd part…
github-actions[bot] Aug 2, 2022
a1c7241
Try sleeping
nmanu1 Aug 2, 2022
16c8437
Sleep longer
nmanu1 Aug 2, 2022
9882621
Fix wrong port and update package versions
nmanu1 Aug 2, 2022
4dc074b
Revert "Fix wrong port and update package versions"
nmanu1 Aug 2, 2022
931c341
Fix port and update some imports
nmanu1 Aug 2, 2022
e983c1e
Remove build
nmanu1 Aug 2, 2022
8dfe7c7
Remove extra steps
nmanu1 Aug 2, 2022
6012358
Bump some package versions
nmanu1 Aug 2, 2022
9fcac7f
Update more packages
nmanu1 Aug 2, 2022
cd16587
Bump a11y
nmanu1 Aug 2, 2022
fe13233
Bump actions
nmanu1 Aug 2, 2022
b7d9c6e
Bump links to 6.5.0
nmanu1 Aug 2, 2022
ea9fa1c
Upgrade percy
nmanu1 Aug 2, 2022
bfaae61
Bump links to 6.5.9
nmanu1 Aug 2, 2022
301c281
Try smoke-test
nmanu1 Aug 3, 2022
1123603
Revert "Try smoke-test"
nmanu1 Aug 3, 2022
1c0172f
Try bash script
nmanu1 Aug 3, 2022
6402c37
Try wrapping script
nmanu1 Aug 3, 2022
a7c0dbc
Try one long line
nmanu1 Aug 3, 2022
8bc9017
Remove |
nmanu1 Aug 3, 2022
4e77d97
Semicolons
nmanu1 Aug 3, 2022
6110549
Shorten
nmanu1 Aug 3, 2022
5e59685
Update packages and use TS
nmanu1 Aug 4, 2022
022bf2a
Upgrade percy/storybook
nmanu1 Aug 4, 2022
740ae60
Format and make quiet
nmanu1 Aug 4, 2022
cc9c956
Export default
nmanu1 Aug 4, 2022
e23d88c
Merge branch 'main' into dev/wcag-pr-check
nmanu1 Aug 4, 2022
5043813
Reuse script
nmanu1 Aug 4, 2022
ee5e7cf
Fix paths
nmanu1 Aug 4, 2022
7bd00a5
Try npm run command
nmanu1 Aug 4, 2022
212892a
oops
nmanu1 Aug 4, 2022
174bcba
Try some TS
nmanu1 Aug 4, 2022
074458d
Revert "Try some TS"
nmanu1 Aug 4, 2022
2fadcdd
Fix spacing
nmanu1 Aug 4, 2022
14ca6f8
Add asterisk
nmanu1 Aug 4, 2022
31f31fa
Abstract out wcag config
nmanu1 Aug 4, 2022
8e581aa
Update package-lock
nmanu1 Aug 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/wcag_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: WCAG tests

on:
pull_request:
branches:
- main

jobs:
call_wcag_test:
uses: yext/slapshot-reusable-workflows/.github/workflows/wcag_test.yml@v1
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
build_script: ./tests/scripts/start-storybook.sh
6 changes: 2 additions & 4 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './index.css';
import { SearchCoreDecorator } from '../tests/__fixtures__/core/SearchCore';
import { runOnly } from './wcagConfig';

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand All @@ -12,10 +13,7 @@ export const parameters = {
},
a11y: {
options: {
runOnly: {
type: 'tag',
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']
}
runOnly
}
},
options: {
Expand Down
29 changes: 29 additions & 0 deletions .storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { injectAxe, checkA11y } from 'axe-playwright';
import { Page } from 'playwright-core';
import { runOnly } from './wcagConfig';

/**
* See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
* to learn more about the test-runner hooks API.
*/
const renderFunctions = {
async preRender(page: Page) {
await injectAxe(page);
},
async postRender(page: Page, context) {
await checkA11y(page, '#root', {
axeOptions: {
runOnly,
rules: {
'color-contrast': { enabled: context.name !== 'Loading' }
},
},
detailedReport: true,
detailedReportOptions: {
html: true,
},
});
},
};

export default renderFunctions;
6 changes: 6 additions & 0 deletions .storybook/wcagConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { axeOptionsConfig } from 'axe-playwright';
nmanu1 marked this conversation as resolved.
Show resolved Hide resolved

export const runOnly: axeOptionsConfig['axeOptions']['runOnly'] = {
type: 'tag',
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']
};
Loading