Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Sheet): add visual test for Default showcase #1703

Merged
merged 7 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -71,6 +72,7 @@ export const Default: StoryFn<SheetProps> = ({
visible={visible}
onClose={() => setVisible(false)}
title={withTitle ? 'Sheet title' : undefined}
qa={DEFAULT_SHEET_QA}
>
<div className={b('content-item')}>
<TextInput />
Expand Down
1 change: 1 addition & 0 deletions src/components/Sheet/__stories__/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const DEFAULT_SHEET_QA = 'default-sheet-qa';
26 changes: 26 additions & 0 deletions src/components/Sheet/__tests__/Sheet.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -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: <Default>', async ({page, mount, expectScreenshot}) => {
await mount(<SheetStories.Default />);

await page.getByRole('button').click();

const sheetLocator = page.locator(`[data-qa=${DEFAULT_SHEET_QA}]`);

await expect(sheetLocator).toBeVisible();

await expectScreenshot({
animations: 'disabled',
component: sheetLocator,
});
});
});
5 changes: 5 additions & 0 deletions src/components/Sheet/__tests__/helpersPlaywright.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {composeStories} from '@storybook/react';

import * as stories from '../__stories__/DefaultShowcase/DefaultShowcase.stories';

export const SheetStories = composeStories(stories);
Loading