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

ci: a11y addon in storybook #1351

Merged
merged 42 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7341236
feat: a11y issues detector
Feb 9, 2024
e662fbb
feat: adding title prop for Select, additional titles in stories
Feb 12, 2024
a2c81cc
feat: added switch role for `Switch`
Feb 12, 2024
6555ac4
fix: additional labels for icon buttons
Feb 12, 2024
0b83522
fix: more image labels
Feb 12, 2024
b5240a7
feat: added labels for table and alert buttons, provided ariaLabel pr…
Feb 12, 2024
e97739a
feat: added `open` argument to the trigger children function
Feb 12, 2024
8f1a42a
fix: more labels
Feb 12, 2024
0d89d8f
fix: configuring axe in storybook test runner
Feb 13, 2024
6aed079
fix: fixing stories a11y
Feb 13, 2024
52f5e4a
feat: aria-label prop for ListWithDnd and RecursiveList
Feb 13, 2024
ac5bca5
fix: more a11y issues
Feb 15, 2024
ad5914b
fix: allowing to pass avatar props for email UserLabel
Feb 15, 2024
aa733a0
feat: added test-storybook:ci script
Feb 15, 2024
1b96691
feat: added ci runs
Feb 15, 2024
9cc5560
fix: remove with
Feb 15, 2024
ac0d3b8
fix: tests
Feb 15, 2024
ce425b2
fix: adding playwright install
Feb 15, 2024
fd2e279
fix: focus for error text
Feb 15, 2024
350967c
fix: some minor fixes
Feb 15, 2024
62b1e30
fix: slider a11y checks
Mar 4, 2024
fe9c432
fix: table and tree select a11y
Mar 4, 2024
8c4922e
fix: showcase labels
Mar 4, 2024
4f35d0f
fix: using double quotes in jsx syntax
Mar 5, 2024
4e710bf
fix: remove redundant props for user component
Mar 5, 2024
8e4384c
fix: use aria-labelledby
Mar 5, 2024
e642aef
fix: using ready preview for sb tests
Mar 5, 2024
31619ff
fix: remove unused packages
Mar 12, 2024
2362ce5
fix: change workflow
Mar 12, 2024
9268e3a
fix: add checkout
Mar 12, 2024
1b1c646
fix: wait on job
Mar 12, 2024
24a9278
fix: another job
Mar 13, 2024
1901f72
fix: playwright tests are waiting for preview deployed
Mar 13, 2024
3df6588
fix: return to the old naming
Mar 13, 2024
c180006
fix: revert
Mar 13, 2024
fefd322
fix: revert alt prop for user component
Mar 13, 2024
93d16fb
fix: treelist fix a11y
Mar 19, 2024
84ac0c1
fix: treelist a11y fixes
Mar 19, 2024
0ff4cb0
fix: fixing review issues
Mar 21, 2024
0f94500
fix: rename file
Mar 21, 2024
66e4a9b
Merge branch 'main' into feat/a11y-storybook-addon
Kyzyl-ool Mar 21, 2024
a8f7606
Merge branch 'main' into feat/a11y-storybook-addon
Kyzyl-ool Mar 22, 2024
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true

[{*.json, *.yaml, *.yml}]
[{*.json,*.yaml,*.yml}]
indent_size = 2

[*.md]
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ jobs:
run: npm ci
- name: Unit Tests
run: npm run test

25 changes: 25 additions & 0 deletions .github/workflows/pr-storybook-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Storybook Tests

on:
workflow_run:
workflows: ['PR Preview Deploy']
types:
- completed

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Storybook Tests
env:
PR_PREVIEW_URL: "https://preview.gravity-ui.com/uikit/${{github.event.pull_request.number}}"
run: npm run test-storybook
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const config: StorybookConfig = {
'@storybook/preset-scss',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
'./theme-addon/register.tsx',
'@storybook/addon-a11y',
],
};

Expand Down
31 changes: 31 additions & 0 deletions .storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type {TestRunnerConfig} from '@storybook/test-runner';
import {getStoryContext} from '@storybook/test-runner';
import {checkA11y, configureAxe, injectAxe} from 'axe-playwright';

/*
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api
* to learn more about the test-runner hooks API.
*/
const config: TestRunnerConfig = {
async preVisit(page) {
await injectAxe(page);
},
async postVisit(page, context) {
// Get the entire context of a story, including parameters, args, argTypes, etc.
const storyContext = await getStoryContext(page, context);

// Apply story-level a11y rules
await configureAxe(page, {
rules: storyContext.parameters?.a11y?.config?.rules,
});

await checkA11y(page, '#storybook-root', {
detailedReport: true,
detailedReportOptions: {
html: true,
},
});
},
};

export default config;
Loading
Loading