Fix flaky UI test for custom variables list (#32114)

# Details

Fixes a flaky UI test introduced with the Secrets page. The failure was
due to some bugs in the test code (see comments).
This commit is contained in:
Scott Gress 2025-08-20 14:56:39 -04:00 committed by GitHub
parent d4be9f6569
commit ba9b204875
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ describe("Custom variables", () => {
},
{
name: "SECRET_DOS",
id: 1,
id: 2,
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
},
@ -255,13 +255,14 @@ describe("Custom variables", () => {
})
).toBeInTheDocument();
});
await new Promise((resolve) => setTimeout(resolve, 250));
await user.click(screen.getByRole("button", { name: "Delete" }));
await waitFor(() => {
expect(
screen.queryByText(/Delete custom variable\?/)
).not.toBeInTheDocument();
expect(screen.queryByText("SECRET_UNO")).not.toBeInTheDocument();
expect(screen.queryByText("SECRET_DOS")).not.toBeInTheDocument();
expect(screen.queryByText("SECRET_DOS")).toBeInTheDocument();
});
});
});