You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I am trying to achieve is to use one of the existing hooks from test runners to set the globals before rendering the story based on these configured parameters, the solution I've found out so far was to read current page URL and set the globals using query parameter, but that brings a lot of overhead since for each language the page needs to be reloaded:
// test-runner.tsconstconfig: TestRunnerConfig={tags: {include: ['visual-tests'],},setup: ()=>{expect.extend({toMatchImageSnapshot})},preRender: async(page,context)=>{constpageContext=awaitgetStoryContext(page,context)constlanguages=pageContext.parameters.i18n.visualTestsfor(constlangoflanguages){constnewUrl=newURL(page.url())newUrl.searchParams.set('globals',`locale:${lang}`)// Refreshing the whole page on every language doesn't seem a good ideaawaitpage.goto(newUrl.toString())constimage=awaitpage.screenshot({fullPage: true,animations: 'disabled',})expect(image).toMatchImageSnapshot()}},}
Describe the solution you'd like
What would be the best way to set these globals for the story before it's rendered based on these parameters?
Not to mention we are going to have multiple breakpoints too, which could exponentially increase test timeouts.
Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
no
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Hey all,
I've been using a decorator + global types to support locales on our stories:
In the stories we allow to define supported languages for visual regression tests:
What I am trying to achieve is to use one of the existing hooks from test runners to set the globals before rendering the story based on these configured parameters, the solution I've found out so far was to read current page URL and set the globals using query parameter, but that brings a lot of overhead since for each language the page needs to be reloaded:
Describe the solution you'd like
What would be the best way to set these globals for the story before it's rendered based on these parameters?
Not to mention we are going to have multiple breakpoints too, which could exponentially increase test timeouts.
Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
no
Additional context
No response
The text was updated successfully, but these errors were encountered: