-
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(ArrowToggle): add smoke visual tests (#1770)
- Loading branch information
1 parent
652c2a7
commit 1d184c9
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+42.1 KB
...ggle.visual.test.tsx-snapshots/ArrowToggle-smoke-smoke-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.
37 changes: 37 additions & 0 deletions
37
src/components/ArrowToggle/__tests__/ArrowToggle.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,37 @@ | ||
import React from 'react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {ArrowToggleProps} from '../ArrowToggle'; | ||
import {ArrowToggle} from '../ArrowToggle'; | ||
|
||
import {directionCases, sizeCases} from './cases'; | ||
|
||
test.describe('ArrowToggle', {tag: '@ArrowToggle'}, () => { | ||
smokeTest('smoke', async ({mount, expectScreenshot}) => { | ||
const defaultProps: ArrowToggleProps = {}; | ||
|
||
const smokeScenarios = createSmokeScenarios(defaultProps, { | ||
size: sizeCases, | ||
direction: directionCases, | ||
}); | ||
|
||
await mount( | ||
<div> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div> | ||
<ArrowToggle {...props} /> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
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,10 @@ | ||
import type {Cases} from '../../../stories/tests-factory/models'; | ||
import type {ArrowToggleProps} from '../ArrowToggle'; | ||
|
||
export const sizeCases: Cases<ArrowToggleProps['size']> = [10, 20, 30, 40, 50, 100]; | ||
export const directionCases: Cases<ArrowToggleProps['direction']> = [ | ||
'top', | ||
'left', | ||
'bottom', | ||
'right', | ||
]; |