Skip to content

Commit 687a03e

Browse files
renemadsenclaude
andcommitted
fix(playwright): enable shifts 3-5 via three save cycles
The assigned-site dialog gates the 4th checkbox on `data.thirdShiftActive` and the 5th on `data.fourthShiftActive` — both bound to the dialog input snapshot, not the live form control. So each flag only materialises after a save + reopen. Loop three times: open dialog, tick the next checkbox, save, close. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ef84a80 commit 687a03e

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

eform-client/playwright/e2e/plugins/time-planning-pn/b/dashboard-edit-multishift.spec.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,28 @@ test.describe('Dashboard — multi-shift (3-5) round-trip regression guard', ()
103103
// Shifts 3-5 are only rendered in the workday-entity dialog when the
104104
// assigned site has thirdShiftActive / fourthShiftActive / fifthShiftActive
105105
// flipped on (see workday-entity-dialog.component.ts:354-363). CI seed
106-
// defaults them all to false, so we open the assigned-site dialog first
107-
// and enable the three cascading checkboxes before editing the day.
108-
await page.locator('#firstColumn0').click();
109-
await expect(page.locator('mat-dialog-container')).toBeVisible({ timeout: 10000 });
110-
111-
for (const id of ['#thirdShiftActive', '#fourthShiftActive', '#fifthShiftActive']) {
112-
const cb = page.locator(`${id} input[type="checkbox"]`);
106+
// defaults them all to false. The assigned-site dialog also gates the
107+
// 4th/5th checkboxes behind `data.thirdShiftActive` / `data.fourthShiftActive`
108+
// — those bindings reflect the snapshot passed into the dialog, so each
109+
// new checkbox only materialises after a save + reopen cycle.
110+
for (const id of ['thirdShiftActive', 'fourthShiftActive', 'fifthShiftActive']) {
111+
await page.locator('#firstColumn0').click();
112+
await expect(page.locator('mat-dialog-container')).toBeVisible({ timeout: 10000 });
113+
114+
const cb = page.locator(`#${id} input[type="checkbox"]`);
113115
await cb.waitFor({ state: 'attached', timeout: 10000 });
114116
if (!(await cb.isChecked())) {
115-
await page.locator(id).click({ force: true });
117+
await page.locator(`#${id}`).click({ force: true });
116118
}
117119
await expect(cb).toBeChecked();
118-
}
119120

120-
const assignSitePromise = page.waitForResponse(
121-
r => r.url().includes('/api/time-planning-pn/settings/assigned-site') && r.request().method() === 'PUT');
122-
await page.locator('#saveButton').click({ force: true });
123-
await assignSitePromise;
124-
await waitForSpinner(page);
125-
await expect(page.locator('mat-dialog-container')).toHaveCount(0, { timeout: 10000 });
121+
const assignSitePromise = page.waitForResponse(
122+
r => r.url().includes('/api/time-planning-pn/settings/assigned-site') && r.request().method() === 'PUT');
123+
await page.locator('#saveButton').click({ force: true });
124+
await assignSitePromise;
125+
await waitForSpinner(page);
126+
await expect(page.locator('mat-dialog-container')).toHaveCount(0, { timeout: 10000 });
127+
}
126128

127129
// Pick any visible day cell — column 3 (worker index), first date in the range.
128130
const cellId = '#cell3_0';

0 commit comments

Comments
 (0)