Skip to content

Commit c8260e4

Browse files
committed
Optimizing the test a bit.
1 parent 576df69 commit c8260e4

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

eform-client/cypress/e2e/plugins/time-planning-pn/b/dashboard-assert.spec.cy.ts

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ describe('Dashboard assert', () => {
324324
// cy.get('#plannedHours3').should('include.text', '56:00');
325325
//
326326
// for (let i = 0; i < planTexts.length; i++) {
327-
// let plannedHoursId = `#plannedHours3_${i}`;
327+
// let plannedHoursId = `#plannedHours0_${i}`;
328328
// cy.get(plannedHoursId).should('include.text', planTexts[i].plannedHours);
329-
// let flexBalanceToDateId = `#flexBalanceToDate3_${i}`;
329+
// let flexBalanceToDateId = `#flexBalanceToDate0_${i}`;
330330
// cy.get(flexBalanceToDateId).should('include.text', planTexts[i].flexBalanceToDate);
331331
//
332-
// let cellId = `#cell3_${i}`;
332+
// let cellId = `#cell0_${i}`;
333333
// cy.get(cellId).click();
334334
// cy.get('#planHours').should('be.visible');
335335
// cy.get('#planHours').should('include.value', planTexts[i].calculatedHours);
@@ -349,7 +349,7 @@ describe('Dashboard assert', () => {
349349
//
350350
// for (let i = 0; i < planTextsNextWeek.length; i++) {
351351
//
352-
// let cellId = `#cell3_${i}`;
352+
// let cellId = `#cell0_${i}`;
353353
// cy.get(cellId).click();
354354
// cy.get('#planHours').should('be.visible');
355355
// cy.get('#planHours').should('include.value', 0);
@@ -489,16 +489,20 @@ describe('Dashboard assert', () => {
489489
cy.get('mat-tree-node').contains('Dashboard').click();
490490
cy.wait('@index-update', { timeout: 60000 });
491491
cy.get('mat-toolbar > button .mat-mdc-button-persistent-ripple').parent().click();
492+
493+
cy.get('#workingHoursSite').clear().type('c d');
494+
cy.get('.ng-option.ng-option-marked').click();
495+
cy.wait('@index-update', { timeout: 60000 });
492496
cy.get('#backwards').click();
493497
cy.wait('@index-update', { timeout: 60000 });
494498
cy.get('#plannedHours3').should('include.text', '53:15');
495499
for (let i = 0; i < planTexts.length; i++) {
496-
let plannedHoursId = `#plannedHours3_${i}`;
500+
let plannedHoursId = `#plannedHours0_${i}`;
497501
// cy.get(plannedHoursId).should('include.text', planTexts[i].plannedHours);
498-
let flexBalanceToDateId = `#flexBalanceToDate3_${i}`;
502+
let flexBalanceToDateId = `#flexBalanceToDate0_${i}`;
499503
cy.get(flexBalanceToDateId).should('include.text', planTexts[i].flexBalanceToDate);
500504

501-
let cellId = `#cell3_${i}`;
505+
let cellId = `#cell0_${i}`;
502506
cy.get(cellId).scrollIntoView();
503507
cy.get(cellId).click();
504508
cy.get('#planHours').should('be.visible');
@@ -520,14 +524,14 @@ describe('Dashboard assert', () => {
520524
cy.wait('@index-update', { timeout: 60000 });
521525
cy.wait(1000);
522526
for (let i = 0; i < planTextsNextWeek.length; i++) {
523-
let firstShiftId = `#firstShift3_${i}`;
527+
let firstShiftId = `#firstShift0_${i}`;
524528
cy.get(firstShiftId).should('include.text', planTextsNextWeek[i].firstShift);
525529
if (planTextsNextWeek[i].secondShift) {
526-
let secondShiftId = `#secondShift3_${i}`;
530+
let secondShiftId = `#secondShift0_${i}`;
527531
cy.get(secondShiftId).should('include.text', planTextsNextWeek[i].secondShift);
528532
}
529533

530-
let cellId = `#cell3_${i}`;
534+
let cellId = `#cell0_${i}`;
531535
cy.get(cellId).scrollIntoView();
532536
cy.get(cellId).click();
533537
cy.get('#planHours').should('be.visible');
@@ -546,18 +550,18 @@ describe('Dashboard assert', () => {
546550
cy.wait(1000);
547551
for (let i = 0; i < planTextsFutureWeek.length; i++) {
548552
if (planTextsFutureWeek[i].firstShift) {
549-
let firstShiftId = `#firstShift3_${i}`;
553+
let firstShiftId = `#firstShift0_${i}`;
550554
cy.get(firstShiftId).should('include.text', planTextsFutureWeek[i].firstShift);
551555
} else {
552-
let plannedHoursId = `#plannedHours3_${i}`;
556+
let plannedHoursId = `#plannedHours0_${i}`;
553557
cy.get(plannedHoursId).should('include.text', planTextsFutureWeek[i].plannedHours);
554558
}
555559
if (planTextsFutureWeek[i].secondShift) {
556-
let secondShiftId = `#secondShift3_${i}`;
560+
let secondShiftId = `#secondShift0_${i}`;
557561
cy.get(secondShiftId).should('include.text', planTextsFutureWeek[i].secondShift);
558562
}
559563

560-
let cellId = `#cell3_${i}`;
564+
let cellId = `#cell0_${i}`;
561565
cy.get(cellId).scrollIntoView();
562566
cy.get(cellId).click();
563567
cy.get('#planHours').should('be.visible');
@@ -672,20 +676,23 @@ describe('Dashboard assert', () => {
672676
cy.intercept('POST', '**/api/time-planning-pn/plannings/index').as('index-update');
673677
cy.get('mat-tree-node').contains('Dashboard').click();
674678
cy.wait('@index-update', { timeout: 60000 });
679+
cy.get('#workingHoursSite').clear().type('c d');
680+
cy.get('.ng-option.ng-option-marked').click();
681+
cy.wait('@index-update', { timeout: 60000 });
675682
cy.get('#backwards').click();
676683
cy.wait('@index-update', { timeout: 60000 });
677684
cy.get('#plannedHours3').should('include.text', '53:15');
678685
for (let i = 0; i < updatePlanTexts.length; i++) {
679-
// let plannedHoursId = `#plannedHours3_${i}`;
686+
// let plannedHoursId = `#plannedHours0_${i}`;
680687
// if (updatePlanTexts[i].plannedHours !== '') {
681688
// cy.get(plannedHoursId).should('include.text', updatePlanTexts[i].plannedHours);
682689
// }
683-
let flexBalanceToDateId = `#flexBalanceToDate3_${i}`;
690+
let flexBalanceToDateId = `#flexBalanceToDate0_${i}`;
684691
if (updatePlanTexts[i].flexBalanceToDate !== '') {
685692
cy.get(flexBalanceToDateId).should('include.text', updatePlanTexts[i].flexBalanceToDate);
686693
}
687694

688-
let cellId = `#cell3_${i}`;
695+
let cellId = `#cell0_${i}`;
689696
cy.get(cellId).scrollIntoView();
690697
cy.get(cellId).click();
691698
cy.get('#planHours').should('be.visible');
@@ -707,14 +714,14 @@ describe('Dashboard assert', () => {
707714
cy.wait('@index-update', { timeout: 60000 });
708715
cy.wait(500);
709716
for (let i = 0; i < updatePlanTextsNextWeek.length; i++) {
710-
let firstShiftId = `#firstShift3_${i}`;
717+
let firstShiftId = `#firstShift0_${i}`;
711718
cy.get(firstShiftId).should('include.text', updatePlanTextsNextWeek[i].firstShift);
712719
if (planTextsNextWeek[i].secondShift) {
713-
let secondShiftId = `#secondShift3_${i}`;
720+
let secondShiftId = `#secondShift0_${i}`;
714721
cy.get(secondShiftId).should('include.text', updatePlanTextsNextWeek[i].secondShift);
715722
}
716723

717-
let cellId = `#cell3_${i}`;
724+
let cellId = `#cell0_${i}`;
718725
cy.get(cellId).scrollIntoView();
719726
cy.get(cellId).click();
720727
cy.get('#planHours').should('be.visible');
@@ -732,19 +739,19 @@ describe('Dashboard assert', () => {
732739
cy.wait(500);
733740
for (let i = 0; i < updatePlanTextsFutureWeek.length; i++) {
734741
if (planTextsFutureWeek[i].firstShift) {
735-
let firstShiftId = `#firstShift3_${i}`;
742+
let firstShiftId = `#firstShift0_${i}`;
736743
cy.get(firstShiftId).should('include.text', updatePlanTextsFutureWeek[i].firstShift);
737744
} else {
738745
if (updatePlanTextsFutureWeek[i].plannedHours !== '') {
739-
let plannedHoursId = `#plannedHours3_${i}`;
746+
let plannedHoursId = `#plannedHours0_${i}`;
740747
cy.get(plannedHoursId).should('include.text', updatePlanTextsFutureWeek[i].plannedHours);
741748
}
742749
}
743750
if (planTextsFutureWeek[i].secondShift) {
744-
let secondShiftId = `#secondShift3_${i}`;
751+
let secondShiftId = `#secondShift0_${i}`;
745752
cy.get(secondShiftId).should('include.text', updatePlanTextsFutureWeek[i].secondShift);
746753
}
747-
let cellId = `#cell3_${i}`;
754+
let cellId = `#cell0_${i}`;
748755
cy.get(cellId).scrollIntoView();
749756
cy.get(cellId).click();
750757
cy.get('#planHours').should('be.visible');

0 commit comments

Comments
 (0)