Skip to content

Commit

Permalink
test(TextArea): add @AVT tests (#14388)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Datilio Ribeiro <[email protected]>
  • Loading branch information
alisonjoseph and guidari authored Aug 7, 2023
1 parent ffc9ab1 commit 2b8b66c
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 13 deletions.
78 changes: 78 additions & 0 deletions e2e/components/TextArea/TextArea-test.avt.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const { expect, test } = require('@playwright/test');
const { visitStory } = require('../../test-utils/storybook');

test.describe('TextArea @avt', () => {
test('accessibility-checker TextArea', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'components-textarea--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('TextArea');
});

test('accessibility-checker TextArea invalid', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'components-textarea--playground',
globals: {
theme: 'white',
},
args: {
invalid: 'true',
},
});
await expect(page).toHaveNoACViolations('TextArea invalid');
});

test('accessibility-checker TextArea warn', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'components-textarea--playground',
globals: {
theme: 'white',
},
args: {
warn: 'true',
},
});
await expect(page).toHaveNoACViolations('TextArea warn');
});

test('accessibility-checker TextArea skeleton', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'components-textarea--skeleton',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('TextArea skeleton');
});

test('accessibility-checker TextArea keyboard counter', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'components-textarea--playground',
globals: {
theme: 'white',
},
});

await expect(page.getByText('0/500')).toBeVisible();
await page.getByRole('textbox').fill('test');
await expect(page.getByText('4/500')).toBeVisible();
await expect(page).toHaveNoACViolations('TextArea keyboard counter');
});
});
15 changes: 2 additions & 13 deletions e2e/components/TextArea/TextArea-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

'use strict';

const { expect, test } = require('@playwright/test');
const { test } = require('@playwright/test');
const { themes } = require('../../test-utils/env');
const { snapshotStory, visitStory } = require('../../test-utils/storybook');
const { snapshotStory } = require('../../test-utils/storybook');

test.describe('TextArea', () => {
themes.forEach((theme) => {
Expand All @@ -31,15 +31,4 @@ test.describe('TextArea', () => {
});
});
});

test('accessibility-checker @avt', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'components-textarea--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('TextArea');
});
});

0 comments on commit 2b8b66c

Please sign in to comment.