Skip to content

Commit

Permalink
test(Loader): add smoke visual tests (#1808)
Browse files Browse the repository at this point in the history
  • Loading branch information
itwillwork authored Dec 28, 2024
1 parent 253968c commit 9527d01
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
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.
32 changes: 32 additions & 0 deletions src/components/Loader/__tests__/Loader.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {smokeTest, test} from '~playwright/core';

import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios';
import type {LoaderProps} from '../Loader';
import {Loader} from '../Loader';

import {sizeCases} from './cases';

test.describe('Loader', {tag: '@Loader'}, () => {
const defaultProps: LoaderProps = {};

smokeTest('', async ({mount, expectScreenshot}) => {
const smokeScenarios = createSmokeScenarios(defaultProps, {
size: sizeCases,
});

await mount(
<div>
{smokeScenarios.map(([title, props]) => (
<div key={title}>
<h4>{title}</h4>
<div>
<Loader {...props} />
</div>
</div>
))}
</div>,
);

await expectScreenshot({});
});
});
4 changes: 4 additions & 0 deletions src/components/Loader/__tests__/cases.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type {Cases} from '../../../stories/tests-factory/models';
import type {LoaderProps} from '../Loader';

export const sizeCases: Cases<LoaderProps['size']> = ['s', 'm', 'l'];

0 comments on commit 9527d01

Please sign in to comment.