1- import { browser , element , by , Key } from 'protractor' ;
1+ import { browser , element , by , Key , ExpectedConditions } from 'protractor' ;
22import { expectToExist } from '../../util/asserts' ;
33import { 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