/
FluidSelect-test.avt.e2e.js
66 lines (58 loc) · 1.92 KB
/
FluidSelect-test.avt.e2e.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* 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('FluidSelect @avt', () => {
test('@avt-default-state', async ({ page }) => {
await visitStory(page, {
component: 'FluidSelect',
id: 'experimental-fluid-components-unstable-fluidselect--default',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('FluidSelect @avt-default-state');
});
test('@avt-advanced-states skeleton', async ({ page }) => {
await visitStory(page, {
component: 'FluidSelect',
id: 'experimental-fluid-components-unstable-fluidselect--skeleton',
globals: {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('FluidSelect-skeleton');
});
test('@avt-keyboard-nav FluidSelect', async ({ page }) => {
await visitStory(page, {
component: 'FluidSelect',
id: 'experimental-fluid-components-unstable-fluidselect--default',
globals: {
theme: 'white',
},
});
const select = page.getByRole('combobox').first();
await expect(select).toBeVisible();
// Focus on label additional information
await page.keyboard.press('Tab');
await expect(
page.getByRole('button', { name: 'Show information' }).first()
).toBeFocused();
await page.keyboard.press('Enter');
await expect(
page.getByText('Additional field information here.').first()
).toBeVisible();
// Tab to Select
await page.keyboard.press('Tab');
await expect(select).toBeFocused();
await expect(select).toHaveValue('');
// Select Option 4
await select.selectOption('option-4');
await expect(select).toHaveValue('option-4');
});
});