From bbc6ca6205c00dcb47a56789b4a639a29ed0e468 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Sun, 6 Sep 2026 07:04:21 -0700 Subject: [PATCH] fix(e2e/ui): stop the masked-prompt assertion tripping strict mode The Logs drawer renders the masked prompt in three places, so matching it without narrowing raised a strict mode violation instead of asserting visibility. CI caught it as a flake: the spec failed its first attempt on b0e53bfbe4 and passed on retry, which is a locator defect rather than a timing one and would have gone red on any run that saw all three nodes. Narrow to the first match, matching the guardrail-name assertion above it. The leak checks below stay on toHaveCount(0), which is unaffected by multiple matches and is what actually proves nothing raw reached the drawer. --- tests/e2e/ui/tests/guardrails/presidioUserStory.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/e2e/ui/tests/guardrails/presidioUserStory.spec.ts b/tests/e2e/ui/tests/guardrails/presidioUserStory.spec.ts index 975b343287a..3ab5b820896 100644 --- a/tests/e2e/ui/tests/guardrails/presidioUserStory.spec.ts +++ b/tests/e2e/ui/tests/guardrails/presidioUserStory.spec.ts @@ -139,9 +139,8 @@ test.describe("Presidio PII guardrail, end to end from the dashboard", () => { const drawer = page.getByRole("dialog").first(); await expect(drawer.getByText("Guardrails & Policy Compliance")).toBeVisible({ timeout: 20_000 }); await expect(drawer.getByText(`Pre-call guardrail: ${guardrailName}`).first()).toBeVisible({ timeout: 20_000 }); - await expect(drawer.getByText(`${marker}. Email me at or call .`)).toBeVisible({ - timeout: 20_000, - }); + const maskedPrompt = drawer.getByText(`${marker}. Email me at or call .`); + await expect(maskedPrompt.first()).toBeVisible({ timeout: 20_000 }); await drawer.getByText("2 matched").first().click(); await expect(drawer.getByText("Detected Entities (2)").first()).toBeVisible({ timeout: 10_000 });