-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(DefinitionList): add smoke visual tests
- Loading branch information
1 parent
f8dfee1
commit 3118174
Showing
10 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+413 KB
....test.tsx-snapshots/DefinitionList-render-story-Default-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+396 KB
...test.tsx-snapshots/DefinitionList-render-story-Default-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+399 KB
...visual.test.tsx-snapshots/DefinitionList-smoke-default-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+402 KB
...sx-snapshots/DefinitionList-smoke-direction-horizontal-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+407 KB
....tsx-snapshots/DefinitionList-smoke-direction-vertical-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+526 KB
...ts/DefinitionList-smoke-responsive-contentMaxWidth-100-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+402 KB
....tsx-snapshots/DefinitionList-smoke-responsive-default-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+427 KB
...shots/DefinitionList-smoke-responsive-nameMaxWidth-100-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions
69
src/components/DefinitionList/__tests__/DefinitionList.visual.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {DefinitionListProps} from '../types'; | ||
|
||
import {DefinitionListStories} from './stories'; | ||
|
||
test.describe('DefinitionList', {tag: '@DefinitionList'}, () => { | ||
test('render story <Default>', async ({mount, expectScreenshot}) => { | ||
await mount(<DefinitionListStories.Default />); | ||
|
||
await expectScreenshot(); | ||
}); | ||
|
||
createSmokeScenarios<Omit<DefinitionListProps, 'children'>>( | ||
{}, | ||
{ | ||
direction: ['vertical', 'horizontal'], | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, expectScreenshot}) => { | ||
await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<DefinitionListStories.Default {...props} /> | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
}); | ||
|
||
createSmokeScenarios<Omit<DefinitionListProps, 'children'>>( | ||
{ | ||
responsive: true, | ||
}, | ||
{ | ||
nameMaxWidth: [100], | ||
contentMaxWidth: [100], | ||
}, | ||
{ | ||
scenarioName: 'responsive', | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, page, expectScreenshot}) => { | ||
const size = page.viewportSize(); | ||
if (size) { | ||
await page.setViewportSize({ | ||
width: 1000, | ||
height: size.height, | ||
}); | ||
} | ||
|
||
await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<DefinitionListStories.Default {...props} /> | ||
</div>, | ||
{width: 'auto'}, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {composeStories} from '@storybook/react'; | ||
|
||
import * as CSFStories from '../__stories__/DefinitionList.stories'; | ||
|
||
export const DefinitionListStories = composeStories(CSFStories); |