diff --git a/playwright/README.md b/playwright/README.md index 75fb1ff1a5..92ff78b6c3 100644 --- a/playwright/README.md +++ b/playwright/README.md @@ -6,34 +6,72 @@ 2. Inside the component folder, create the `__tests__` folder and create a file inside it with the following name `.visual.test.tsx` 3. Writing a test: + Capture a screenshot, by default in light theme only: + ```ts import React from 'react'; import {expect} from '@playwright/experimental-ct-react'; - import {MyTestedComponent} from '../MyTestedComponent'; + import {MyComponent} from '../MyComponent'; import {test} from '~playwright/core'; - test('Name test', async ({mount}) => { - //mounting a component - const component = await mount(); + test('test description', async ({mount}) => { + // mount the component + const component = await mount(); - //screenshot + // capture the screenshot await expect(component).toHaveScreenshot(); }); ``` -Group of tests. + You can also capture screenshots both in dark and light themes: + + ```ts + import React from 'react'; + + import {MyComponent} from '../MyComponent'; + + import {test} from '~playwright/core'; + + test('test description', async ({mount, expectScreenshot}) => { + // mount the component + await mount(); + + // capture the screenshot + await expectScreenshot(); + }); + ``` + + If you need to do any actions with the component: + + ```ts + import React from 'react'; + + import {MyComponent} from '../MyComponent'; + + import {test} from '~playwright/core'; + + test('test description', async ({mount, expectScreenshot}) => { + // mount the component + const component = await mount(); + + // capture the screenshot + await expectScreenshot({component}); + }); + ``` + + Group of tests. -```ts -test.describe('Name group tests', () => { - test('1', ...); - test('2', ...); - ... - test('10', ...) -}); -``` + ```ts + test.describe('Name group tests', () => { + test('1', ...); + test('2', ...); + ... + test('10', ...) + }); + ``` 4. Run tests @@ -52,15 +90,15 @@ test.describe('Name group tests', () => { 5. Update screenshots if needed -```shell -npm run playwright:update -``` + ```shell + npm run playwright:update + ``` -Or + Or -```shell -npm run playwright:docker:update -``` + ```shell + npm run playwright:docker:update + ``` 6. In the folder `__snapshots__`, which is on the same level as the `__tests__` folder, the folder `.visual.test.tsx-snapshots`, will contain screenshots diff --git a/playwright/core/expectScreenshotFixture.ts b/playwright/core/expectScreenshotFixture.ts new file mode 100644 index 0000000000..2413840788 --- /dev/null +++ b/playwright/core/expectScreenshotFixture.ts @@ -0,0 +1,40 @@ +import {expect} from '@playwright/experimental-ct-react'; + +import type {ExpectScreenshotFixture, PlaywrightFixture} from './types'; + +export const expectScreenshotFixture: PlaywrightFixture = async ( + {page}, + use, + testInfo, +) => { + const expectScreenshot: ExpectScreenshotFixture = async ({ + component, + screenshotName, + ...pageScreenshotOptions + } = {}) => { + const captureScreenshot = async (theme: string) => { + const root = page.locator('#root'); + + await root.evaluate((el, newTheme) => { + el.setAttribute('class', `g-root g-root_theme_${newTheme}`); + }, theme); + + return (component || page.locator('.playwright-wrapper-test')).screenshot({ + animations: 'disabled', + ...pageScreenshotOptions, + }); + }; + + const nameScreenshot = testInfo.titlePath.slice(1).join(' '); + + expect(await captureScreenshot('dark')).toMatchSnapshot({ + name: `${screenshotName || nameScreenshot} dark.png`, + }); + + expect(await captureScreenshot('light')).toMatchSnapshot({ + name: `${screenshotName || nameScreenshot} light.png`, + }); + }; + + await use(expectScreenshot); +}; diff --git a/playwright/core/index.ts b/playwright/core/index.ts new file mode 100644 index 0000000000..62cc1fe8cd --- /dev/null +++ b/playwright/core/index.ts @@ -0,0 +1,10 @@ +import {test as base} from '@playwright/experimental-ct-react'; + +import {expectScreenshotFixture} from './expectScreenshotFixture'; +import {mountFixture} from './mountFixture'; +import type {Fixtures} from './types'; + +export const test = base.extend({ + mount: mountFixture, + expectScreenshot: expectScreenshotFixture, +}); diff --git a/playwright/core/index.tsx b/playwright/core/index.tsx deleted file mode 100644 index 8b35c20c20..0000000000 --- a/playwright/core/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; - -import type {JsonObject} from '@playwright/experimental-ct-core/types/component'; -import {ComponentFixtures, MountOptions, test as base} from '@playwright/experimental-ct-react'; - -type MountFixtures = { - mount: ComponentFixtures['mount']; -}; - -export const test = base.extend({ - mount: async ({mount: baseMount}, use) => { - const mount = async ( - component: JSX.Element, - options?: MountOptions | undefined, - ) => { - return await baseMount( -
- {component} -
, - options, - ); - }; - - await use(mount); - }, -}); diff --git a/playwright/core/mountFixture.tsx b/playwright/core/mountFixture.tsx new file mode 100644 index 0000000000..0c285050cf --- /dev/null +++ b/playwright/core/mountFixture.tsx @@ -0,0 +1,25 @@ +import React from 'react'; + +import type {JsonObject} from '@playwright/experimental-ct-core/types/component'; +import type {MountOptions} from '@playwright/experimental-ct-react'; + +import type {MountFixture, PlaywrightFixture} from './types'; + +export const mountFixture: PlaywrightFixture = async ({mount: baseMount}, use) => { + const mount = async ( + component: JSX.Element, + options?: MountOptions | undefined, + ) => { + return await baseMount( +
+ {component} +
, + options, + ); + }; + + await use(mount); +}; diff --git a/playwright/core/types.ts b/playwright/core/types.ts new file mode 100644 index 0000000000..0df0358b8a --- /dev/null +++ b/playwright/core/types.ts @@ -0,0 +1,31 @@ +import type {ComponentFixtures} from '@playwright/experimental-ct-react'; +import type { + Locator, + PageScreenshotOptions, + PlaywrightTestArgs, + PlaywrightTestOptions, + PlaywrightWorkerArgs, + PlaywrightWorkerOptions, + TestFixture, +} from '@playwright/test'; + +type PlaywrightTestFixtures = PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures; +type PlaywrightWorkerFixtures = PlaywrightWorkerArgs & PlaywrightWorkerOptions; +type PlaywrightFixtures = PlaywrightTestFixtures & PlaywrightWorkerFixtures; +export type PlaywrightFixture = TestFixture; + +export type Fixtures = { + mount: MountFixture; + expectScreenshot: ExpectScreenshotFixture; +}; + +export type MountFixture = ComponentFixtures['mount']; + +export interface ExpectScreenshotFixture { + (props?: CaptureScreenshotParams): Promise; +} + +interface CaptureScreenshotParams extends PageScreenshotOptions { + screenshotName?: string; + component?: Locator; +} diff --git a/playwright/playwright.config.ts b/playwright/playwright.config.ts index d5ef44783e..332e64c22d 100644 --- a/playwright/playwright.config.ts +++ b/playwright/playwright.config.ts @@ -60,11 +60,17 @@ const config: PlaywrightTestConfig = { projects: [ { name: 'chromium', - use: {...devices['Desktop Chrome']}, + use: { + ...devices['Desktop Chrome'], + deviceScaleFactor: 2, + }, }, { name: 'webkit', - use: {...devices['Desktop Safari']}, + use: { + ...devices['Desktop Safari'], + deviceScaleFactor: 2, + }, }, ], }; diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-1-chromium-linux.png deleted file mode 100644 index d01eb2aeb6..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-1-webkit-linux.png deleted file mode 100644 index 6abf0fde41..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-dark-chromium-linux.png new file mode 100644 index 0000000000..dea526c489 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-dark-webkit-linux.png new file mode 100644 index 0000000000..c33899c7f0 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-light-chromium-linux.png new file mode 100644 index 0000000000..b46c6bc267 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-light-webkit-linux.png new file mode 100644 index 0000000000..c3c0f46458 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Default-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-1-chromium-linux.png deleted file mode 100644 index db1d6b32aa..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-1-webkit-linux.png deleted file mode 100644 index 73abc1a790..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-chromium-linux.png new file mode 100644 index 0000000000..677072332d Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-webkit-linux.png new file mode 100644 index 0000000000..81fa983d19 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-light-chromium-linux.png new file mode 100644 index 0000000000..942f03fb42 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-light-webkit-linux.png new file mode 100644 index 0000000000..214d258999 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Disabled-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-chromium-linux.png deleted file mode 100644 index 73cd88644e..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-webkit-linux.png deleted file mode 100644 index 223ce17728..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-chromium-linux.png new file mode 100644 index 0000000000..1e52a72c32 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-webkit-linux.png new file mode 100644 index 0000000000..65aa703101 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-light-chromium-linux.png new file mode 100644 index 0000000000..5a3a3f01f6 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-light-webkit-linux.png new file mode 100644 index 0000000000..3d37307564 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-chromium-linux.png deleted file mode 100644 index 7b44a6ed06..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-webkit-linux.png deleted file mode 100644 index 9a621a67be..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-chromium-linux.png new file mode 100644 index 0000000000..128be6ba6d Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-webkit-linux.png new file mode 100644 index 0000000000..ad3c13cec6 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-light-chromium-linux.png new file mode 100644 index 0000000000..139a57ad53 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-light-webkit-linux.png new file mode 100644 index 0000000000..ea37de8516 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Link-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-chromium-linux.png deleted file mode 100644 index e04f1d570c..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-webkit-linux.png deleted file mode 100644 index 97c90d89f9..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-dark-chromium-linux.png new file mode 100644 index 0000000000..adfaf92fad Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-dark-webkit-linux.png new file mode 100644 index 0000000000..ae49330667 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-light-chromium-linux.png new file mode 100644 index 0000000000..eb1b13668c Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-light-webkit-linux.png new file mode 100644 index 0000000000..6b052816cc Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Loading-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-chromium-linux.png deleted file mode 100644 index 8332ac1d91..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-webkit-linux.png deleted file mode 100644 index 60b5e11034..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-chromium-linux.png new file mode 100644 index 0000000000..e8f2955f50 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-webkit-linux.png new file mode 100644 index 0000000000..cac5c69e36 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-chromium-linux.png new file mode 100644 index 0000000000..a2984e05ea Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-webkit-linux.png new file mode 100644 index 0000000000..721a0eed00 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-1-chromium-linux.png deleted file mode 100644 index 944414c56e..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-1-webkit-linux.png deleted file mode 100644 index 49232fa8f8..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-dark-chromium-linux.png new file mode 100644 index 0000000000..5d0dd06eee Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-dark-webkit-linux.png new file mode 100644 index 0000000000..796630fbca Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-light-chromium-linux.png new file mode 100644 index 0000000000..1e02814c58 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-light-webkit-linux.png new file mode 100644 index 0000000000..47d5d56a7d Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Selected-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-chromium-linux.png deleted file mode 100644 index 12529ed148..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-webkit-linux.png deleted file mode 100644 index 81528258c1..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-chromium-linux.png new file mode 100644 index 0000000000..69fd4a1b93 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-webkit-linux.png new file mode 100644 index 0000000000..9b9fc3c7bc Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-light-chromium-linux.png new file mode 100644 index 0000000000..99e26772fe Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-light-webkit-linux.png new file mode 100644 index 0000000000..d78980b6ff Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Size-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-chromium-linux.png deleted file mode 100644 index 75d1fa2fdd..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-webkit-linux.png deleted file mode 100644 index 69770515aa..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-dark-chromium-linux.png new file mode 100644 index 0000000000..05d6e8331c Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-dark-webkit-linux.png new file mode 100644 index 0000000000..9f8c4d2d2d Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-light-chromium-linux.png new file mode 100644 index 0000000000..542a9ca4f8 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-light-webkit-linux.png new file mode 100644 index 0000000000..ed95915844 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-View-light-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-chromium-linux.png deleted file mode 100644 index 53ee6d6b70..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-chromium-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-webkit-linux.png deleted file mode 100644 index d6efdaa248..0000000000 Binary files a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-webkit-linux.png and /dev/null differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-dark-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-dark-chromium-linux.png new file mode 100644 index 0000000000..a9f0615fe4 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-dark-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-dark-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-dark-webkit-linux.png new file mode 100644 index 0000000000..f5608c14fe Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-dark-webkit-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-light-chromium-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-light-chromium-linux.png new file mode 100644 index 0000000000..3ad380cd73 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-light-chromium-linux.png differ diff --git a/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-light-webkit-linux.png b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-light-webkit-linux.png new file mode 100644 index 0000000000..c1b14ad431 Binary files /dev/null and b/src/components/Button/__snapshots__/Button.visual.test.tsx-snapshots/Button-render-story-Width-light-webkit-linux.png differ diff --git a/src/components/Button/__tests__/Button.visual.test.tsx b/src/components/Button/__tests__/Button.visual.test.tsx index 65b59fb4d1..115f5af1a0 100644 --- a/src/components/Button/__tests__/Button.visual.test.tsx +++ b/src/components/Button/__tests__/Button.visual.test.tsx @@ -1,7 +1,5 @@ import React from 'react'; -import {expect} from '@playwright/experimental-ct-react'; - import { Default, Disabled, @@ -18,63 +16,63 @@ import { import {test} from '~playwright/core'; test.describe('Button', () => { - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); - test('render story: ', async ({mount}) => { - const component = await mount(); + test('render story: ', async ({mount, expectScreenshot}) => { + await mount(); - await expect(component).toHaveScreenshot(); + await expectScreenshot(); }); }); diff --git a/src/components/Label/__snapshots__/Label.visual.test.tsx-snapshots/Label-render-story-ShowcaseStory-1-chromium-linux.png b/src/components/Label/__snapshots__/Label.visual.test.tsx-snapshots/Label-render-story-ShowcaseStory-1-chromium-linux.png index eb83a2a2d6..7e70cfbc89 100644 Binary files a/src/components/Label/__snapshots__/Label.visual.test.tsx-snapshots/Label-render-story-ShowcaseStory-1-chromium-linux.png and b/src/components/Label/__snapshots__/Label.visual.test.tsx-snapshots/Label-render-story-ShowcaseStory-1-chromium-linux.png differ