Skip to content

Commit 0560eab

Browse files
devversionkara
authored andcommitted
test(): cleanup screenshot files in e2e-app (#3367)
1 parent 324da5b commit 0560eab

File tree

3 files changed

+51
-47
lines changed

3 files changed

+51
-47
lines changed

e2e/components/fullscreen/fullscreen.e2e.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,36 @@ describe('fullscreen', () => {
55
beforeEach(() => browser.get('/fullscreen'));
66

77
it('should open a dialog inside a fullscreen element and move it to the document body', () => {
8-
element(by.id('fullscreen')).click();
9-
element(by.id('dialog')).click();
8+
element(by.id('fullscreen-open')).click();
9+
element(by.id('dialog-open')).click();
1010

1111
expectOverlayInFullscreen();
1212

13-
element(by.id('exitfullscreenindialog')).click();
13+
element(by.id('dialog-fullscreen-exit')).click();
1414
expectOverlayInBody();
1515
});
1616

1717
it('should open a dialog inside the document body and move it to a fullscreen element', () => {
18-
element(by.id('dialog')).click();
18+
element(by.id('dialog-open')).click();
1919
expectOverlayInBody();
2020

21-
element(by.id('fullscreenindialog')).click();
21+
element(by.id('dialog-fullscreen-open')).click();
2222
expectOverlayInFullscreen();
2323

24-
element(by.id('exitfullscreenindialog')).click();
24+
element(by.id('dialog-fullscreen-exit')).click();
2525
expectOverlayInBody();
2626
});
2727

2828
/** Expects the overlay container to be inside of the body element. */
2929
function expectOverlayInBody() {
30-
expect(browser.isElementPresent(by.css('body > .cdk-overlay-container'))).toBe(true);
30+
expect(browser.isElementPresent(by.css('body > .cdk-overlay-container')))
31+
.toBe(true, 'Expected the overlay container to be inside of the body.');
3132
}
3233

3334
/** Expects the overlay container to be in fullscreen mode. */
3435
function expectOverlayInFullscreen() {
35-
expect(browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container'))).toBe(true);
36+
expect(browser.isElementPresent(by.css('#fullscreen-pane > .cdk-overlay-container')))
37+
.toBe(true, 'Expected the overlay container to be in fullscreen mode.');
3638
}
3739

3840
});
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
<button id="fullscreen" (click)="toggleFullScreen()">FULLSCREEN</button>
2-
<div id="fullscreenpane" style="width: 100%; height: 100%">
3-
<button id="dialog" (click)="openDialog()">DIALOG</button>
4-
<button id="exitfullscreen" (click)="exitFullscreen()">EXIT FULLSCREEN</button>
5-
</div>
1+
<button id="fullscreen-open" (click)="openFullscreen()">Open Fullscreen</button>
2+
3+
<div id="fullscreen-pane">
4+
<button id="dialog-open" (click)="openDialog()">Open Dialog</button>
5+
<button id="fullscreen-exit" (click)="exitFullscreen()">Exit Fullscreen</button>
6+
</div>

src/e2e-app/fullscreen/fullscreen-e2e.ts

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,61 @@ import {Component, ElementRef, Output, EventEmitter} from '@angular/core';
22
import {MdDialog, MdDialogRef} from '@angular/material';
33

44
@Component({
5-
selector: 'fullscreen-e2e',
65
moduleId: module.id,
6+
selector: 'fullscreen-e2e',
77
templateUrl: 'fullscreen-e2e.html'
88
})
99
export class FullscreenE2E {
10+
1011
dialogRef: MdDialogRef<TestDialog>;
1112

1213
constructor (private _element: ElementRef, private _dialog: MdDialog) { }
1314

1415
openDialog() {
1516
this.dialogRef = this._dialog.open(TestDialog);
16-
this.dialogRef.componentInstance.fullscreen.subscribe(() => this.toggleFullScreen());
17-
this.dialogRef.componentInstance.exitfullscreen.subscribe(() => this.exitFullscreen());
18-
this.dialogRef.afterClosed().subscribe(() => {
19-
this.dialogRef = null;
20-
});
17+
18+
this.dialogRef.componentInstance.openFullscreen.subscribe(() => this.openFullscreen());
19+
this.dialogRef.componentInstance.exitFullscreen.subscribe(() => this.exitFullscreen());
20+
this.dialogRef.afterClosed().subscribe(() => this.dialogRef = null);
2121
}
2222

23-
toggleFullScreen() {
24-
let element = this._element.nativeElement.querySelector('#fullscreenpane');
25-
if (element.requestFullscreen) {
26-
element.requestFullscreen();
27-
} else if (element.webkitRequestFullScreen) {
28-
element.webkitRequestFullScreen();
29-
} else if ((element as any).mozRequestFullScreen) {
30-
(element as any).mozRequestFullScreen();
31-
} else if ((element as any).msRequestFullScreen) {
32-
(element as any).msRequestFullScreen();
33-
}
23+
openFullscreen() {
24+
let element = this._element.nativeElement.querySelector('#fullscreen-pane');
25+
26+
if (element.requestFullscreen) {
27+
element.requestFullscreen();
28+
} else if (element.webkitRequestFullScreen) {
29+
element.webkitRequestFullScreen();
30+
} else if ((element as any).mozRequestFullScreen) {
31+
(element as any).mozRequestFullScreen();
32+
} else if ((element as any).msRequestFullScreen) {
33+
(element as any).msRequestFullScreen();
34+
}
3435
}
3536

3637
exitFullscreen() {
37-
if (document.exitFullscreen) {
38-
document.exitFullscreen();
39-
} else if (document.webkitExitFullscreen) {
40-
document.webkitExitFullscreen();
41-
} else if ((document as any).mozExitFullScreen) {
42-
(document as any).mozExitFullScreen();
43-
} else if ((document as any).msExitFullScreen) {
44-
(document as any).msExitFullScreen();
45-
}
38+
if (document.exitFullscreen) {
39+
document.exitFullscreen();
40+
} else if (document.webkitExitFullscreen) {
41+
document.webkitExitFullscreen();
42+
} else if ((document as any).mozExitFullScreen) {
43+
(document as any).mozExitFullScreen();
44+
} else if ((document as any).msExitFullScreen) {
45+
(document as any).msExitFullScreen();
46+
}
4647
}
4748
}
4849

4950
@Component({
50-
selector: 'fullscreen-dialog-e2e-test',
5151
template: `
52-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
53-
<button id="fullscreenindialog" (click)="fullscreen.emit()">FULLSCREEN</button>
54-
<button id="exitfullscreenindialog" (click)="exitfullscreen.emit()">EXIT FULLSCREEN</button>
55-
<button type="button" (click)="dialogRef.close()" id="close">CLOSE</button>`
52+
<button id="dialog-fullscreen-open" (click)="openFullscreen.emit()">Open Fullscreen</button>
53+
<button id="dialog-fullscreen-exit" (click)="exitFullscreen.emit()">Exit Fullscreen</button>
54+
<button (click)="dialogRef.close()" id="close">Close Dialog</button>
55+
`
5656
})
5757
export class TestDialog {
58-
constructor(public dialogRef: MdDialogRef<TestDialog>) { }
59-
@Output() fullscreen = new EventEmitter<void>();
60-
@Output() exitfullscreen = new EventEmitter<void>();
58+
@Output() openFullscreen = new EventEmitter<void>();
59+
@Output() exitFullscreen = new EventEmitter<void>();
60+
61+
constructor(public dialogRef: MdDialogRef<TestDialog>) {}
6162
}

0 commit comments

Comments
 (0)