@@ -17,24 +17,31 @@ describe('PhoneCat Application', function() {
17
17
} ) ;
18
18
19
19
it ( 'should filter the phone list as a user types into the search box' , function ( ) {
20
- var phoneList = element . all ( by . repeater ( 'phone in $ctrl.phones ' ) ) ;
20
+ var phoneList = element . all ( by . repeater ( 'phone in filtered ' ) ) ;
21
21
var query = element ( by . model ( '$ctrl.query' ) ) ;
22
22
23
23
expect ( phoneList . count ( ) ) . toBe ( 20 ) ;
24
24
25
25
query . sendKeys ( 'nexus' ) ;
26
- expect ( phoneList . count ( ) ) . toBe ( 1 ) ;
27
-
26
+
27
+ browser . sleep ( 1000 ) . then ( function ( ) {
28
+ expect ( phoneList . count ( ) ) . toBe ( 1 ) ;
29
+ } ) ;
30
+
28
31
query . clear ( ) ;
29
32
query . sendKeys ( 'motorola' ) ;
30
- expect ( phoneList . count ( ) ) . toBe ( 8 ) ;
33
+
34
+ browser . sleep ( 1000 ) . then ( function ( ) {
35
+ expect ( phoneList . count ( ) ) . toBe ( 8 ) ;
36
+ } ) ;
37
+
31
38
} ) ;
32
39
33
40
it ( 'should be possible to control phone order via the drop-down menu' , function ( ) {
34
41
var queryField = element ( by . model ( '$ctrl.query' ) ) ;
35
42
var orderSelect = element ( by . model ( '$ctrl.orderProp' ) ) ;
36
43
var nameOption = orderSelect . element ( by . css ( 'option[value="name"]' ) ) ;
37
- var phoneNameColumn = element . all ( by . repeater ( 'phone in $ctrl.phones ' ) . column ( 'phone.name' ) ) ;
44
+ var phoneNameColumn = element . all ( by . repeater ( 'phone in filtered ' ) . column ( 'phone.name' ) ) ;
38
45
39
46
function getNames ( ) {
40
47
return phoneNameColumn . map ( function ( elem ) {
@@ -43,26 +50,33 @@ describe('PhoneCat Application', function() {
43
50
}
44
51
45
52
queryField . sendKeys ( 'tablet' ) ; // Let's narrow the dataset to make the assertions shorter
46
-
47
- expect ( getNames ( ) ) . toEqual ( [
48
- 'Motorola XOOM\u2122 with Wi-Fi' ,
49
- 'MOTOROLA XOOM\u2122'
50
- ] ) ;
51
-
52
- nameOption . click ( ) ;
53
-
54
- expect ( getNames ( ) ) . toEqual ( [
55
- 'MOTOROLA XOOM\u2122' ,
56
- 'Motorola XOOM\u2122 with Wi-Fi'
57
- ] ) ;
53
+
54
+ browser . sleep ( 1000 ) . then ( function ( ) {
55
+
56
+ expect ( getNames ( ) ) . toEqual ( [
57
+ 'Motorola XOOM\u2122 with Wi-Fi' ,
58
+ 'MOTOROLA XOOM\u2122'
59
+ ] ) ;
60
+
61
+ nameOption . click ( ) ;
62
+
63
+ expect ( getNames ( ) ) . toEqual ( [
64
+ 'MOTOROLA XOOM\u2122' ,
65
+ 'Motorola XOOM\u2122 with Wi-Fi'
66
+ ] ) ;
67
+
68
+ } ) ;
58
69
} ) ;
59
70
60
71
it ( 'should render phone specific links' , function ( ) {
61
72
var query = element ( by . model ( '$ctrl.query' ) ) ;
62
73
query . sendKeys ( 'nexus' ) ;
63
-
64
- element . all ( by . css ( '.phones li a' ) ) . first ( ) . click ( ) ;
65
- expect ( browser . getLocationAbsUrl ( ) ) . toBe ( '/phones/nexus-s' ) ;
74
+
75
+ browser . sleep ( 1000 ) . then ( function ( ) {
76
+ element . all ( by . css ( '.phones li a' ) ) . first ( ) . click ( ) ;
77
+ expect ( browser . getLocationAbsUrl ( ) ) . toBe ( '/phones/nexus-s' ) ;
78
+ } ) ;
79
+
66
80
} ) ;
67
81
68
82
} ) ;
0 commit comments