Skip to content

Commit e800aa9

Browse files
committed
tests(dojo): break out langgraph platform tests into typescript and python
Signed-off-by: Tyler Slaton <[email protected]>
1 parent 9a49a4e commit e800aa9

15 files changed

+615
-4
lines changed

.github/workflows/dojo-e2e.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ jobs:
2626
test_path: tests/crewAITests
2727
services: ["dojo","crew-ai"]
2828
wait_on: http://localhost:9999,tcp:localhost:8003
29-
- suite: langgraph
30-
test_path: tests/langgraphTests
31-
services: ["dojo","langgraph-platform-python","langgraph-platform-typescript"]
32-
wait_on: http://localhost:9999,tcp:localhost:8005,tcp:localhost:8006
29+
- suite: langgraph-python
30+
test_path: tests/langgraphPythonTests
31+
services: ["dojo","langgraph-platform-python"]
32+
wait_on: http://localhost:9999,tcp:localhost:8005
33+
- suite: langgraph-typescript
34+
test_path: tests/langgraphTypescriptTests
35+
services: ["dojo","langgraph-platform-typescript"]
36+
wait_on: http://localhost:9999,tcp:localhost:8006
3337
- suite: langgraph-fastapi
3438
test_path: tests/langgraphFastAPITests
3539
services: ["dojo","langgraph-fastapi"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import {
2+
test,
3+
expect,
4+
waitForAIResponse,
5+
retryOnAIFailure,
6+
} from "../../test-isolation-helper";
7+
import { AgenticChatPage } from "../../featurePages/AgenticChatPage";
8+
9+
test("[LangGraph] Agentic Chat sends and receives a message", async ({
10+
page,
11+
}) => {
12+
await retryOnAIFailure(async () => {
13+
await page.goto(
14+
"/langgraph-typescript/feature/agentic_chat"
15+
);
16+
17+
const chat = new AgenticChatPage(page);
18+
19+
await chat.openChat();
20+
await chat.agentGreeting.isVisible;
21+
await chat.sendMessage("Hi, I am duaa");
22+
23+
await waitForAIResponse(page);
24+
await chat.assertUserMessageVisible("Hi, I am duaa");
25+
await chat.assertAgentReplyVisible(/Hello/i);
26+
});
27+
});
28+
29+
test("[LangGraph] Agentic Chat changes background on message and reset", async ({
30+
page,
31+
}) => {
32+
await retryOnAIFailure(async () => {
33+
await page.goto(
34+
"/langgraph-typescript/feature/agentic_chat"
35+
);
36+
37+
const chat = new AgenticChatPage(page);
38+
39+
await chat.openChat();
40+
await chat.agentGreeting.waitFor({ state: "visible" });
41+
42+
// Store initial background color
43+
const initialBackground = await chat.getBackground();
44+
console.log("Initial background color:", initialBackground);
45+
46+
// 1. Send message to change background to blue
47+
await chat.sendMessage("Hi change the background color to blue");
48+
await chat.assertUserMessageVisible(
49+
"Hi change the background color to blue"
50+
);
51+
await waitForAIResponse(page);
52+
53+
const backgroundBlue = await chat.getBackground();
54+
expect(backgroundBlue).not.toBe(initialBackground);
55+
// Check if background is blue (string color name or contains blue)
56+
expect(backgroundBlue.toLowerCase()).toMatch(/blue|rgb\(.*,.*,.*\)|#[0-9a-f]{6}/);
57+
58+
// 2. Change to pink
59+
await chat.sendMessage("Hi change the background color to pink");
60+
await chat.assertUserMessageVisible(
61+
"Hi change the background color to pink"
62+
);
63+
await waitForAIResponse(page);
64+
65+
const backgroundPink = await chat.getBackground();
66+
expect(backgroundPink).not.toBe(backgroundBlue);
67+
// Check if background is pink (string color name or contains pink)
68+
expect(backgroundPink.toLowerCase()).toMatch(/pink|rgb\(.*,.*,.*\)|#[0-9a-f]{6}/);
69+
});
70+
});
71+
72+
test("[LangGraph] Agentic Chat retains memory of user messages during a conversation", async ({
73+
page,
74+
}) => {
75+
await retryOnAIFailure(async () => {
76+
await page.goto(
77+
"/langgraph-typescript/feature/agentic_chat"
78+
);
79+
80+
const chat = new AgenticChatPage(page);
81+
await chat.openChat();
82+
await chat.agentGreeting.click();
83+
84+
await chat.sendMessage("Hey there");
85+
await chat.assertUserMessageVisible("Hey there");
86+
await waitForAIResponse(page);
87+
await chat.assertAgentReplyVisible(/how can I assist you/i);
88+
89+
const favFruit = "Mango";
90+
await chat.sendMessage(`My favorite fruit is ${favFruit}`);
91+
await chat.assertUserMessageVisible(`My favorite fruit is ${favFruit}`);
92+
await waitForAIResponse(page);
93+
await chat.assertAgentReplyVisible(new RegExp(favFruit, "i"));
94+
95+
await chat.sendMessage("and I love listening to Kaavish");
96+
await chat.assertUserMessageVisible("and I love listening to Kaavish");
97+
await waitForAIResponse(page);
98+
await chat.assertAgentReplyVisible(/Kaavish/i);
99+
100+
await chat.sendMessage("tell me an interesting fact about Moon");
101+
await chat.assertUserMessageVisible(
102+
"tell me an interesting fact about Moon"
103+
);
104+
await waitForAIResponse(page);
105+
await chat.assertAgentReplyVisible(/Moon/i);
106+
107+
await chat.sendMessage("Can you remind me what my favorite fruit is?");
108+
await chat.assertUserMessageVisible(
109+
"Can you remind me what my favorite fruit is?"
110+
);
111+
await waitForAIResponse(page);
112+
await chat.assertAgentReplyVisible(new RegExp(favFruit, "i"));
113+
});
114+
});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { test, expect } from "@playwright/test";
2+
import { AgenticGenUIPage } from "../../pages/langGraphPages/AgenticUIGenPage";
3+
4+
test.describe("Agent Generative UI Feature", () => {
5+
test("[LangGraph] should interact with the chat to get a planner on prompt", async ({
6+
page,
7+
}) => {
8+
const genUIAgent = new AgenticGenUIPage(page);
9+
10+
await page.goto(
11+
"/langgraph-typescript/feature/agentic_generative_ui"
12+
);
13+
14+
await genUIAgent.openChat();
15+
await genUIAgent.sendMessage("Hi");
16+
await genUIAgent.sendButton.click();
17+
await genUIAgent.assertAgentReplyVisible(/Hello/);
18+
19+
await genUIAgent.sendMessage("Give me a plan to make brownies");
20+
await genUIAgent.sendButton.click();
21+
22+
await expect(genUIAgent.agentPlannerContainer).toBeVisible({ timeout: 15000 });
23+
24+
await genUIAgent.plan();
25+
26+
await page.waitForFunction(
27+
() => {
28+
const messages = Array.from(document.querySelectorAll('.copilotKitAssistantMessage'));
29+
const lastMessage = messages[messages.length - 1];
30+
const content = lastMessage?.textContent?.trim() || '';
31+
32+
return messages.length >= 3 && content.length > 0;
33+
},
34+
{ timeout: 30000 }
35+
);
36+
});
37+
38+
test("[LangGraph] should interact with the chat using predefined prompts and perform steps", async ({
39+
page,
40+
}) => {
41+
const genUIAgent = new AgenticGenUIPage(page);
42+
43+
await page.goto(
44+
"/langgraph-typescript/feature/agentic_generative_ui"
45+
);
46+
47+
await genUIAgent.openChat();
48+
await genUIAgent.sendMessage("Hi");
49+
await genUIAgent.sendButton.click();
50+
await genUIAgent.assertAgentReplyVisible(/Hello/);
51+
52+
await genUIAgent.sendMessage("Go to Mars");
53+
await genUIAgent.sendButton.click();
54+
55+
await expect(genUIAgent.agentPlannerContainer).toBeVisible({ timeout: 15000 });
56+
await genUIAgent.plan();
57+
58+
await page.waitForFunction(
59+
() => {
60+
const messages = Array.from(document.querySelectorAll('.copilotKitAssistantMessage'));
61+
const lastMessage = messages[messages.length - 1];
62+
const content = lastMessage?.textContent?.trim() || '';
63+
64+
return messages.length >= 3 && content.length > 0;
65+
},
66+
{ timeout: 30000 }
67+
);
68+
});
69+
});

0 commit comments

Comments
 (0)