Skip to content

Commit 91bbc1f

Browse files
committed
Address PR #1327 review: replace last().click() with getByRole
Harden the remaining Cancel-button selector in the edit-modal cancel test — `.oc-modal button:has-text('Cancel')` + `.last()` silently picks whichever Cancel is last in DOM order, which is fragile if a future render adds a second cancel-like control. Switch to `getByRole("button", { name: "Cancel", exact: true })` to match the Save-Changes pattern used earlier in the file.
1 parent aa21704 commit 91bbc1f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

frontend/tests/CorpusAgentManagement.ct.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ test.describe("CorpusAgentManagement", () => {
744744
).toBeVisible({ timeout: 5000 });
745745

746746
// Click Cancel in the modal footer
747-
await page.locator(".oc-modal button:has-text('Cancel')").last().click();
747+
await page.getByRole("button", { name: "Cancel", exact: true }).click();
748748

749749
await expect(
750750
page.getByText(`Edit Agent Configuration: ${sampleAgent.name}`, {

0 commit comments

Comments
 (0)