feat: Afficher la couleur des matières dans l'emploi du temps élève et parent
L'admin pouvait attribuer une couleur à chaque matière, mais cette couleur n'était utilisée que dans la vue admin de l'emploi du temps. Les APIs élève et parent ne renvoyaient pas cette information, ce qui donnait un affichage générique (gris/bleu) pour tous les créneaux. L'API renvoie désormais subjectColor dans chaque créneau, et les vues jour/semaine/widget/détails affichent la bordure colorée correspondante. Le marqueur "Prochain cours" conserve sa priorité visuelle via une surcharge CSS variable.
This commit is contained in:
@@ -114,6 +114,21 @@ async function loginAsParent(page: import('@playwright/test').Page) {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Multi-child parents land on the summary view (no child auto-selected).
|
||||
* This helper selects the first actual child (skipping the "Tous" button).
|
||||
*/
|
||||
async function selectFirstChild(page: import('@playwright/test').Page) {
|
||||
const childButtons = page.locator('.child-button');
|
||||
await expect(childButtons.first()).toBeVisible({ timeout: 15000 });
|
||||
const count = await childButtons.count();
|
||||
if (count > 2) {
|
||||
// Multi-child: "Tous" is at index 0, first child at index 1
|
||||
await childButtons.nth(1).click();
|
||||
}
|
||||
// Single child is auto-selected, nothing to do
|
||||
}
|
||||
|
||||
test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
|
||||
@@ -305,6 +320,7 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /emploi du temps des enfants/i })
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await selectFirstChild(page);
|
||||
await navigateToSeededDay(page);
|
||||
|
||||
// Wait for slots to load
|
||||
@@ -324,19 +340,29 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
page.getByRole('heading', { name: /emploi du temps des enfants/i })
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// If multiple children, buttons should be visible
|
||||
// Multi-child: "Tous" + N children buttons
|
||||
const childButtons = page.locator('.child-button');
|
||||
const count = await childButtons.count();
|
||||
|
||||
if (count > 1) {
|
||||
// Click second child
|
||||
if (count > 2) {
|
||||
// Select first child (index 1, after "Tous")
|
||||
await childButtons.nth(1).click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Should update schedule data
|
||||
await navigateToSeededDay(page);
|
||||
const slots = page.locator('[data-testid="schedule-slot"]');
|
||||
await expect(slots.first()).toBeVisible({ timeout: 20000 });
|
||||
await expect(page.locator('[data-testid="schedule-slot"]').first()).toBeVisible({
|
||||
timeout: 20000
|
||||
});
|
||||
|
||||
// Switch to second child (index 2)
|
||||
await childButtons.nth(2).click();
|
||||
await page.waitForTimeout(500);
|
||||
await navigateToSeededDay(page);
|
||||
await expect(page.locator('[data-testid="schedule-slot"]').first()).toBeVisible({
|
||||
timeout: 20000
|
||||
});
|
||||
|
||||
// Switch back to "Tous" summary view
|
||||
await childButtons.nth(0).click();
|
||||
await expect(page.locator('.multi-child-summary')).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -351,6 +377,7 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /emploi du temps des enfants/i })
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await selectFirstChild(page);
|
||||
|
||||
const dayButton = page.locator('.view-toggle button', { hasText: 'Jour' });
|
||||
await expect(dayButton).toHaveClass(/active/, { timeout: 5000 });
|
||||
@@ -362,6 +389,7 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /emploi du temps des enfants/i })
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await selectFirstChild(page);
|
||||
await navigateToSeededDay(page);
|
||||
|
||||
// Wait for slots to load
|
||||
@@ -384,6 +412,7 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /emploi du temps des enfants/i })
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await selectFirstChild(page);
|
||||
await navigateToSeededDay(page);
|
||||
|
||||
await expect(page.locator('[data-testid="schedule-slot"]').first()).toBeVisible({
|
||||
@@ -419,6 +448,7 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /emploi du temps des enfants/i })
|
||||
).toBeVisible({ timeout: 15000 });
|
||||
await selectFirstChild(page);
|
||||
|
||||
// Wait for schedule slots to load
|
||||
await expect(page.locator('[data-testid="schedule-slot"]').first()).toBeVisible({
|
||||
@@ -448,9 +478,11 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
|
||||
const childButtons = page.locator('.child-button');
|
||||
const count = await childButtons.count();
|
||||
test.skip(count < 2, 'Need at least 2 children for this test');
|
||||
// "Tous" + at least 2 children = 3 buttons minimum
|
||||
test.skip(count < 3, 'Need at least 2 children for this test');
|
||||
|
||||
// Navigate to seeded day to see slots
|
||||
// Select first child (index 1, after "Tous")
|
||||
await childButtons.nth(1).click();
|
||||
await navigateToSeededDay(page);
|
||||
|
||||
// First child (6A) should show Maths
|
||||
@@ -461,8 +493,8 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
timeout: 5000
|
||||
});
|
||||
|
||||
// Switch to second child (5B) — should show SVT
|
||||
await childButtons.nth(1).click();
|
||||
// Switch to second child (index 2) (5B) — should show SVT
|
||||
await childButtons.nth(2).click();
|
||||
await navigateToSeededDay(page);
|
||||
await expect(page.locator('[data-testid="schedule-slot"]').first()).toBeVisible({
|
||||
timeout: 20000
|
||||
@@ -480,6 +512,7 @@ test.describe('Parent Schedule Consultation (Story 4.4)', () => {
|
||||
test('shows offline banner when network is lost', async ({ page, context }) => {
|
||||
await loginAsParent(page);
|
||||
await page.goto(`${ALPHA_URL}/dashboard/parent-schedule`);
|
||||
await selectFirstChild(page);
|
||||
await navigateToSeededDay(page);
|
||||
|
||||
// Wait for schedule to load
|
||||
|
||||
Reference in New Issue
Block a user