From 144af95569016f8a40acf0bce61e77574e75e670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20de=20Fran=C3=A7a?= <448801+fernandofranca@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:57:46 +0200 Subject: [PATCH] feat(pie-lottie-player): DSW-2365 update visual test --- .../test/component/pie-lottie-player.spec.ts | 2 +- .../test/{component => }/courier.json | 0 .../test/visual/pie-lottie-player.spec.ts | 11 ++++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) rename packages/components/pie-lottie-player/test/{component => }/courier.json (100%) diff --git a/packages/components/pie-lottie-player/test/component/pie-lottie-player.spec.ts b/packages/components/pie-lottie-player/test/component/pie-lottie-player.spec.ts index 9802f2686c..48dd68d78f 100644 --- a/packages/components/pie-lottie-player/test/component/pie-lottie-player.spec.ts +++ b/packages/components/pie-lottie-player/test/component/pie-lottie-player.spec.ts @@ -3,7 +3,7 @@ import { readFile } from 'fs/promises'; import { test, expect } from '@sand4rt/experimental-ct-web'; import { PieLottiePlayer, LottiePlayerProps } from '../../src/index.ts'; -const animationData = JSON.parse(await readFile(new URL('./courier.json', import.meta.url), { encoding: 'utf-8' })); +const animationData = JSON.parse(await readFile(new URL('../courier.json', import.meta.url), { encoding: 'utf-8' })); const componentSelector = 'pie-lottie-player'; diff --git a/packages/components/pie-lottie-player/test/component/courier.json b/packages/components/pie-lottie-player/test/courier.json similarity index 100% rename from packages/components/pie-lottie-player/test/component/courier.json rename to packages/components/pie-lottie-player/test/courier.json diff --git a/packages/components/pie-lottie-player/test/visual/pie-lottie-player.spec.ts b/packages/components/pie-lottie-player/test/visual/pie-lottie-player.spec.ts index a5050e9cca..e1f7dbd7ba 100644 --- a/packages/components/pie-lottie-player/test/visual/pie-lottie-player.spec.ts +++ b/packages/components/pie-lottie-player/test/visual/pie-lottie-player.spec.ts @@ -1,14 +1,23 @@ +import { readFile } from 'fs/promises'; import { test } from '@sand4rt/experimental-ct-web'; import percySnapshot from '@percy/playwright'; import { PieLottiePlayer, LottiePlayerProps } from '../../src/index.ts'; +const animationData = JSON.parse(await readFile(new URL('../courier.json', import.meta.url), { encoding: 'utf-8' })); + test.describe('PieLottiePlayer - Visual tests`', () => { test('should display the PieLottiePlayer component successfully', async ({ page, mount }) => { await mount(PieLottiePlayer, { - props: {} as LottiePlayerProps, + props: { + animationData, + } as LottiePlayerProps, }); + // Ensure to snapshot always the first frame + page.locator('pie-lottie-player') + .evaluate((el:PieLottiePlayer) => el.stop()); + await percySnapshot(page, 'PieLottiePlayer - Visual Test'); }); });