-
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(Progress): add smoke visual tests (#1804)
- Loading branch information
1 parent
6f68393
commit 6b16fc6
Showing
5 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+59.1 KB
...rogress.visual.test.tsx-snapshots/Progress-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.
Binary file added
BIN
+38.3 KB
...st.tsx-snapshots/Progress-smoke-smoke-with-color-stops-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
+47.5 KB
...ual.test.tsx-snapshots/Progress-smoke-smoke-with-stack-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.
117 changes: 117 additions & 0 deletions
117
src/components/Progress/__tests__/Progress.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,117 @@ | ||
import React from 'react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import {Progress} from '../Progress'; | ||
|
||
import {loadingCases, sizeCases, themeCases} from './cases'; | ||
|
||
test.describe('Progress', {tag: '@Progress'}, () => { | ||
smokeTest('smoke', async ({mount, expectScreenshot}) => { | ||
const smokeScenarios = createSmokeScenarios( | ||
{}, | ||
{ | ||
size: sizeCases, | ||
theme: themeCases, | ||
loading: loadingCases, | ||
}, | ||
); | ||
|
||
await mount( | ||
<div style={{width: 400}}> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div style={{width: '200px', height: '50px'}}> | ||
<Progress value={50} text="Text" {...props} /> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
|
||
smokeTest('smoke, with color stops', async ({mount, expectScreenshot}) => { | ||
const smokeScenarios = createSmokeScenarios( | ||
{}, | ||
{ | ||
size: sizeCases, | ||
loading: loadingCases, | ||
}, | ||
{ | ||
scenarioName: 'with color stops', | ||
}, | ||
); | ||
|
||
await mount( | ||
<div style={{width: 400}}> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div style={{width: '200px', height: '50px'}}> | ||
<Progress | ||
value={50} | ||
text="Text" | ||
colorStops={[ | ||
{theme: 'danger', stop: 20}, | ||
{theme: 'warning', stop: 50}, | ||
{theme: 'success', stop: 100}, | ||
]} | ||
{...props} | ||
/> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
|
||
smokeTest('smoke, with stack', async ({mount, expectScreenshot}) => { | ||
const smokeScenarios = createSmokeScenarios( | ||
{}, | ||
{ | ||
size: sizeCases, | ||
loading: loadingCases, | ||
}, | ||
{ | ||
scenarioName: 'with stack', | ||
}, | ||
); | ||
|
||
await mount( | ||
<div style={{width: 400}}> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div style={{width: '200px', height: '50px'}}> | ||
<Progress | ||
value={50} | ||
text="Text" | ||
stack={[ | ||
{theme: 'default', content: 'First', value: 25}, | ||
{theme: 'success', content: 'Second', value: 25}, | ||
{theme: 'warning', content: 'Third', value: 25}, | ||
{theme: 'danger', content: 'Fourth', value: 25}, | ||
]} | ||
{...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,13 @@ | ||
import type {Cases} from '../../../stories/tests-factory/models'; | ||
import type {ProgressProps} from '../types'; | ||
|
||
export const sizeCases: Cases<ProgressProps['size']> = ['xs', 's', 'm']; | ||
export const themeCases: Cases<ProgressProps['theme']> = [ | ||
'default', | ||
'success', | ||
'warning', | ||
'danger', | ||
'info', | ||
'misc', | ||
]; | ||
export const loadingCases: Cases<ProgressProps['loading']> = [true]; |