-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Storybook extension/query through iframe support #333
Comments
Helpful workaround in the meantime that I just learned - you can append Using the example link: https://next--storybookjs.netlify.app/official-storybook/iframe.html?path=/story/addons-a11y-basebutton--label |
Hi, it would be great to autodetect a few typical frameworks (something that stays maintainable) when an iframe is present, and consider the "screen" to be this iframe and not the whole screen. What would be required to consider an iframe as the "screen" on a technical standpoint? I could try to get help for crafting a PR. I've raised attention to this point at Storybook, because the new testing capabilities of Storybook will make this use case more and more relevant in the incoming releases. I haven't found much doc about testing an iframe either (only this ticket for Enzyme https://stackoverflow.com/questions/41447842/test-the-content-of-an-iframe-in-a-react-component-with-enzyme) In the meantime much thanks for the workaround @melanieseltzer |
I don't think we need to support a few typical frameworks. What we need to support is the following:
That would add support to frameworks like Cypress and Storybook out of the box. |
Unfortunately, I've been short on time lately. So if anyone is willing to take a stab at that, please do. |
Being able to reference elements in an iframe would be amazing. |
@melanieseltzer Thank you for sharing this! This is a great workaround. |
Summary 💡
I've mainly come across this tool through the chrome extension, which is great!
It would be even better if it could support being used against storybook - our stories often match the components we're trying to render in unit tests, so it would hopefully be able to suggest very relevant selectors.
I suspect the issue is because storybook embeds the actual story (which is what I want to look at) in an iframe?
One option would be to build a storybook extension (although doing the selector mode from the chrome extension might be hard). Another would be to allow the root document to be specified for the chrome extension (e.g. I could set it to
#storybook-preview-iframe
and it would then run queries etc inside the storybook preview).Examples 🌈
https://next--storybookjs.netlify.app/official-storybook/?path=/story/addons-a11y-basebutton--label is one of storybook's examples - with the chrome extension, you can't find anything inside the storybook preview.
Motivation 🔦
Our stories often match the components we're trying to render in unit tests, so it would hopefully be able to suggest very relevant selectors.
The text was updated successfully, but these errors were encountered: