diff --git a/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-dark-chromium-linux.png b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-dark-chromium-linux.png new file mode 100644 index 0000000000..f4738a5ba2 Binary files /dev/null and b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-dark-chromium-linux.png differ diff --git a/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-disabled-dark-chromium-linux.png b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-disabled-dark-chromium-linux.png new file mode 100644 index 0000000000..c624e69b66 Binary files /dev/null and b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-disabled-dark-chromium-linux.png differ diff --git a/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-disabled-light-chromium-linux.png b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-disabled-light-chromium-linux.png new file mode 100644 index 0000000000..193a83e423 Binary files /dev/null and b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-disabled-light-chromium-linux.png differ diff --git a/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-light-chromium-linux.png b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-light-chromium-linux.png new file mode 100644 index 0000000000..cf6914a861 Binary files /dev/null and b/src/components/RadioButton/__snapshots__/RadioButton.visual.test.tsx-snapshots/RadioButton-smoke-light-chromium-linux.png differ diff --git a/src/components/RadioButton/__tests__/RadioButton.visual.test.tsx b/src/components/RadioButton/__tests__/RadioButton.visual.test.tsx new file mode 100644 index 0000000000..559fd34773 --- /dev/null +++ b/src/components/RadioButton/__tests__/RadioButton.visual.test.tsx @@ -0,0 +1,67 @@ +import {smokeTest, test} from '~playwright/core'; + +import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; +import type {RadioButtonOption, RadioButtonProps} from '../RadioButton'; +import {RadioButton} from '../RadioButton'; + +import {sizeCases, widthCases} from './cases'; + +test.describe('RadioButton', {tag: '@RadioButton'}, () => { + const options: RadioButtonOption[] = [ + {value: 'Value 1', content: 'Value 1'}, + {value: 'Value 2', content: 'Value 2'}, + {value: 'Value 3', content: 'Value 3', disabled: true}, + ]; + + const defaultProps: RadioButtonProps = { + value: 'Value 1', + options, + }; + + smokeTest('', async ({mount, expectScreenshot}) => { + const smokeScenarios = createSmokeScenarios(defaultProps, { + size: sizeCases, + width: widthCases, + }); + + await mount( +
+ {smokeScenarios.map(([title, props]) => ( +
+

{title}

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

{title}

+
+ +
+
+ ))} +
, + ); + + await expectScreenshot({}); + }); +}); diff --git a/src/components/RadioButton/__tests__/cases.tsx b/src/components/RadioButton/__tests__/cases.tsx new file mode 100644 index 0000000000..577b8f9cd3 --- /dev/null +++ b/src/components/RadioButton/__tests__/cases.tsx @@ -0,0 +1,5 @@ +import type {Cases} from '../../../stories/tests-factory/models'; +import type {RadioButtonProps} from '../RadioButton'; + +export const sizeCases: Cases = ['s', 'm', 'l', 'xl']; +export const widthCases: Cases = ['auto', 'max'];