Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atabel committed Aug 11, 2023
1 parent 73c27fb commit 2a9a62a
Show file tree
Hide file tree
Showing 7 changed files with 40 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.
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.
39 changes: 39 additions & 0 deletions src/__screenshot_tests__/poster-card-screenshot-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,42 @@ test.each(TESTABLE_DEVICES)('PosterCard with asset in %s', async (device) => {

expect(image).toMatchImageSnapshot();
});

test.each(['inverse', 'alternative', 'default'])('PosterCard with variant %s', async (variant) => {
await openStoryPage({
id: 'components-cards-poster-card--default',
args: {variant, background: 'color from skin'},
});

const posterCard = await screen.findByTestId('main-poster-card');

const image = await posterCard.screenshot();

expect(image).toMatchImageSnapshot();
});

test('PosterCard with custom background color', async () => {
await openStoryPage({
id: 'components-cards-poster-card--default',
args: {background: 'custom color', backgroundColorCustom: '#ff0'},
});

const posterCard = await screen.findByTestId('main-poster-card');

const image = await posterCard.screenshot();

expect(image).toMatchImageSnapshot();
});

test('PosterCard with custom background color inverse', async () => {
await openStoryPage({
id: 'components-cards-poster-card--default',
args: {background: 'custom color', backgroundColorCustom: '#000', variant: 'inverse'},
});

const posterCard = await screen.findByTestId('main-poster-card');

const image = await posterCard.screenshot();

expect(image).toMatchImageSnapshot();
});
1 change: 1 addition & 0 deletions src/__stories__/poster-card-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const Default: StoryComponent<PosterCardArgs> = ({
return (
<Stack space={32} dataAttributes={{testid: 'poster-card'}}>
<PosterCard
dataAttributes={{testid: 'main-poster-card'}}
{...backgroundProps}
icon={icon}
headline={headline ? <Tag type={headlineType}>{headline}</Tag> : undefined}
Expand Down

0 comments on commit 2a9a62a

Please sign in to comment.