@@ -25,26 +25,26 @@ describe('Angular Timer E2E Tests', function () {
25
25
26
26
angular . scenario . matcher ( 'toCompareWith' , function ( future ) {
27
27
function getUnitValue ( text , unitName ) {
28
- var arr = text . toLowerCase ( ) . match ( / \w + / g) ,
28
+ var arr = text . toLowerCase ( ) . match ( / \w + / g) ,
29
29
returnVal ,
30
30
numInd = - 1 ;
31
- arr . every ( function ( item , index , list ) {
31
+ arr . every ( function ( item , index , list ) {
32
32
if ( isNaN ( item ) ) {
33
33
if ( index === 0 ) {
34
34
numInd = 1 ;
35
35
}
36
- if ( item === unitName ) {
36
+ if ( item === unitName ) {
37
37
returnVal = list [ index + numInd ] ;
38
38
return false ;
39
39
}
40
40
}
41
- return true ;
42
- } ) ;
41
+ return true ;
42
+ } ) ;
43
43
return returnVal ;
44
44
}
45
45
46
- var unitVal = getUnitValue ( this . future . timerText . value , this . future . unit ) ,
47
- compareResultFlag = false ;
46
+ var unitVal = getUnitValue ( this . future . timerText . value , this . future . unit ) ,
47
+ compareResultFlag = false ;
48
48
if ( this . future . compareTo === 'GreaterThan' ) {
49
49
compareResultFlag = Number ( unitVal ) > Number ( future ) ;
50
50
} else if ( this . future . compareTo === 'LessThan' ) {
@@ -90,9 +90,9 @@ describe('Angular Timer E2E Tests', function () {
90
90
91
91
it ( 'Clock Timer - with hours, minutes & seconds' , function ( ) {
92
92
sleep ( 3 ) ;
93
- expect ( element ( '#clock-timer timer' ) . html ( ) ) . toMatch ( / 0 h o u r s , / ) ;
94
- expect ( element ( '#clock-timer timer' ) . html ( ) ) . toMatch ( / 0 m i n u t e s , / ) ;
95
- expect ( element ( '#clock-timer timer' ) . html ( ) ) . not ( ) . toMatch ( / 0 s e c o n d s ./ ) ;
93
+ expect ( element ( '#clock-timer timer' ) . text ( ) ) . toMatch ( / 0 h o u r / ) ;
94
+ expect ( element ( '#clock-timer timer' ) . text ( ) ) . toMatch ( / 0 m i n u t e / ) ;
95
+ expect ( element ( '#clock-timer timer' ) . text ( ) ) . toMatch ( / 3 s e c o n d s ./ ) ; //because of sleep(3 );
96
96
} ) ;
97
97
98
98
it ( 'Countdown Timer - Starts from 100' , function ( ) {
@@ -124,59 +124,65 @@ describe('Angular Timer E2E Tests', function () {
124
124
expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 d a y , / ) ;
125
125
expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 h o u r , / ) ;
126
126
expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 m i n u t e , / ) ;
127
- expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 s e c o n d / ) ;
128
-
127
+ expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 s e c o n d / ) ;
128
+
129
129
expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / d a y s , / ) ;
130
130
expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / h o u r s , / ) ;
131
131
expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / m i n u t e s , / ) ;
132
- expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / s e c o n d s / ) ;
133
- } ) ;
134
-
135
- // Commenting to see if build pass
136
- // it('Leading zero timer - should add a leading zero if number is smaller than 10', function() {
137
- // sleep(1);
138
- // expect(element('#clock-timer-leading-zero timer').html()).toMatch(/00 hours,/);
139
- // expect(element('#clock-timer-leading-zero timer').html()).toMatch(/00 minutes,/);
140
- // expect(element('#clock-timer-leading-zero timer').html()).toMatch(/01 seconds./);
141
- // sleep(10);
142
- // expect(element('#clock-timer-leading-zero timer').html()).toMatch(/00 hours,/);
143
- // expect(element('#clock-timer-leading-zero timer').html()).toMatch(/00 minutes,/);
144
- // expect(element('#clock-timer-leading-zero timer').html()).toMatch(/11 seconds./);
145
- // });
146
-
132
+ expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / s e c o n d s / ) ;
133
+ } ) ;
134
+
135
+ it ( 'Leading zero timer - should add a leading zero if number is smaller than 10' , function ( ) {
136
+ sleep ( 1 ) ;
137
+ expect ( element ( '#clock-timer-leading-zero timer' ) . text ( ) ) . toMatch ( / 0 0 h o u r , / ) ;
138
+ expect ( element ( '#clock-timer-leading-zero timer' ) . text ( ) ) . toMatch ( / 0 0 m i n u t e , / ) ;
139
+ expect ( element ( '#clock-timer-leading-zero timer' ) . text ( ) ) . toMatch ( / 0 1 s e c o n d / ) ;
140
+ sleep ( 10 ) ;
141
+ expect ( element ( '#clock-timer-leading-zero timer' ) . text ( ) ) . toMatch ( / 0 0 h o u r , / ) ;
142
+ expect ( element ( '#clock-timer-leading-zero timer' ) . text ( ) ) . toMatch ( / 0 0 m i n u t e , / ) ;
143
+ expect ( element ( '#clock-timer-leading-zero timer' ) . text ( ) ) . toMatch ( / 1 1 s e c o n d s / ) ;
144
+ } ) ;
145
+
147
146
it ( 'Countdown finish - Should fire callback on completion' , function ( ) {
148
-
149
-
150
147
expect ( element ( '#finish-callback-timer .timer-status' ) . html ( ) ) . toBe ( 'Running' ) ;
151
148
expect ( element ( '#finish-callback-timer .timer-callbacks' ) . html ( ) ) . toBe ( '0' ) ;
152
-
149
+
153
150
sleep ( 5 ) ;
154
- expect ( element ( '#finish-callback-timer .timer-status' ) . html ( ) ) . toBe ( 'COMPLETE!!' ) ;
155
- expect ( element ( '#finish-callback-timer .timer-callbacks' ) . html ( ) ) . toBe ( '1' ) ;
156
-
157
- } ) ;
151
+ expect ( element ( '#finish-callback-timer .timer-status' ) . html ( ) ) . toBe ( 'COMPLETE!!' ) ;
152
+ expect ( element ( '#finish-callback-timer .timer-callbacks' ) . html ( ) ) . toBe ( '1' ) ;
153
+
154
+ } ) ;
158
155
159
156
it ( 'Start time with auto start' , function ( ) {
160
157
expect ( element ( '#start-time-and-auto-start-set timer span' ) . html ( ) ) . toBeGreaterThan ( 1000 ) ;
161
158
} ) ;
162
159
163
160
it ( 'Countdown timer with maxTimeUnit- should display time value from lower to specified maxTimeUnit' , function ( ) {
164
161
var timer1Val = element ( '#max-time-unit-countdown-timer .WithMaxTimeUnitAsMinute timer' ) . text ( ) ;
165
-
166
- expect ( { 'timerText' : timer1Val , 'unit' : 'minutes' , 'compareTo' : 'GreaterThan' } ) . toCompareWith ( 59 ) ;
167
- expect ( { 'timerText' : timer1Val , 'unit' : 'seconds' , 'compareTo' : 'LessThan' } ) . toCompareWith ( 60 ) ;
162
+ expect ( timer1Val ) . toMatch ( / m i n u t e s / ) ;
163
+ expect ( timer1Val ) . toMatch ( / 1 6 7 / ) ;
164
+ expect ( timer1Val ) . toMatch ( / s e c o n d s / ) ;
165
+ expect ( timer1Val ) . toMatch ( / 2 1 / ) ;
168
166
169
167
var timer2Val = element ( '#max-time-unit-countdown-timer .WithMaxTimeUnitAsSecond timer' ) . text ( ) ;
170
- expect ( { 'timerText' : timer2Val , 'unit' : 'minutes' , 'compareTo' : 'EqualTo' } ) . toCompareWith ( 0 ) ;
171
- expect ( { 'timerText' : timer2Val , 'unit' : 'seconds' , 'compareTo' : 'GreaterThan' } ) . toCompareWith ( 59 ) ;
168
+ expect ( timer2Val ) . toMatch ( / m i n u t e / ) ;
169
+ expect ( timer2Val ) . toMatch ( / 0 / ) ;
170
+ expect ( timer2Val ) . toMatch ( / s e c o n d s / ) ;
171
+ expect ( timer2Val ) . toMatch ( / 1 0 0 4 1 / ) ;
172
172
173
173
var timer3Val = element ( '#max-time-unit-countdown-timer .WithMaxTimeUnitAsYear timer' ) . text ( ) ;
174
- expect ( { 'timerText' : timer3Val , 'unit' : 'seconds' , 'compareTo' : 'LessThan' } ) . toCompareWith ( 60 ) ;
175
- expect ( { 'timerText' : timer3Val , 'unit' : 'minutes' , 'compareTo' : 'LessThan' } ) . toCompareWith ( 60 ) ;
176
- expect ( { 'timerText' : timer3Val , 'unit' : 'hours' , 'compareTo' : 'LessThan' } ) . toCompareWith ( 24 ) ;
177
- expect ( { 'timerText' : timer3Val , 'unit' : 'days' , 'compareTo' : 'LessThan' } ) . toCompareWith ( 30 ) ;
178
- expect ( { 'timerText' : timer3Val , 'unit' : 'months' , 'compareTo' : 'LessThan' } ) . toCompareWith ( 12 ) ;
179
-
174
+ expect ( timer3Val ) . toMatch ( / y e a r s / ) ;
175
+ expect ( timer3Val ) . toMatch ( / 0 3 / ) ;
176
+ expect ( timer3Val ) . toMatch ( / m o n t h s / ) ;
177
+ expect ( timer3Val ) . toMatch ( / 0 2 / ) ;
178
+ expect ( timer3Val ) . toMatch ( / d a y s / ) ;
179
+ expect ( timer3Val ) . toMatch ( / 2 2 / ) ;
180
+ expect ( timer3Val ) . toMatch ( / h o u r s / ) ;
181
+ expect ( timer3Val ) . toMatch ( / 0 3 / ) ;
182
+ expect ( timer3Val ) . toMatch ( / m i n u t e / ) ;
183
+ expect ( timer3Val ) . toMatch ( / 4 0 / ) ;
184
+ expect ( timer3Val ) . toMatch ( / s e c o n d / ) ;
185
+ expect ( timer3Val ) . toMatch ( / 0 0 / ) ;
180
186
} ) ;
181
187
182
188
} ) ;
0 commit comments