1
- import { browser , element , by , Key } from 'protractor' ;
1
+ import { browser , element , by , Key , ExpectedConditions } from 'protractor' ;
2
2
import { expectToExist } from '../../util/asserts' ;
3
3
import { screenshot } from '../../screenshot' ;
4
4
@@ -21,7 +21,9 @@ describe('slide-toggle', () => {
21
21
getNormalToggle ( ) . click ( ) ;
22
22
23
23
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 ( ) ) ;
25
27
} ) ;
26
28
27
29
it ( 'should change the checked state on click' , ( ) => {
@@ -32,7 +34,9 @@ describe('slide-toggle', () => {
32
34
getNormalToggle ( ) . click ( ) ;
33
35
34
36
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 ( ) ) ;
36
40
} ) ;
37
41
38
42
it ( 'should not change the checked state on click when disabled' , ( ) => {
@@ -43,7 +47,9 @@ describe('slide-toggle', () => {
43
47
element ( by . css ( '#disabled-slide-toggle' ) ) . click ( ) ;
44
48
45
49
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 ( ) ) ;
47
53
} ) ;
48
54
49
55
it ( 'should move the thumb on state change' , ( ) => {
@@ -57,7 +63,9 @@ describe('slide-toggle', () => {
57
63
let newX = thumbEl . getLocation ( ) . then ( pos => pos . x ) ;
58
64
59
65
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 ( ) ) ;
61
69
} ) ;
62
70
63
71
it ( 'should toggle the slide-toggle on space key' , ( ) => {
0 commit comments