Skip to content

Commit 7515933

Browse files
committed
chore: fix agentic chat flaky test
1 parent 8eb0d9f commit 7515933

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

typescript-sdk/apps/dojo/e2e/tests/langgraphPythonTests/agenticChatPage.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async (
4040
await chat.agentGreeting.waitFor({ state: "visible" });
4141

4242
// Store initial background color
43-
const initialBackground = await chat.getBackground();
43+
const backgroundContainer = page.locator('[data-testid="background-container"]')
44+
const initialBackground = await backgroundContainer.evaluate(el => getComputedStyle(el).backgroundColor);
4445
console.log("Initial background color:", initialBackground);
4546

4647
// 1. Send message to change background to blue
@@ -50,8 +51,8 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async (
5051
);
5152
await waitForAIResponse(page);
5253

53-
const backgroundBlue = await chat.getBackground();
54-
expect(backgroundBlue).not.toBe(initialBackground);
54+
await expect(backgroundContainer).not.toHaveCSS('background-color', initialBackground, { timeout: 7000 });
55+
const backgroundBlue = await backgroundContainer.evaluate(el => getComputedStyle(el).backgroundColor);
5556
// Check if background is blue (string color name or contains blue)
5657
expect(backgroundBlue.toLowerCase()).toMatch(/blue|rgb\(.*,.*,.*\)|#[0-9a-f]{6}/);
5758

@@ -62,8 +63,8 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async (
6263
);
6364
await waitForAIResponse(page);
6465

65-
const backgroundPink = await chat.getBackground();
66-
expect(backgroundPink).not.toBe(backgroundBlue);
66+
await expect(backgroundContainer).not.toHaveCSS('background-color', backgroundBlue, { timeout: 7000 });
67+
const backgroundPink = await backgroundContainer.evaluate(el => getComputedStyle(el).backgroundColor);
6768
// Check if background is pink (string color name or contains pink)
6869
expect(backgroundPink.toLowerCase()).toMatch(/pink|rgb\(.*,.*,.*\)|#[0-9a-f]{6}/);
6970
});

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/agentic_chat/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const Chat = () => {
5050
});
5151

5252
return (
53-
<div className="flex justify-center items-center h-full w-full" style={{ background }}>
53+
<div className="flex justify-center items-center h-full w-full" data-testid="background-container" style={{ background }}>
5454
<div className="h-full w-full md:w-8/10 md:h-8/10 rounded-lg">
5555
<CopilotChat
5656
className="h-full rounded-2xl"

0 commit comments

Comments
 (0)