What's the general level of support and development that is planned for the test runner? Will attempts be made to bring it up to speed with the reliability and speed that StoryShots had?
I ask because it seems like the community is currently scrambling to make the test runner run reliably, in order to replace StoryShots, while PRs on the project are not being reviewed or merged.
The snapshot tester is extremely flaky, and I had to take a bunch of measures to stabilise it, before it would run deterministically with co-workers, even though we run it in a docker container. Sometimes snapshots would even show two entirely unrelated stories overlapping in a single snapshot.
We now appear to have been able to stabilise the snapshot tester using three measures we found through experimentation and that of others through GitHub issues:
async preRender(page, context) {
// Prevent one story's context from bleeding into the next test run
await getStoryContext(page, context);
},
Before taking any snapshots, in postRender():
// Make sure assets (images, fonts) are loaded and rendered
await page.waitForLoadState('domcontentloaded')
await page.waitForLoadState('load')
await page.waitForLoadState('networkidle');
await page.waitForFunction(() =>
document.readyState === 'complete'
&& document.fonts.ready
// naturalWidth will be zero if image file is not loaded.
// Fixes flakiness of images in the snapshots.
&& ![...document.images].some(
({ naturalWidth, loading }) => !naturalWidth && loading !== 'lazy'
)
);
And setting --maxWorkers=5 on the test runner itself.
Questions:
- Can above measures be incorporated into the test runner somehow?
- Will PRs be reviewed and merged?
- Can the decommissioning of StoryShots and the documentation of the test runner be prioritized so that everyone knows this is the way forward, and users don't spend time try to get StoryShots to run?