@@ -118,13 +118,13 @@ const planHours = [
118118] ;
119119
120120const updatePlanHours = [
121- { date : lastWeekDates [ 0 ] , hours : 1 , sumFlex : 96.45 , nettoHours : 0 , flex : - 1 , humanFlex : '89 :27' } ,
122- { date : lastWeekDates [ 1 ] , hours : 2 , sumFlex : 94.45 , nettoHours : 0 , flex : - 2 , humanFlex : '81 :27' } ,
123- { date : lastWeekDates [ 2 ] , hours : 3 , sumFlex : 91.45 , nettoHours : 0 , flex : - 3 , humanFlex : '73 :27' } ,
124- { date : lastWeekDates [ 3 ] , hours : 0 , sumFlex : 91.45 , nettoHours : 0 , flex : 0 , humanFlex : '65 :27' } ,
125- { date : lastWeekDates [ 4 ] , hours : 4 , sumFlex : 87.45 , nettoHours : 0 , flex : - 4 , humanFlex : '57 :27' } ,
126- { date : lastWeekDates [ 5 ] , hours : 5 , sumFlex : 82.45 , nettoHours : 0 , flex : - 5 , humanFlex : '49 :27' } ,
127- { date : lastWeekDates [ 6 ] , hours : 6 , sumFlex : 76.45 , nettoHours : 0 , flex : - 6 , humanFlex : '41 :27' } ,
121+ { date : lastWeekDates [ 0 ] , hours : 1 , sumFlex : 96.45 , nettoHours : 0 , flex : - 1 , humanFlex : '96 :27' } ,
122+ { date : lastWeekDates [ 1 ] , hours : 2 , sumFlex : 94.45 , nettoHours : 0 , flex : - 2 , humanFlex : '94 :27' } ,
123+ { date : lastWeekDates [ 2 ] , hours : 3 , sumFlex : 91.45 , nettoHours : 0 , flex : - 3 , humanFlex : '91 :27' } ,
124+ { date : lastWeekDates [ 3 ] , hours : 0 , sumFlex : 91.45 , nettoHours : 0 , flex : 0 , humanFlex : '91 :27' } ,
125+ { date : lastWeekDates [ 4 ] , hours : 4 , sumFlex : 87.45 , nettoHours : 0 , flex : - 4 , humanFlex : '87 :27' } ,
126+ { date : lastWeekDates [ 5 ] , hours : 5 , sumFlex : 82.45 , nettoHours : 0 , flex : - 5 , humanFlex : '82 :27' } ,
127+ { date : lastWeekDates [ 6 ] , hours : 6 , sumFlex : 76.45 , nettoHours : 0 , flex : - 6 , humanFlex : '76 :27' } ,
128128]
129129
130130const planHoursNextWeek = [
@@ -138,13 +138,13 @@ const planHoursNextWeek = [
138138] ;
139139
140140const updatePlanHoursNextWeek = [
141- { date : nextWeekDates [ 0 ] , hours : 8 , sumFlex : 68.45 , nettoHours : 0 , flex : - 8 , humanFlex : '33 :27' } ,
142- { date : nextWeekDates [ 1 ] , hours : 8 , sumFlex : 60.45 , nettoHours : 0 , flex : - 8 , humanFlex : '25 :27' } ,
143- { date : nextWeekDates [ 2 ] , hours : 0 , sumFlex : 60.45 , nettoHours : 0 , flex : 0 , humanFlex : '17 :27' } ,
144- { date : nextWeekDates [ 3 ] , hours : 0 , sumFlex : 60.45 , nettoHours : 0 , flex : 0 , humanFlex : '9 :27' } ,
145- { date : nextWeekDates [ 4 ] , hours : 0 , sumFlex : 60.45 , nettoHours : 0 , flex : 0 , humanFlex : '1 :27' } ,
146- { date : nextWeekDates [ 5 ] , hours : 8 , sumFlex : 52.45 , nettoHours : 0 , flex : - 8 , humanFlex : '-6:33 ' } ,
147- { date : nextWeekDates [ 6 ] , hours : 8 , sumFlex : 44.45 , nettoHours : 0 , flex : - 8 , humanFlex : '-14:33 ' } ,
141+ { date : nextWeekDates [ 0 ] , hours : 8 , sumFlex : 68.45 , nettoHours : 0 , flex : - 8 , humanFlex : '68 :27' } ,
142+ { date : nextWeekDates [ 1 ] , hours : 8 , sumFlex : 60.45 , nettoHours : 0 , flex : - 8 , humanFlex : '60 :27' } ,
143+ { date : nextWeekDates [ 2 ] , hours : 0 , sumFlex : 60.45 , nettoHours : 0 , flex : 0 , humanFlex : '60 :27' } ,
144+ { date : nextWeekDates [ 3 ] , hours : 0 , sumFlex : 60.45 , nettoHours : 0 , flex : 0 , humanFlex : '60 :27' } ,
145+ { date : nextWeekDates [ 4 ] , hours : 0 , sumFlex : 60.45 , nettoHours : 0 , flex : 0 , humanFlex : '60 :27' } ,
146+ { date : nextWeekDates [ 5 ] , hours : 8 , sumFlex : 52.45 , nettoHours : 0 , flex : - 8 , humanFlex : '52:27 ' } ,
147+ { date : nextWeekDates [ 6 ] , hours : 8 , sumFlex : 44.45 , nettoHours : 0 , flex : - 8 , humanFlex : '44:27 ' } ,
148148]
149149
150150const planHoursFutureWeek = [
@@ -158,13 +158,13 @@ const planHoursFutureWeek = [
158158] ;
159159
160160const updatePlanHoursFutureWeek = [
161- { date : futureWeekDates [ 0 ] , hours : 2 , sumFlex : 42.45 , nettoHours : 0 , flex : - 2 , humanFlex : '-22:33 ' } ,
162- { date : futureWeekDates [ 1 ] , hours : 4 , sumFlex : 38.45 , nettoHours : 0 , flex : - 4 , humanFlex : '-30:33 ' } ,
163- { date : futureWeekDates [ 2 ] , hours : 0 , sumFlex : 38.45 , nettoHours : 0 , flex : 0 , humanFlex : '-46:33 ' } ,
164- { date : futureWeekDates [ 3 ] , hours : 10 , sumFlex : 28.45 , nettoHours : 0 , flex : - 10 , humanFlex : '-54:33 ' } ,
165- { date : futureWeekDates [ 4 ] , hours : 12 , sumFlex : 16.45 , nettoHours : 0 , flex : - 12 , humanFlex : '-64:33 ' } ,
166- { date : futureWeekDates [ 5 ] , hours : 3 , sumFlex : 13.45 , nettoHours : 0 , flex : - 3 , humanFlex : '-70:33 ' } ,
167- { date : futureWeekDates [ 6 ] , hours : 8 , sumFlex : 5.45 , nettoHours : 0 , flex : - 8 , humanFlex :'-78.33 ' } ,
161+ { date : futureWeekDates [ 0 ] , hours : 2 , sumFlex : 42.45 , nettoHours : 0 , flex : - 2 , humanFlex : '42:27 ' } ,
162+ { date : futureWeekDates [ 1 ] , hours : 4 , sumFlex : 38.45 , nettoHours : 0 , flex : - 4 , humanFlex : '38:27 ' } ,
163+ { date : futureWeekDates [ 2 ] , hours : 0 , sumFlex : 38.45 , nettoHours : 0 , flex : 0 , humanFlex : '38:27 ' } ,
164+ { date : futureWeekDates [ 3 ] , hours : 10 , sumFlex : 28.45 , nettoHours : 0 , flex : - 10 , humanFlex : '28:27 ' } ,
165+ { date : futureWeekDates [ 4 ] , hours : 12 , sumFlex : 16.45 , nettoHours : 0 , flex : - 12 , humanFlex : '16:27 ' } ,
166+ { date : futureWeekDates [ 5 ] , hours : 3 , sumFlex : 13.45 , nettoHours : 0 , flex : - 3 , humanFlex : '13:27 ' } ,
167+ { date : futureWeekDates [ 6 ] , hours : 8 , sumFlex : 5.45 , nettoHours : 0 , flex : - 8 , humanFlex :' 5:27 ' } ,
168168]
169169
170170const planTexts = [
@@ -178,13 +178,13 @@ const planTexts = [
178178] ;
179179
180180const updatePlanTexts = [
181- { date : lastWeekDates [ 0 ] , text : '07:30-15:30' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: 89 :27' , calculatedHours : '8 :00' } ,
182- { date : lastWeekDates [ 1 ] , text : '7:45-16:00/1' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: 81 :27' , calculatedHours : '8:15 ' } ,
183- { date : lastWeekDates [ 2 ] , text : '7:15-16:00/1;17-20/0,5' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: 73 :27' , calculatedHours : '9:45 ' } ,
184- { date : lastWeekDates [ 3 ] , text : '6-12/½;18:00-20:00/0.5' , plannedHours : '8:00 ' , flexBalanceToDate : 'Flex saldo til dato: 65:27 ' , calculatedHours : '7:0 ' } ,
185- { date : lastWeekDates [ 4 ] , text : '06:00-12:00/¾;18:00-20:00/0.5' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: 57 :27' , calculatedHours : '7:0 ' } ,
186- { date : lastWeekDates [ 5 ] , text : '6-12/¾;18-20/¾' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: 49 :27' , calculatedHours : '7:0 ' } ,
187- { date : lastWeekDates [ 6 ] , text : '6-14/½' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: 41 :27' , calculatedHours : '7:30 ' } ,
181+ { date : lastWeekDates [ 0 ] , text : '07:30-15:30' , plannedHours : '1 :00' , flexBalanceToDate : 'Flex saldo til dato: 96 :27' , calculatedHours : '1 :00' } ,
182+ { date : lastWeekDates [ 1 ] , text : '7:45-16:00/1' , plannedHours : '2 :00' , flexBalanceToDate : 'Flex saldo til dato: 94 :27' , calculatedHours : '2:00 ' } ,
183+ { date : lastWeekDates [ 2 ] , text : '7:15-16:00/1;17-20/0,5' , plannedHours : '3 :00' , flexBalanceToDate : 'Flex saldo til dato: 91 :27' , calculatedHours : '3:00 ' } ,
184+ { date : lastWeekDates [ 3 ] , text : '6-12/½;18:00-20:00/0.5' , plannedHours : '' , flexBalanceToDate : '' , calculatedHours : '0:00 ' } ,
185+ { date : lastWeekDates [ 4 ] , text : '06:00-12:00/¾;18:00-20:00/0.5' , plannedHours : '4 :00' , flexBalanceToDate : 'Flex saldo til dato: 87 :27' , calculatedHours : '4:00 ' } ,
186+ { date : lastWeekDates [ 5 ] , text : '6-12/¾;18-20/¾' , plannedHours : '5 :00' , flexBalanceToDate : 'Flex saldo til dato: 82 :27' , calculatedHours : '5:00 ' } ,
187+ { date : lastWeekDates [ 6 ] , text : '6-14/½' , plannedHours : '6 :00' , flexBalanceToDate : 'Flex saldo til dato: 76 :27' , calculatedHours : '6:00 ' } ,
188188] ;
189189
190190const planTextsNextWeek = [
@@ -220,9 +220,9 @@ const planTextsFutureWeek = [
220220const updatePlanTextsFutureWeek = [
221221 { date : futureWeekDates [ 0 ] , text : '07:30-15:30;foobar' , firstShift : '07:30 - 15:30 / 00:00' , plannedHours : '8:00' , flexBalanceToDate : 'Flex saldo til dato: -22:33' , calculatedHours : '8:00' } ,
222222 { date : futureWeekDates [ 1 ] , text : '7:45-16/0.75' , firstShift : '07:45 - 16:00 / 00:45' , plannedHours : '8:00' , flexBalanceToDate : 'Flex saldo til dato: -30:33' , calculatedHours : '8:15' } ,
223- { date : futureWeekDates [ 2 ] , text : 'foo bar' , plannedHours : '16:00 ' , flexBalanceToDate : 'Flex saldo til dato: -46:33' , calculatedHours : '16:00' } ,
223+ { date : futureWeekDates [ 2 ] , text : 'foo bar' , plannedHours : '' , flexBalanceToDate : 'Flex saldo til dato: -46:33' , calculatedHours : '16:00' } ,
224224 { date : futureWeekDates [ 3 ] , text : '6-12;18:00-20:00' , firstShift : '06:00 - 12:00 / 00:00' , secondShift : '18:00 - 20:00 / 00:00' , plannedHours : '8:00' , flexBalanceToDate : 'Flex saldo til dato: -54:33' , calculatedHours : '8:00' } ,
225- { date : futureWeekDates [ 4 ] , text : ' ' , plannedHours : '8 :00' , flexBalanceToDate : 'Flex saldo til dato: -62:33' , calculatedHours : '8:00' } ,
225+ { date : futureWeekDates [ 4 ] , text : ' ' , plannedHours : '12 :00' , flexBalanceToDate : 'Flex saldo til dato: -62:33' , calculatedHours : '8:00' } ,
226226 { date : futureWeekDates [ 5 ] , text : '6-12/¾;18-20/¾' , firstShift : '06:00 - 12:00 / 00:45' , secondShift : '18:00 - 20:00 / 00:45' , plannedHours : '8:00' , flexBalanceToDate : 'Flex saldo til dato: -70:33' , calculatedHours : '8:00' } ,
227227 { date : futureWeekDates [ 6 ] , text : '6-14/½' , firstShift : '06:00 - 14:00 / 00:30' , plannedHours : '8:00' , flexBalanceToDate : 'Flex saldo til dato: -78:33' , calculatedHours : '8:00' } ,
228228] ;
@@ -236,8 +236,8 @@ describe('Enable Backend Config plugin', () => {
236236
237237 it ( 'should go to dashboard' , ( ) => {
238238 // we have more than one mat-nested-tree-node so we beed to select the own with the text "Timeregistrering"
239- cy . get ( 'mat-nested-tree-node' ) . contains ( 'Time Planning ' ) . click ( ) ;
240- cy . get ( 'mat-tree-node' ) . contains ( 'Working hours ' ) . click ( ) ;
239+ cy . get ( 'mat-nested-tree-node' ) . contains ( 'Timeregistrering ' ) . click ( ) ;
240+ cy . get ( 'mat-tree-node' ) . contains ( 'Timeregistrering ' ) . click ( ) ;
241241 cy . get ( 'mat-toolbar > button .mat-mdc-button-persistent-ripple' ) . parent ( ) . click ( ) ;
242242 cy . get ( '#workingHoursSite' ) . clear ( ) . type ( 'c d' ) ;
243243 cy . get ( '.ng-option.ng-option-marked' ) . click ( ) ;
@@ -323,15 +323,15 @@ describe('Enable Backend Config plugin', () => {
323323 } ) ;
324324
325325 it ( 'should go to dashboard and set to use google sheet as default and check if the settings are correct' , ( ) => {
326- cy . get ( 'mat-nested-tree-node' ) . contains ( 'Time Planning ' ) . click ( ) ;
326+ cy . get ( 'mat-nested-tree-node' ) . contains ( 'Timeregistrering ' ) . click ( ) ;
327327 cy . intercept ( 'POST' , '**/api/time-planning-pn/plannings/index' ) . as ( 'update' ) ;
328328 cy . get ( 'mat-tree-node' ) . contains ( 'Dashboard' ) . click ( ) ;
329329 cy . wait ( '@update' , { timeout : 60000 } ) ;
330330 cy . get ( '#firstColumn0' ) . click ( ) ;
331331 cy . get ( '#useGoogleSheetAsDefault' ) . click ( ) ;
332332 cy . get ( '#saveButton' ) . click ( ) ;
333- // cy.get('mat-nested-tree-node').contains('Time Planning ').click();
334- cy . get ( 'mat-tree-node' ) . contains ( 'Working hours ' ) . click ( ) ;
333+ // cy.get('mat-nested-tree-node').contains('Timeregistrering ').click();
334+ cy . get ( 'mat-tree-node' ) . contains ( 'Timeregistrering ' ) . click ( ) ;
335335 cy . get ( 'mat-toolbar > button .mat-mdc-button-persistent-ripple' ) . parent ( ) . click ( ) ;
336336 cy . get ( '#workingHoursSite' ) . clear ( ) . type ( 'c d' ) ;
337337 cy . get ( '.ng-option.ng-option-marked' ) . click ( ) ;
@@ -480,8 +480,8 @@ describe('Enable Backend Config plugin', () => {
480480 } ) ;
481481
482482 it ( 'should go to dashboard and after updating planText to new values and they should change in dashboard' , ( ) => {
483- cy . get ( 'mat-nested-tree-node' ) . contains ( 'Time Planning ' ) . click ( ) ;
484- cy . get ( 'mat-tree-node' ) . contains ( 'Working hours ' ) . click ( ) ;
483+ cy . get ( 'mat-nested-tree-node' ) . contains ( 'Timeregistrering ' ) . click ( ) ;
484+ cy . get ( 'mat-tree-node' ) . contains ( 'Timeregistrering ' ) . click ( ) ;
485485 cy . get ( 'mat-toolbar > button .mat-mdc-button-persistent-ripple' ) . parent ( ) . click ( ) ;
486486 cy . get ( '#workingHoursSite' ) . clear ( ) . type ( 'c d' ) ;
487487 cy . get ( '.ng-option.ng-option-marked' ) . click ( ) ;
@@ -563,5 +563,57 @@ describe('Enable Backend Config plugin', () => {
563563 cy . get ( '#sumFlex7 input' ) . should ( 'contain.value' , '5.45' ) ;
564564
565565 cy . get ( 'mat-toolbar > button .mat-mdc-button-persistent-ripple' ) . parent ( ) . click ( ) ;
566+
567+ cy . intercept ( 'POST' , '**/api/time-planning-pn/plannings/index' ) . as ( 'update' ) ;
568+ cy . get ( 'mat-tree-node' ) . contains ( 'Dashboard' ) . click ( ) ;
569+ cy . wait ( '@update' , { timeout : 60000 } ) ;
570+ cy . get ( '#backwards' ) . click ( ) ;
571+ cy . get ( '#plannedHours0' ) . should ( 'include.text' , '21:00' ) ;
572+ for ( let i = 0 ; i < updatePlanTexts . length ; i ++ ) {
573+ let plannedHoursId = `#plannedHours0_${ i } ` ;
574+ if ( updatePlanTexts [ i ] . plannedHours !== '' ) {
575+ cy . get ( plannedHoursId ) . should ( 'include.text' , updatePlanTexts [ i ] . plannedHours ) ;
576+ }
577+ // cy.get(id).find('input').should('contain.value', planHoursNextWeek[i].hours.toString());
578+ let flexBalanceToDateId = `#flexBalanceToDate0_${ i } ` ;
579+ if ( updatePlanTexts [ i ] . flexBalanceToDate !== '' ) {
580+ cy . get ( flexBalanceToDateId ) . should ( 'include.text' , updatePlanTexts [ i ] . flexBalanceToDate ) ;
581+ }
582+ // cy.get(sumFlexId).find('input').should('contain.value', planHoursNextWeek[i].sumFlex.toString());
583+ // let nettoHoursId = `#nettoHours${i+1}`;
584+ // cy.get(nettoHoursId).find('input').should('contain.value', planHoursNextWeek[i].nettoHours.toString());
585+ // let flexId = `#flexHours${i+1}`;
586+ // cy.get(flexId).find('input').should('contain.value', planHoursNextWeek[i].flex.toString());
587+ }
588+
589+ cy . get ( '#forwards' ) . click ( ) ;
590+ cy . wait ( 1000 ) ;
591+ cy . get ( '#forwards' ) . click ( ) ;
592+ cy . wait ( 1000 ) ;
593+ for ( let i = 0 ; i < updatePlanTextsNextWeek . length ; i ++ ) {
594+ let firstShiftId = `#firstShift0_${ i } ` ;
595+ cy . get ( firstShiftId ) . should ( 'include.text' , updatePlanTextsNextWeek [ i ] . firstShift ) ;
596+ if ( planTextsNextWeek [ i ] . secondShift ) {
597+ let secondShiftId = `#secondShift0_${ i } ` ;
598+ cy . get ( secondShiftId ) . should ( 'include.text' , updatePlanTextsNextWeek [ i ] . secondShift ) ;
599+ }
600+ }
601+ cy . get ( '#forwards' ) . click ( ) ;
602+ cy . wait ( 1000 ) ;
603+ for ( let i = 0 ; i < updatePlanTextsFutureWeek . length ; i ++ ) {
604+ if ( planTextsFutureWeek [ i ] . firstShift ) {
605+ let firstShiftId = `#firstShift0_${ i } ` ;
606+ cy . get ( firstShiftId ) . should ( 'include.text' , updatePlanTextsFutureWeek [ i ] . firstShift ) ;
607+ } else {
608+ if ( updatePlanTextsFutureWeek [ i ] . plannedHours !== '' ) {
609+ let plannedHoursId = `#plannedHours0_${ i } ` ;
610+ cy . get ( plannedHoursId ) . should ( 'include.text' , updatePlanTextsFutureWeek [ i ] . plannedHours ) ;
611+ }
612+ }
613+ if ( planTextsFutureWeek [ i ] . secondShift ) {
614+ let secondShiftId = `#secondShift0_${ i } ` ;
615+ cy . get ( secondShiftId ) . should ( 'include.text' , updatePlanTextsFutureWeek [ i ] . secondShift ) ;
616+ }
617+ }
566618 } ) ;
567619} ) ;
0 commit comments