-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Storyshots: Add beforeAxeTest
hook
#14563
Conversation
Implements feature in storybookjs#14536.
beforeAxeTest
per feature request #14536
Would it be possible to get feedback on this PR? Thanks! |
beforeAxeTest
per feature request #14536beforeAxeTest
hook
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.
LGTM!!!
beforeAxeTest
hookbeforeAxeTest
hook
export const axeTest = (customConfig: Partial<AxeConfig> = {}) => { | ||
const config = { ...defaultAxeConfig, ...customConfig }; | ||
const { beforeAxeTest } = config; | ||
|
||
puppeteerTest({ |
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.
Did it actually work for you @coreyjv? I'm asking because the result of puppeteerTest
is no longer returned, so instead of AXE it runs the default snapshot tests.
Ideally, we would catch that on CI, but unfortunately the corresponding GitHub Action was eventually removed:
9be0706
@ndelangen do you remember what exactly wasn't functioning back then?
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.
I'm sorry about that mistake @Hypnosphi! I didn't realize that this wouldn't be caught by CI. I can open another PR to address this if you'd like.
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.
No problem, I'm working on another PR for the same package, so I'll just include the fix there
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.
@Hypnosphi -- PR created to address the regression here: #15005
Again my apologies for not catching this the first time.
The regression prevented Axe tests from being run and instead the default snapshots were being used. This was due to a missing `return` statement that I overlooked in the original source because of the implicit return.
Issue: #14536
What I did
Per #14536 I added a method named
beforeAxeTest
that is executed before the axe tests are run.How to test
I did not see any test suites for
imageSnapshot
oraxeTest
. If I missed them please let me know and I'll add the necessary tests.