|
1 |
| -import {browser, by, element, Key, ProtractorBy} from 'protractor'; |
| 1 | +import {browser, by, element} from 'protractor'; |
2 | 2 |
|
3 | 3 | describe('fullscreen', () => {
|
4 |
| - beforeEach(() => browser.get('/fullscreen')); |
5 | 4 |
|
6 |
| - let overlayInBody = () => |
7 |
| - browser.isElementPresent(by.css('body > .cdk-overlay-container') as ProtractorBy); |
8 |
| - let overlayInFullscreen = () => |
9 |
| - browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container') as ProtractorBy); |
| 5 | + beforeEach(() => browser.get('/fullscreen')); |
10 | 6 |
|
11 | 7 | it('should open a dialog inside a fullscreen element and move it to the document body', () => {
|
12 | 8 | element(by.id('fullscreen')).click();
|
13 | 9 | element(by.id('dialog')).click();
|
14 | 10 |
|
15 |
| - overlayInFullscreen().then((isPresent: boolean) => { |
16 |
| - expect(isPresent).toBe(true); |
17 |
| - element(by.id('exitfullscreenindialog')).click(); |
18 |
| - overlayInBody().then((isPresent: boolean) => { |
19 |
| - expect(isPresent).toBe(true); |
20 |
| - }); |
21 |
| - }); |
| 11 | + expectOverlayInFullscreen(); |
| 12 | + |
| 13 | + element(by.id('exitfullscreenindialog')).click(); |
| 14 | + expectOverlayInBody(); |
22 | 15 | });
|
23 | 16 |
|
24 | 17 | it('should open a dialog inside the document body and move it to a fullscreen element', () => {
|
25 | 18 | element(by.id('dialog')).click();
|
26 |
| - overlayInBody().then((isPresent: boolean) => { |
27 |
| - expect(isPresent).toBe(true); |
28 |
| - element(by.id('fullscreenindialog')).click(); |
29 |
| - overlayInFullscreen().then((isPresent: boolean) => { |
30 |
| - expect(isPresent).toBe(true); |
31 |
| - element(by.id('exitfullscreenindialog')).click(); |
32 |
| - overlayInBody().then((isPresent: boolean) => { |
33 |
| - expect(isPresent).toBe(true); |
34 |
| - }); |
35 |
| - }); |
36 |
| - }); |
| 19 | + expectOverlayInBody(); |
| 20 | + |
| 21 | + element(by.id('fullscreenindialog')).click(); |
| 22 | + expectOverlayInFullscreen(); |
| 23 | + |
| 24 | + element(by.id('exitfullscreenindialog')).click(); |
| 25 | + expectOverlayInBody(); |
37 | 26 | });
|
| 27 | + |
| 28 | + /** Expects the overlay container to be inside of the body element. */ |
| 29 | + function expectOverlayInBody() { |
| 30 | + expect(browser.isElementPresent(by.css('body > .cdk-overlay-container'))).toBe(true); |
| 31 | + } |
| 32 | + |
| 33 | + /** Expects the overlay container to be in fullscreen mode. */ |
| 34 | + function expectOverlayInFullscreen() { |
| 35 | + expect(browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container'))).toBe(true); |
| 36 | + } |
| 37 | + |
38 | 38 | });
|
0 commit comments