-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[NOT MERGE] PoC: Storybook a11y testing in CI #217434
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
Closed
Closed
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
724a846
PoC: Storybook a11y testing in CI
smith c28be56
don't change this one
smith b9f020b
idk
smith fb72f54
add skip tags to test-runner config and stories
MiriamAparicio e5fba40
disable test failures for a11y checks
MiriamAparicio 12f70d4
wip
MiriamAparicio ef22f58
disable failing a11y tests
MiriamAparicio 04ccb68
fix conflict
MiriamAparicio 2dead19
add pipeline to run storybook test in CI
MiriamAparicio d9adc39
bootstrapping on the script
MiriamAparicio 86075b8
Merge remote-tracking branch 'upstream/main' into nls/sb-a11y
MiriamAparicio 407a24f
fix package.json
MiriamAparicio 45eb361
Merge remote-tracking branch 'upstream/main' into nls/sb-a11y
MiriamAparicio ff5528c
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine fabb8f7
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine e9f6645
add storybook test_runner.ts to tsconfig.json
MiriamAparicio 9a826f2
fix merrge conflicts
MiriamAparicio 028bcf9
fix merrge conflicts
MiriamAparicio 82b9271
test to see storybook test fail in CI first checks
MiriamAparicio 7afd4fd
test to see storybook test fail in CI first checks, second attempt
MiriamAparicio 4868e89
fix conflicts yarn.lock
MiriamAparicio e8cf499
fix conflicts yarn.lock
MiriamAparicio de9b8cf
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine de8d929
[CI] Auto-commit changed files from 'ts-node .buildkite/pipeline-reso…
kibanamachine 8938eec
Merge remote-tracking branch 'upstream/main' into nls/sb-a11y
Ikuni17 1565c40
move storybook tests
Ikuni17 579802b
add alias, port and modify url
MiriamAparicio 1d52186
remove flag --port
MiriamAparicio 5152bd6
increase wait time for storybook to run before running tests
MiriamAparicio 4ba96f3
fix yarn.lock conflicts
MiriamAparicio a8f9305
try different approach to wait for storybook to be ready
MiriamAparicio c1a14fe
Merge remote-tracking branch 'upstream/main' into nls/sb-a11y
MiriamAparicio f3fbed4
change port to 9001
MiriamAparicio 4820b44
changes in storybook_test.sh
MiriamAparicio 3c6311e
[CI] Auto-commit changed files from 'ts-node .buildkite/pipeline-reso…
kibanamachine da79e80
Merge branch 'main' into nls/sb-a11y
smith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,17 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| .buildkite/scripts/bootstrap.sh | ||
|
|
||
| echo "Starting Storybook server..." | ||
| yarn storybook apm & | ||
| STORYBOOK_PID=$! | ||
|
|
||
| echo "Waiting for Storybook to be ready..." | ||
| sleep 60 | ||
|
|
||
| echo "Running Storybook tests..." | ||
| yarn test:storybook --url "$STORYBOOK_URL" | ||
|
|
||
| kill $STORYBOOK_PID | ||
This file contains hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
x-pack/solutions/observability/plugins/apm/.storybook/test-runner.ts
This file contains hidden or 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,36 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| import { getStoryContext, type TestRunnerConfig } from '@storybook/test-runner'; | ||
| import { injectAxe, checkA11y } 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 = { | ||
| tags: { | ||
| skip: ['skip-test'], | ||
| }, | ||
| async preVisit(page) { | ||
| await injectAxe(page); | ||
| }, | ||
| async postVisit(page, context) { | ||
| const storyContext = await getStoryContext(page, context); | ||
| // // Do not run a11y tests on disabled stories. | ||
| if (storyContext.parameters?.a11y?.disable) { | ||
| return; | ||
| } | ||
| await checkA11y(page, 'body', { | ||
| detailedReport: true, | ||
| detailedReportOptions: { | ||
| html: true, | ||
| }, | ||
| }); | ||
| }, | ||
| }; | ||
| // eslint-disable-next-line import/no-default-export | ||
| export default config; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If we're going to be waiting for a server to be available we should do it by polling the server until it's ready, rather than waiting 60s no matter what. Probably just by putting
curlwith aHEADrequest in a while loop.