-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
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,100 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
const stories = [ | ||
{ | ||
title: 'Default', | ||
id: 'components-form-control--default', | ||
}, | ||
{ | ||
title: 'Custom Required', | ||
id: 'components-form-control-features--custom-required', | ||
}, | ||
{ | ||
title: 'Disabled Inputs', | ||
id: 'components-form-control-features--disabled-inputs', | ||
}, | ||
{ | ||
title: 'Form Control with Custom Input', | ||
id: 'components-formcontrol-features--form-control-with-custom-input', | ||
}, | ||
{ | ||
title: 'Single Input', | ||
id: 'components-formcontrol-features--single-input', | ||
}, | ||
{ | ||
title: 'Validation Example', | ||
id: 'components-formcontrol-features--validation-example', | ||
}, | ||
{ | ||
title: 'With Checkbox And Radio Inputs', | ||
id: 'components-formcontrol-features--with-checkbox-and-radio-inputs', | ||
}, | ||
{ | ||
title: 'With Complex Inputs', | ||
id: 'components-formcontrol-features--with-complex-inputs', | ||
}, | ||
{ | ||
title: 'With Leading Visual', | ||
id: 'components-formcontrol-features--with-leading-visual', | ||
}, | ||
{ | ||
title: 'With Select Panel', | ||
id: 'components-formcontrol-features--with-select-panel', | ||
}, | ||
{ | ||
title: 'With Caption', | ||
id: 'components-formcontrol-features--with-caption', | ||
}, | ||
{ | ||
title: 'With Hidden Label', | ||
id: 'components-formcontrol-features--with-hidden-label', | ||
}, | ||
{ | ||
title: 'With Required Indicator', | ||
id: 'components-formcontrol-features--with-required-indicator', | ||
}, | ||
{ | ||
title: 'With Success Validation', | ||
id: 'components-formcontrol-features--with-success-validation', | ||
}, | ||
{ | ||
title: 'With Error Validation', | ||
id: 'components-formcontrol-features--with-error-validation', | ||
}, | ||
] as const | ||
|
||
test.describe('FormControl', () => { | ||
for (const story of stories) { | ||
describe(story.title, () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: story.id, | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot( | ||
`FormControl.${story.title}.${theme}.png`, | ||
) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: story.id, | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
} | ||
}) |
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