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.
This commit is contained in:
Yuneng Jiang 2026-09-06 07:04:21 -07:00
parent b0e53bfbe4
commit bbc6ca6205
No known key found for this signature in database

View file

@ -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 <EMAIL_ADDRESS> or call <PHONE_NUMBER>.`)).toBeVisible({
timeout: 20_000,
});
const maskedPrompt = drawer.getByText(`${marker}. Email me at <EMAIL_ADDRESS> or call <PHONE_NUMBER>.`);
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 });