diff --git a/src/components/RadioGroup/RadioGroup.tsx b/src/components/RadioGroup/RadioGroup.tsx index d9e4aae63..36c1ab448 100644 --- a/src/components/RadioGroup/RadioGroup.tsx +++ b/src/components/RadioGroup/RadioGroup.tsx @@ -50,6 +50,7 @@ export const RadioGroup = React.forwardRef( value: props.value, content: props.content || props.children, disabled: props.disabled, + qa: props.qa, })); } diff --git a/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-dark-chromium-linux.png b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-dark-chromium-linux.png new file mode 100644 index 000000000..7711f46a7 Binary files /dev/null and b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-dark-chromium-linux.png differ diff --git a/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-disabled-dark-chromium-linux.png b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-disabled-dark-chromium-linux.png new file mode 100644 index 000000000..d9dd6e83c Binary files /dev/null and b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-disabled-dark-chromium-linux.png differ diff --git a/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-disabled-light-chromium-linux.png b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-disabled-light-chromium-linux.png new file mode 100644 index 000000000..845b27e7d Binary files /dev/null and b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-disabled-light-chromium-linux.png differ diff --git a/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-light-chromium-linux.png b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-light-chromium-linux.png new file mode 100644 index 000000000..12abb46a3 Binary files /dev/null and b/src/components/RadioGroup/__snapshots__/RadioGroup.visual.test.tsx-snapshots/RadioGroup-smoke-light-chromium-linux.png differ diff --git a/src/components/RadioGroup/__tests__/RadioGroup.visual.test.tsx b/src/components/RadioGroup/__tests__/RadioGroup.visual.test.tsx new file mode 100644 index 000000000..d61bf39ac --- /dev/null +++ b/src/components/RadioGroup/__tests__/RadioGroup.visual.test.tsx @@ -0,0 +1,70 @@ +import {smokeTest, test} from '~playwright/core'; + +import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; +import type {RadioGroupOption, RadioGroupProps} from '../RadioGroup'; +import {RadioGroup} from '../RadioGroup'; + +import {directionCases, sizeCases} from './cases'; + +test.describe('RadioGroup', {tag: '@RadioGroup'}, () => { + const options: RadioGroupOption[] = [ + {value: 'Value 1', content: 'Value 1'}, + {value: 'Value 2', content: 'Value 2'}, + {value: 'Value 3', content: 'Value 3', disabled: true}, + ]; + + const defaultProps: RadioGroupProps = { + value: 'Value 1', + options, + }; + + smokeTest('', async ({mount, expectScreenshot}) => { + const smokeScenarios = createSmokeScenarios(defaultProps, { + size: sizeCases, + direction: directionCases, + }); + + await mount( +
+ {smokeScenarios.map(([title, props]) => ( +
+

{title}

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

{title}

+
+ +
+
+ ))} +
, + ); + + await expectScreenshot({}); + }); +}); diff --git a/src/components/RadioGroup/__tests__/cases.tsx b/src/components/RadioGroup/__tests__/cases.tsx new file mode 100644 index 000000000..dd774cde9 --- /dev/null +++ b/src/components/RadioGroup/__tests__/cases.tsx @@ -0,0 +1,5 @@ +import type {Cases} from '../../../stories/tests-factory/models'; +import type {RadioGroupProps} from '../RadioGroup'; + +export const sizeCases: Cases = ['m', 'l']; +export const directionCases: Cases = ['vertical', 'horizontal'];