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
Is your feature request related to a problem? Please describe.
When running tests against image snapshots, I often come across discrepancies that stem from animated parts being in different phases.
Things like charts, graphs and even animated modals, can be phased out from the original snapshot which causes it to fail due to a too big of a difference
Describe the solution you'd like @playwright/test has a solution where they allow you to disable animation in the following manner
animations "disabled"|"allow" (optional)
When set to "disabled", stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:
finite animations are fast-forwarded to completion, so they'll fire transitionend event.
infinite animations are canceled to initial state, and then played over after the screenshot.
Defaults to "disabled" that disables animations.
Describe alternatives you've considered
Currently, I've implemented a sleep function that waits for all animations to be exhausted, which for obvious reasons, makes testing very slow:
constsleep=(ms: number)=>newPromise((resolve)=>setTimeout(()=>resolve(void0),ms));constconfig: TestRunnerConfig={setup(){// using jest-image-snapshotexpect.extend({ toMatchImageSnapshot });},asyncpostRender(page,context){constelementHandler=awaitpage.$("#storybook-root");if(!elementHandler)thrownewError("No strybook root found");// no reason for this atm tbhawaitpage.waitForLoadState("networkidle");// waiting for animations to completeawaitsleep(3000);constimage=awaitpage.screenshot();expect(image).toMatchImageSnapshot({
customDiffDir,customSnapshotIdentifier: context.id,failureThreshold: 0.01,failureThresholdType: "percent",});},};
Additional context
I'd love your advice on alternative implementations, even if this feature is currently missing or not planned.
The text was updated successfully, but these errors were encountered:
Unfortuantely, not all JS animations will respect this, so you'll have to refer to their docs. React MUI for instance requires passing overrides to the ThemeProvider.
Is your feature request related to a problem? Please describe.
When running tests against image snapshots, I often come across discrepancies that stem from animated parts being in different phases.
Things like charts, graphs and even animated modals, can be phased out from the original snapshot which causes it to fail due to a too big of a difference
Describe the solution you'd like
@playwright/test has a solution where they allow you to disable animation in the following manner
Describe alternatives you've considered
Currently, I've implemented a sleep function that waits for all animations to be exhausted, which for obvious reasons, makes testing very slow:
Additional context
I'd love your advice on alternative implementations, even if this feature is currently missing or not planned.
The text was updated successfully, but these errors were encountered: