Skip to content

Commit

Permalink
Add Keyboard Nav AVT test for FluidTextArea (#15161)
Browse files Browse the repository at this point in the history
* test: changed text

* test: added avt keyboard test

* test: fixed test
  • Loading branch information
guidari authored Nov 14, 2023
1 parent 7b7ec95 commit 0b006d6
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions e2e/components/FluidTextArea/FluidTextArea-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,91 @@ test.describe('FluidTextArea @avt', () => {
});
await expect(page).toHaveNoACViolations('FluidTextArea @avt-default-state');
});

test('@avt-advanced-states default-with-layers', async ({ page }) => {
await visitStory(page, {
component: 'FluidTextArea',
id: 'experimental-unstable-fluidtextarea--default-with-layers',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations(
'FluidTextArea-default-with-layers'
);
});

test('@avt-advanced-states default-with-tooltip', async ({ page }) => {
await visitStory(page, {
component: 'FluidTextArea',
id: 'experimental-unstable-fluidtextarea--default-with-tooltip',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations(
'FluidTextArea-default-with-tooltip'
);
});

test('@avt-advanced-states skeleton', async ({ page }) => {
await visitStory(page, {
component: 'FluidTextArea',
id: 'experimental-unstable-fluidtextarea--skeleton',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('FluidTextArea-skeleton');
});

test('@avt-keyboard-nav FluidTextArea default', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'experimental-unstable-fluidtextarea--default',
globals: {
theme: 'white',
},
});
const textArea = page.getByRole('textbox');
await expect(page.getByText('Text Area label')).toBeVisible();

// Checking focus on textarea
await page.keyboard.press('Tab');
await expect(textArea).toBeFocused();

// Writting a word to check functionality
await textArea.fill('test');
await expect(textArea).toHaveValue('test');
await expect(page).toHaveNoACViolations('FluidTextArea default');
});

test('@avt-keyboard-nav FluidTextArea with tooltip', async ({ page }) => {
await visitStory(page, {
component: 'TextArea',
id: 'experimental-unstable-fluidtextarea--default-with-tooltip',
globals: {
theme: 'white',
},
});
await expect(page.getByText('Text Area label')).toBeVisible();

// Checking tooltip
await page.keyboard.press('Tab');
await expect(page.getByLabel('Show information')).toBeFocused();
await page.keyboard.press('Enter');
await expect(
page.getByText('Additional field information here.')
).toBeVisible();

// Checking focus on textarea
const textArea = page.getByRole('textbox');
await page.keyboard.press('Tab');
await expect(textArea).toBeFocused();

// Writting a word to check functionality
await textArea.fill('test');
await expect(textArea).toHaveValue('test');
await expect(page).toHaveNoACViolations('FluidTextArea with tooltip');
});
});

0 comments on commit 0b006d6

Please sign in to comment.