1
- import { browser , by , element , Key } from 'protractor' ;
1
+ import { browser , by , element , Key , ExpectedConditions } from 'protractor' ;
2
2
import { screenshot } from '../../screenshot' ;
3
3
4
4
describe ( 'checkbox' , function ( ) {
@@ -17,31 +17,39 @@ describe('checkbox', function () {
17
17
checkboxEl . click ( ) ;
18
18
inputEl . getAttribute ( 'checked' ) . then ( ( value : string ) => {
19
19
expect ( value ) . toBeTruthy ( 'Expect checkbox "checked" property to be true' ) ;
20
+ browser . wait ( ExpectedConditions . not (
21
+ ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) )
22
+ . then ( ( ) => screenshot ( 'checked' ) ) ;
20
23
} ) ;
21
- screenshot ( 'checked' ) ;
22
24
23
25
checkboxEl . click ( ) ;
24
26
inputEl . getAttribute ( 'checked' ) . then ( ( value : string ) => {
25
27
expect ( value ) . toBeFalsy ( 'Expect checkbox "checked" property to be false' ) ;
28
+ browser . wait ( ExpectedConditions . not (
29
+ ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) )
30
+ . then ( ( ) => screenshot ( 'unchecked' ) ) ;
26
31
} ) ;
27
- screenshot ( 'unchecked' ) ;
28
32
} ) ;
29
33
30
34
it ( 'should toggle the checkbox when pressing space' , ( ) => {
31
35
let inputEl = element ( by . css ( 'input[id=input-test-checkbox]' ) ) ;
32
36
33
37
inputEl . getAttribute ( 'checked' ) . then ( ( value : string ) => {
34
38
expect ( value ) . toBeFalsy ( 'Expect checkbox "checked" property to be false' ) ;
35
- screenshot ( 'start' ) ;
39
+ browser . wait ( ExpectedConditions . not (
40
+ ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) )
41
+ . then ( ( ) => screenshot ( 'start' ) ) ;
36
42
} ) ;
37
43
38
44
inputEl . sendKeys ( Key . SPACE ) ;
39
45
40
46
inputEl . getAttribute ( 'checked' ) . then ( ( value : string ) => {
41
47
expect ( value ) . toBeTruthy ( 'Expect checkbox "checked" property to be true' ) ;
42
- screenshot ( 'pressed space' ) ;
48
+ browser . wait ( ExpectedConditions . not (
49
+ ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) )
50
+ . then ( ( ) => screenshot ( 'pressed space' ) ) ;
43
51
} ) ;
44
52
} ) ;
45
53
46
54
} ) ;
47
- } ) ;
55
+ } ) ;
0 commit comments