diff --git a/frontend/e2e/checkCompanyServiceShifts.spec.js b/frontend/e2e/checkCompanyServiceShifts.spec.js index ac04d98..d3c5c9f 100644 --- a/frontend/e2e/checkCompanyServiceShifts.spec.js +++ b/frontend/e2e/checkCompanyServiceShifts.spec.js @@ -25,5 +25,57 @@ test.describe("Check Company Service Shifts", () => { // Show Subtitle const dateRange = await page.locator("text=Del 05/08/2024 al 11/08/2024"); await expect(dateRange).toBeVisible(); + + // Check if all days are rendered + const days = [ + "Lunes 05 de Agosto", + "Martes 06 de Agosto", + "Miercoles 07 de Agosto", + "Jueves 08 de Agosto", + "Viernes 09 de Agosto", + "Sabado 10 de Agosto", + "Domingo 11 de Agosto", + ]; + + for (const day of days) { + await expect(page.locator(`[aria-label="Day ${day}"]`)).toBeVisible(); + await expect(page.locator(`[aria-label="Header ${day}"]`)).toHaveText( + day + ); + } + + const timeBlocks = [ + { start: "09:00", end: "10:00", engineer: "Engineer 1" }, + { start: "10:00", end: "11:00", engineer: "Engineer 2" }, + ]; + + // Check if time blocks and engineers are rendered correctly for a specific day + for (const timeBlock of timeBlocks) { + const specificTimeBlock = page.locator( + `[aria-label="Time block Lunes 05 de Agosto ${timeBlock.start}"]` + ); + + await expect(specificTimeBlock).toBeVisible(); + await expect( + specificTimeBlock.locator(`[aria-label="Hour ${timeBlock.start}"]`) + ).toHaveText(`${timeBlock.start} - ${timeBlock.end}`); + await expect( + specificTimeBlock.locator( + `[aria-label="Engineer Assigned ${timeBlock.engineer}"]` + ) + ).toHaveText(timeBlock.engineer); + } + + // Check for an unassigned time block + const unassignedTimeBlock = page.locator( + '[aria-label="Time block Martes 06 de Agosto 09:00"]' + ); + await expect(unassignedTimeBlock).toBeVisible(); + await expect( + unassignedTimeBlock.locator('[aria-label="Hour 09:00"]') + ).toHaveText("09:00 - 10:00"); + await expect( + unassignedTimeBlock.locator('[aria-label="Engineer Assigned ⚠"]') + ).toHaveText("⚠"); }); }); diff --git a/frontend/src/components/ShiftManagement/ShiftTable.vue b/frontend/src/components/ShiftManagement/ShiftTable.vue index 69cb50b..d55aada 100644 --- a/frontend/src/components/ShiftManagement/ShiftTable.vue +++ b/frontend/src/components/ShiftManagement/ShiftTable.vue @@ -4,6 +4,8 @@ v-for="shift in shifts" :key="shift.day" class="border rounded-lg p-4 shadow-lg bg-white" + :aria-label="`Day ${shift.day}`" + role="table" > @@ -11,6 +13,7 @@ @@ -20,13 +23,21 @@ -
{{ shift.day }}
+ {{ timeBlock.start_time }} - {{ timeBlock.end_time }} {{ getEngineerName(timeBlock.engineer) }}