After implementing the Preconfiguring viewport size recipe, we faced an issue with StorybookTestRunner not being present in the userAgent
so the StorybookTestRunner check fails:
Checking for the StorybookTestRunner in preVisit shows that it's not present in the userAgent only for the first pass(story) in the suit. But it becomes a part of the userAgent for the subsequent stories.
async preVisit(page, story) {
// Uncomment the following line to see console logs from the browser
page.on('console', (msg) => console.log(msg.text()))
await page.evaluate((context) => {
const isTestRunner =
window.navigator.userAgent.match(/StorybookTestRunner/)
console.log(isTestRunner)
})
}
Describe the bug
After implementing the Preconfiguring viewport size recipe, we faced an issue with StorybookTestRunner not being present in the userAgent so the
StorybookTestRunner
check fails:To Reproduce
To reproduce the issue, it's enough to call
getStoryContext(page, story)
in thepreVisit
Then run tests for the stories containing components with isTestRunner check:
System
Additional context
Checking for the StorybookTestRunner in
preVisit
shows that it's not present in theuserAgent
only for the first pass(story) in the suit. But it becomes a part of theuserAgent
for the subsequent stories.