Skip to content

Commit f0c8dba

Browse files
renemadsenclaude
andcommitted
fix: target input element specifically for mat-checkbox click({force:true})
Clicking the mat-checkbox host with force:true regressed tests because it hits the zero-size label. Target the native input element directly instead, which has proper coordinates within the .mdc-checkbox overlay. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f1557ec commit f0c8dba

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ export class PairingRowObject {
142142
clickCancel = false
143143
) {
144144
if (clickOnPairRow) {
145-
await this.pairRowForClick.click({ force: true });
145+
await this.pairRowForClick.locator('input').click({ force: true });
146146
await this.page.waitForTimeout(500);
147147
if ((await this.pairRow.locator('input').isChecked()) !== pair) {
148-
await this.pairRowForClick.click({ force: true });
148+
await this.pairRowForClick.locator('input').click({ force: true });
149149
await this.page.waitForTimeout(500);
150150
}
151151
} else {
152152
for (let i = 0; i < this.pairCheckboxesForClick.length; i++) {
153153
if ((await this.pairCheckboxes[i].locator('input').isChecked()) !== pair) {
154-
await this.pairCheckboxesForClick[i].click({ force: true });
154+
await this.pairCheckboxesForClick[i].locator('input').click({ force: true });
155155
await this.page.waitForTimeout(500);
156156
}
157157
}
@@ -164,7 +164,7 @@ export class PairingRowObject {
164164
indexDeviceForPair: number,
165165
clickCancel = false
166166
) {
167-
await this.pairCheckboxesForClick[indexDeviceForPair].click({ force: true });
167+
await this.pairCheckboxesForClick[indexDeviceForPair].locator('input').click({ force: true });
168168
await this.page.waitForTimeout(1000);
169169
await this.pairingPage.savePairing(clickCancel);
170170
}
@@ -216,16 +216,16 @@ export class PairingColObject {
216216
clickCancel = false
217217
) {
218218
if (clickOnPairRow) {
219-
await this.pairColForClick.click({ force: true });
219+
await this.pairColForClick.locator('input').click({ force: true });
220220
await this.page.waitForTimeout(500);
221221
if ((await this.pairCol.locator('input').isChecked()) !== pair) {
222-
await this.pairColForClick.click({ force: true });
222+
await this.pairColForClick.locator('input').click({ force: true });
223223
await this.page.waitForTimeout(500);
224224
}
225225
} else {
226226
for (let i = 0; i < this.pairCheckboxesForClick.length; i++) {
227227
if ((await this.pairCheckboxes[i].locator('input').isChecked()) !== pair) {
228-
await this.pairCheckboxesForClick[i].click({ force: true });
228+
await this.pairCheckboxesForClick[i].locator('input').click({ force: true });
229229
await this.page.waitForTimeout(500);
230230
}
231231
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ export class ItemsPlanningPlanningPage extends PageWithNavbarPage {
211211

212212
async selectAllPlanningsForDelete(valueCheckbox = true, pickOne = false) {
213213
if (!pickOne) {
214-
// Use force:true to fire a trusted click on the mat-checkbox even if visually hidden
215-
await this.selectAllPlanningsCheckbox.click({ force: true });
214+
// Click the hidden native input with force — fires a trusted click event
215+
await this.selectAllPlanningsCheckbox.locator('input').click({ force: true });
216216
await this.page.waitForTimeout(1000);
217217
} else {
218218
const plannings = await this.getAllPlannings(0, false);
@@ -452,7 +452,7 @@ export class PlanningRowObject {
452452
async clickOnCheckboxForMultipleDelete(valueCheckbox = true) {
453453
const isChecked = await this.checkboxDelete.locator('input').isChecked().catch(() => false);
454454
if (isChecked !== valueCheckbox) {
455-
await this.checkboxDelete.click({ force: true });
455+
await this.checkboxDelete.locator('input').click({ force: true });
456456
await this.page.waitForTimeout(500);
457457
}
458458
}

0 commit comments

Comments
 (0)