Skip to content

Commit 537ef17

Browse files
tinayuangaommalerba
authored andcommitted
Make slide toggle e2e test take screenshots when ripple disappeared (#3171)
1 parent 83b5842 commit 537ef17

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

e2e/components/slide-toggle/slide-toggle.e2e.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {browser, element, by, Key} from 'protractor';
1+
import {browser, element, by, Key, ExpectedConditions} from 'protractor';
22
import {expectToExist} from '../../util/asserts';
33
import {screenshot} from '../../screenshot';
44

@@ -21,7 +21,9 @@ describe('slide-toggle', () => {
2121
getNormalToggle().click();
2222

2323
expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked');
24-
screenshot();
24+
browser.wait(ExpectedConditions.not(
25+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
26+
.then(() => screenshot());
2527
});
2628

2729
it('should change the checked state on click', () => {
@@ -32,7 +34,9 @@ describe('slide-toggle', () => {
3234
getNormalToggle().click();
3335

3436
expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked');
35-
screenshot();
37+
browser.wait(ExpectedConditions.not(
38+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
39+
.then(() => screenshot());
3640
});
3741

3842
it('should not change the checked state on click when disabled', () => {
@@ -43,7 +47,9 @@ describe('slide-toggle', () => {
4347
element(by.css('#disabled-slide-toggle')).click();
4448

4549
expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');
46-
screenshot();
50+
browser.wait(ExpectedConditions.not(
51+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
52+
.then(() => screenshot());
4753
});
4854

4955
it('should move the thumb on state change', () => {
@@ -57,7 +63,9 @@ describe('slide-toggle', () => {
5763
let newX = thumbEl.getLocation().then(pos => pos.x);
5864

5965
expect(previousX).not.toBe(newX);
60-
screenshot();
66+
browser.wait(ExpectedConditions.not(
67+
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
68+
.then(() => screenshot());
6169
});
6270

6371
it('should toggle the slide-toggle on space key', () => {

0 commit comments

Comments
 (0)