@@ -25,26 +25,26 @@ describe('Angular Timer E2E Tests', function () {
2525
2626 angular . scenario . matcher ( 'toCompareWith' , function ( future ) {
2727 function getUnitValue ( text , unitName ) {
28- var arr = text . toLowerCase ( ) . match ( / \w + / g) ,
28+ var arr = text . toLowerCase ( ) . match ( / \w + / g) ,
2929 returnVal ,
3030 numInd = - 1 ;
31- arr . every ( function ( item , index , list ) {
31+ arr . every ( function ( item , index , list ) {
3232 if ( isNaN ( item ) ) {
3333 if ( index === 0 ) {
3434 numInd = 1 ;
3535 }
36- if ( item === unitName ) {
36+ if ( item === unitName ) {
3737 returnVal = list [ index + numInd ] ;
3838 return false ;
3939 }
4040 }
41- return true ;
42- } ) ;
41+ return true ;
42+ } ) ;
4343 return returnVal ;
4444 }
4545
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 ;
4848 if ( this . future . compareTo === 'GreaterThan' ) {
4949 compareResultFlag = Number ( unitVal ) > Number ( future ) ;
5050 } else if ( this . future . compareTo === 'LessThan' ) {
@@ -90,9 +90,9 @@ describe('Angular Timer E2E Tests', function () {
9090
9191 it ( 'Clock Timer - with hours, minutes & seconds' , function ( ) {
9292 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 );
9696 } ) ;
9797
9898 it ( 'Countdown Timer - Starts from 100' , function ( ) {
@@ -124,59 +124,65 @@ describe('Angular Timer E2E Tests', function () {
124124 expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 d a y , / ) ;
125125 expect ( element ( '#plural-unit-timer .singular-counter timer' ) . html ( ) ) . toMatch ( / 1 h o u r , / ) ;
126126 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+
129129 expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / d a y s , / ) ;
130130 expect ( element ( '#plural-unit-timer .plural-counter timer' ) . html ( ) ) . toMatch ( / h o u r s , / ) ;
131131 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+
147146 it ( 'Countdown finish - Should fire callback on completion' , function ( ) {
148-
149-
150147 expect ( element ( '#finish-callback-timer .timer-status' ) . html ( ) ) . toBe ( 'Running' ) ;
151148 expect ( element ( '#finish-callback-timer .timer-callbacks' ) . html ( ) ) . toBe ( '0' ) ;
152-
149+
153150 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+ } ) ;
158155
159156 it ( 'Start time with auto start' , function ( ) {
160157 expect ( element ( '#start-time-and-auto-start-set timer span' ) . html ( ) ) . toBeGreaterThan ( 1000 ) ;
161158 } ) ;
162159
163160 it ( 'Countdown timer with maxTimeUnit- should display time value from lower to specified maxTimeUnit' , function ( ) {
164161 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 / ) ;
168166
169167 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 / ) ;
172172
173173 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 / ) ;
180186 } ) ;
181187
182188} ) ;
0 commit comments