-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kezhik Kyzyl-ool <[email protected]>
- Loading branch information
Showing
97 changed files
with
3,099 additions
and
271 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,3 @@ jobs: | |
run: npm ci | ||
- name: Unit Tests | ||
run: npm run test | ||
|
This file contains 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
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 |
This file contains 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
This file contains 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
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; |
Oops, something went wrong.