Skip to content

Commit fbfc268

Browse files
renemadsenclaude
andcommitted
fix: revert to dispatchEvent('click') for checkboxes
check({force:true}) doesn't work with MDC mat-checkbox either. Revert to dispatchEvent('click') which was proven to work in Job B. Keep clearTable fallback to single-delete when checkbox fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2eaf457 commit fbfc268

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

eform-client/playwright/e2e/plugins/items-planning-pn/ItemsPlanningPairingPage.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,18 @@ export class PairingRowObject {
142142
clickCancel = false
143143
) {
144144
if (clickOnPairRow) {
145-
const input = this.pairRowForClick.locator('input');
146-
if (pair) { await input.check({ force: true }); } else { await input.uncheck({ force: true }); }
145+
await this.pairRowForClick.dispatchEvent('click');
147146
await this.page.waitForTimeout(500);
147+
if ((await this.pairRow.locator('input').isChecked()) !== pair) {
148+
await this.pairRowForClick.dispatchEvent('click');
149+
await this.page.waitForTimeout(500);
150+
}
148151
} else {
149152
for (let i = 0; i < this.pairCheckboxesForClick.length; i++) {
150-
const input = this.pairCheckboxes[i].locator('input');
151-
if (pair) { await input.check({ force: true }); } else { await input.uncheck({ force: true }); }
152-
await this.page.waitForTimeout(500);
153+
if ((await this.pairCheckboxes[i].locator('input').isChecked()) !== pair) {
154+
await this.pairCheckboxesForClick[i].dispatchEvent('click');
155+
await this.page.waitForTimeout(500);
156+
}
153157
}
154158
}
155159
await this.pairingPage.savePairing(clickCancel);
@@ -160,8 +164,7 @@ export class PairingRowObject {
160164
indexDeviceForPair: number,
161165
clickCancel = false
162166
) {
163-
const input = this.pairCheckboxesForClick[indexDeviceForPair].locator('input');
164-
if (pair) { await input.check({ force: true }); } else { await input.uncheck({ force: true }); }
167+
await this.pairCheckboxesForClick[indexDeviceForPair].dispatchEvent('click');
165168
await this.page.waitForTimeout(1000);
166169
await this.pairingPage.savePairing(clickCancel);
167170
}
@@ -213,14 +216,18 @@ export class PairingColObject {
213216
clickCancel = false
214217
) {
215218
if (clickOnPairRow) {
216-
const input = this.pairColForClick.locator('input');
217-
if (pair) { await input.check({ force: true }); } else { await input.uncheck({ force: true }); }
219+
await this.pairColForClick.dispatchEvent('click');
218220
await this.page.waitForTimeout(500);
221+
if ((await this.pairCol.locator('input').isChecked()) !== pair) {
222+
await this.pairColForClick.dispatchEvent('click');
223+
await this.page.waitForTimeout(500);
224+
}
219225
} else {
220226
for (let i = 0; i < this.pairCheckboxesForClick.length; i++) {
221-
const input = this.pairCheckboxes[i].locator('input');
222-
if (pair) { await input.check({ force: true }); } else { await input.uncheck({ force: true }); }
223-
await this.page.waitForTimeout(500);
227+
if ((await this.pairCheckboxes[i].locator('input').isChecked()) !== pair) {
228+
await this.pairCheckboxesForClick[i].dispatchEvent('click');
229+
await this.page.waitForTimeout(500);
230+
}
224231
}
225232
}
226233
await this.pairingPage.savePairing(clickCancel);

eform-client/playwright/e2e/plugins/items-planning-pn/ItemsPlanningPlanningPage.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,8 @@ export class ItemsPlanningPlanningPage extends PageWithNavbarPage {
204204

205205
async selectAllPlanningsForDelete(valueCheckbox = true, pickOne = false) {
206206
if (!pickOne) {
207-
// Use check/uncheck on the input element with force, matching Cypress approach
208-
const input = this.page.locator('.mat-header-cell mat-checkbox input');
209-
if (valueCheckbox) {
210-
await input.check({ force: true });
211-
} else {
212-
await input.uncheck({ force: true });
213-
}
207+
// Use dispatchEvent on the mat-checkbox host element
208+
await this.selectAllPlanningsCheckbox.dispatchEvent('click');
214209
await this.page.waitForTimeout(1000);
215210
} else {
216211
const plannings = await this.getAllPlannings(0, false);
@@ -448,13 +443,11 @@ export class PlanningRowObject {
448443
}
449444

450445
async clickOnCheckboxForMultipleDelete(valueCheckbox = true) {
451-
const input = this.checkboxDelete.locator('input');
452-
if (valueCheckbox) {
453-
await input.check({ force: true });
454-
} else {
455-
await input.uncheck({ force: true });
446+
const isChecked = await this.checkboxDelete.locator('input').isChecked().catch(() => false);
447+
if (isChecked !== valueCheckbox) {
448+
await this.checkboxDelete.dispatchEvent('click');
449+
await this.page.waitForTimeout(500);
456450
}
457-
await this.page.waitForTimeout(500);
458451
}
459452

460453
async readPairing(): Promise<{ workerName: string; workerValue: boolean }[]> {

0 commit comments

Comments
 (0)