diff --git a/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-dark-chromium-linux.png b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-dark-chromium-linux.png new file mode 100644 index 0000000000..21ceb9988d Binary files /dev/null and b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-dark-chromium-linux.png differ diff --git a/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-dark-webkit-linux.png b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-dark-webkit-linux.png new file mode 100644 index 0000000000..34fe049d7e Binary files /dev/null and b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-dark-webkit-linux.png differ diff --git a/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-light-chromium-linux.png b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-light-chromium-linux.png new file mode 100644 index 0000000000..197488bf20 Binary files /dev/null and b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-light-chromium-linux.png differ diff --git a/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-light-webkit-linux.png b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-light-webkit-linux.png new file mode 100644 index 0000000000..8d3788f05f Binary files /dev/null and b/src/components/Sheet/__snapshots__/Sheet.visual.test.tsx-snapshots/Sheet-render-story-Default-light-webkit-linux.png differ diff --git a/src/components/Sheet/__stories__/DefaultShowcase/DefaultShowcase.stories.tsx b/src/components/Sheet/__stories__/DefaultShowcase/DefaultShowcase.stories.tsx index cdd4bb1769..7b0f1bde4a 100644 --- a/src/components/Sheet/__stories__/DefaultShowcase/DefaultShowcase.stories.tsx +++ b/src/components/Sheet/__stories__/DefaultShowcase/DefaultShowcase.stories.tsx @@ -6,6 +6,7 @@ import {Button, Checkbox, TextInput} from '../../../'; import {cn} from '../../../utils/cn'; import {Sheet} from '../../Sheet'; import type {SheetProps} from '../../Sheet'; +import {DEFAULT_SHEET_QA} from '../constants'; import './DefaultShowcase.scss'; @@ -71,6 +72,7 @@ export const Default: StoryFn = ({ visible={visible} onClose={() => setVisible(false)} title={withTitle ? 'Sheet title' : undefined} + qa={DEFAULT_SHEET_QA} >
diff --git a/src/components/Sheet/__stories__/constants.ts b/src/components/Sheet/__stories__/constants.ts new file mode 100644 index 0000000000..b4fdb4ce94 --- /dev/null +++ b/src/components/Sheet/__stories__/constants.ts @@ -0,0 +1 @@ +export const DEFAULT_SHEET_QA = 'default-sheet-qa'; diff --git a/src/components/Sheet/__tests__/Sheet.visual.test.tsx b/src/components/Sheet/__tests__/Sheet.visual.test.tsx new file mode 100644 index 0000000000..dd3192f7f8 --- /dev/null +++ b/src/components/Sheet/__tests__/Sheet.visual.test.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +import {expect} from '@playwright/test'; + +import {test} from '~playwright/core'; + +import {DEFAULT_SHEET_QA} from '../__stories__/constants'; + +import {SheetStories} from './helpersPlaywright'; + +test.describe('Sheet', () => { + test('render story: ', async ({page, mount, expectScreenshot}) => { + await mount(); + + await page.getByRole('button').click(); + + const sheetLocator = page.locator(`[data-qa=${DEFAULT_SHEET_QA}]`); + + await expect(sheetLocator).toBeVisible(); + + await expectScreenshot({ + animations: 'disabled', + component: sheetLocator, + }); + }); +}); diff --git a/src/components/Sheet/__tests__/helpersPlaywright.tsx b/src/components/Sheet/__tests__/helpersPlaywright.tsx new file mode 100644 index 0000000000..0da21bf54e --- /dev/null +++ b/src/components/Sheet/__tests__/helpersPlaywright.tsx @@ -0,0 +1,5 @@ +import {composeStories} from '@storybook/react'; + +import * as stories from '../__stories__/DefaultShowcase/DefaultShowcase.stories'; + +export const SheetStories = composeStories(stories);