diff --git a/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-checked-dark-chromium-linux.png b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-checked-dark-chromium-linux.png new file mode 100644 index 000000000..c5b627e20 Binary files /dev/null and b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-checked-dark-chromium-linux.png differ diff --git a/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-checked-light-chromium-linux.png b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-checked-light-chromium-linux.png new file mode 100644 index 000000000..891fbbf17 Binary files /dev/null and b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-checked-light-chromium-linux.png differ diff --git a/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-dark-chromium-linux.png b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-dark-chromium-linux.png new file mode 100644 index 000000000..24c038be0 Binary files /dev/null and b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-dark-chromium-linux.png differ diff --git a/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-light-chromium-linux.png b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-light-chromium-linux.png new file mode 100644 index 000000000..7cb54727d Binary files /dev/null and b/src/components/Switch/__snapshots__/Switch.visual.test.tsx-snapshots/Switch-smoke-light-chromium-linux.png differ diff --git a/src/components/Switch/__tests__/Switch.visual.test.tsx b/src/components/Switch/__tests__/Switch.visual.test.tsx new file mode 100644 index 000000000..36ef666a8 --- /dev/null +++ b/src/components/Switch/__tests__/Switch.visual.test.tsx @@ -0,0 +1,65 @@ +import {smokeTest, test} from '~playwright/core'; + +import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; +import type {SwitchProps} from '../Switch'; +import {Switch} from '../Switch'; + +import {disabledCases, indeterminateCases, sizeCases} from './cases'; + +test.describe('Switch', {tag: '@Switch'}, () => { + const defaultProps: SwitchProps = { + content: 'label', + }; + + smokeTest('', async ({mount, expectScreenshot}) => { + const smokeScenarios = createSmokeScenarios(defaultProps, { + size: sizeCases, + disabled: disabledCases, + indeterminate: indeterminateCases, + }); + + await mount( +
+ {smokeScenarios.map(([title, props]) => ( +
+

{title}

+
+ +
+
+ ))} +
, + ); + + await expectScreenshot({}); + }); + + smokeTest('checked', async ({mount, expectScreenshot}) => { + const smokeScenarios = createSmokeScenarios( + { + ...defaultProps, + checked: true, + }, + { + size: sizeCases, + disabled: disabledCases, + indeterminate: indeterminateCases, + }, + ); + + await mount( +
+ {smokeScenarios.map(([title, props]) => ( +
+

{title}

+
+ +
+
+ ))} +
, + ); + + await expectScreenshot({}); + }); +}); diff --git a/src/components/Switch/__tests__/cases.tsx b/src/components/Switch/__tests__/cases.tsx new file mode 100644 index 000000000..addb48111 --- /dev/null +++ b/src/components/Switch/__tests__/cases.tsx @@ -0,0 +1,6 @@ +import type {Cases} from '../../../stories/tests-factory/models'; +import type {SwitchProps} from '../Switch'; + +export const disabledCases: Cases = [true]; +export const indeterminateCases: Cases = [true]; +export const sizeCases: Cases = ['m', 'l'];