Skip to content

Commit 54e83ad

Browse files
authored
fix(test): Skip Tavily API key fill when global variable is loaded (#11733)
1 parent 5fea08e commit 54e83ad

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/frontend/tests/core/integrations/Market Research.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ withEventDeliveryModes(
4040

4141
await disableInspectPanel(page);
4242

43-
await page
44-
.getByTestId("popover-anchor-input-api_key")
45-
.fill(process.env.TAVILY_API_KEY || "");
43+
// TAVILY_API_KEY is auto-loaded as a global variable from the
44+
// environment (see VARIABLES_TO_GET_FROM_ENVIRONMENT in constants.py).
45+
// When loaded, the input is replaced by a badge and fill() would fail.
46+
// Only fill manually when the input is still present.
47+
const tavilyApiKeyInput = page.getByTestId("popover-anchor-input-api_key");
48+
if ((await tavilyApiKeyInput.count()) > 0) {
49+
await tavilyApiKeyInput.fill(process.env.TAVILY_API_KEY || "");
50+
}
4651

4752
await unselectNodes(page);
4853

0 commit comments

Comments
 (0)