/
modal-stack.e2e-spec.ts
43 lines (32 loc) · 1.31 KB
/
modal-stack.e2e-spec.ts
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
import {Key, browser} from 'protractor';
import {expectFocused, expectNoOpenModals, openUrl, sendKey} from '../../tools.po';
import {ModalStackPage} from './modal-stack.po';
import {DatepickerPage} from '../../datepicker/datepicker.po';
import {DropdownPage} from '../../dropdown/dropdown.po';
import {TypeaheadPage} from '../../typeahead/typeahead.po';
describe('Modal stacked', () => {
let page: ModalStackPage;
let datepickerPage: DatepickerPage;
let dropdownPage: DropdownPage;
let typeaheadPage: TypeaheadPage;
beforeAll(() => {
page = new ModalStackPage();
datepickerPage = new DatepickerPage();
dropdownPage = new DropdownPage();
typeaheadPage = new TypeaheadPage();
});
beforeEach(async() => await openUrl('modal/stack'));
afterEach(async() => { await expectNoOpenModals(); });
it('should keep tab on the first modal after the second modal has closed', async() => {
await page.openModal();
await page.openStackModal();
// close the stack modal
await sendKey(Key.ESCAPE);
// Check that the button is focused again
await expectFocused(page.getStackModalButton(), 'Button element not focused');
await sendKey(Key.TAB);
await expectFocused(page.getCoseIcon(), 'Close icon not focused');
// close the main modal
await sendKey(Key.ESCAPE);
});
});