-
Notifications
You must be signed in to change notification settings - Fork 26
/
async-select-field.visualspec.js
47 lines (43 loc) 路 1.51 KB
/
async-select-field.visualspec.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
import { percySnapshot } from '@percy/puppeteer';
import { getDocument, queries } from 'pptr-testing-library';
const { getAllByLabelText } = queries;
describe('AsyncSelectField', () => {
it('Default', async () => {
await page.goto(`${HOST}/async-select-field`);
const doc = await getDocument(page);
const selects = await getAllByLabelText(doc, 'State');
await expect(selects).toBeTruthy();
await percySnapshot(page, 'AsyncSelectField');
});
describe('with defaultOptions', () => {
it('Open', async () => {
await page.goto(`${HOST}/async-select-field/interaction`);
const doc = await getDocument(page);
const selects = await getAllByLabelText(doc, 'State');
const select = selects[0];
await select.click();
await percySnapshot(page, 'AsyncSelectField - withDefaultOptions - open');
});
});
describe('without defaultOptions', () => {
it('Open', async () => {
await page.goto(
`${HOST}/async-select-field/interaction/without-default-options`
);
const doc = await getDocument(page);
const selects = await getAllByLabelText(doc, 'State');
const select = selects[0];
await select.click();
await percySnapshot(
page,
'AsyncSelectField - withDefaultOptions disabled - open'
);
// typing triggers async loadOptions
await select.type('O');
await percySnapshot(
page,
'AsyncSelectField - withDefaultOptions disabled - open - after typing'
);
});
});
});