From 7345cebd20f4308ff76e741721a718d1a75cb2fd Mon Sep 17 00:00:00 2001 From: naporin0624 Date: Wed, 25 Dec 2024 07:18:00 +0000 Subject: [PATCH] chore: mask image test-runner --- .storybook/test-runner.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.storybook/test-runner.ts b/.storybook/test-runner.ts index 135d76fa1..ff4b4c123 100644 --- a/.storybook/test-runner.ts +++ b/.storybook/test-runner.ts @@ -29,8 +29,15 @@ const vrtTestConfig: TestRunnerConfig = { async postVisit(page, context) { await waitForPageReady(page) await page.waitForTimeout(200) + const root = await page.$('#storybook-root') + if (!root) { + throw new Error('Root element not found') + } - const image = await page.screenshot() + const image = await root.screenshot({ + animations: 'disabled', + mask: [page.locator('img')], + }) expect(image).toMatchImageSnapshot({ customSnapshotIdentifier: context.id, customDiffDir: `${process.cwd()}/__diff_output__`,