Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions apps/dojo/e2e/tests/cloudflareTests/agenticChatPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { AgenticChatPage } from "../../featurePages/AgenticChatPage";

test("[Cloudflare] Agentic Chat sends and receives a greeting message", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/agentic_chat");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });
await chat.sendMessage("Hi");

await waitForAIResponse(page);
await chat.assertUserMessageVisible("Hi");
await chat.assertAgentReplyVisible(/Hello|Hi|hey/i);
});
});

test("[Cloudflare] Agentic Chat responds to questions", async ({ page }) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/agentic_chat");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("What is 2+2?");
await chat.assertUserMessageVisible("What is 2+2?");
await waitForAIResponse(page);

await chat.assertAgentReplyVisible(/4|four/i);
});
});

test("[Cloudflare] Agentic Chat retains conversation context", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/agentic_chat");

const chat = new AgenticChatPage(page);
await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

// First message
await chat.sendMessage("My name is Alice");
await chat.assertUserMessageVisible("My name is Alice");
await waitForAIResponse(page);
await chat.assertAgentReplyVisible(/Alice/i);

// Check if agent remembers
await chat.sendMessage("What is my name?");
await chat.assertUserMessageVisible("What is my name?");
await waitForAIResponse(page);
await chat.assertAgentReplyVisible(/Alice/i);
});
});
49 changes: 49 additions & 0 deletions apps/dojo/e2e/tests/cloudflareTests/agenticGenUI.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { AgenticChatPage } from "../../featurePages/AgenticChatPage";

test("[Cloudflare] Agentic Gen UI breaks down tasks into steps", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/agentic_generative_ui");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("How do I make a sandwich?");
await waitForAIResponse(page);

// Should see numbered steps
await expect(page.getByText(/1\./)).toBeVisible({ timeout: 15000 });
await expect(page.getByText(/2\./)).toBeVisible({ timeout: 5000 });
});
});

test("[Cloudflare] Agentic Gen UI generates multiple steps", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/agentic_generative_ui");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("What are the steps to learn TypeScript?");
await waitForAIResponse(page);

// Should see a structured list of steps
const agentMessage = page.locator(".copilotKitAssistantMessage").last();
await expect(agentMessage).toContainText(/TypeScript|steps/i, {
timeout: 15000,
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { AgenticChatPage } from "../../featurePages/AgenticChatPage";

test("[Cloudflare] Backend Tool Rendering responds to queries", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/backend_tool_rendering");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("Hello");
await waitForAIResponse(page);

await chat.assertAgentReplyVisible(/hello|hi|hey/i);
});
});

test("[Cloudflare] Backend Tool Rendering handles tool calls", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/backend_tool_rendering");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("Can you help me with information?");
await waitForAIResponse(page);

const agentMessage = page.locator(".copilotKitAssistantMessage").last();
await expect(agentMessage).toBeVisible({ timeout: 15000 });
});
});
47 changes: 47 additions & 0 deletions apps/dojo/e2e/tests/cloudflareTests/humanInTheLoopPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { AgenticChatPage } from "../../featurePages/AgenticChatPage";

test("[Cloudflare] Human in the Loop generates task steps for approval", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/human_in_the_loop");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("Help me plan a website launch");
await waitForAIResponse(page);

// Should present steps for user review
await chat.assertAgentReplyVisible(/step|plan|website/i);
});
});

test("[Cloudflare] Human in the Loop responds to task requests", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/human_in_the_loop");

const chat = new AgenticChatPage(page);

await chat.openChat();
await chat.agentGreeting.waitFor({ state: "visible" });

await chat.sendMessage("I need to organize a team meeting");
await waitForAIResponse(page);

const agentMessage = page.locator(".copilotKitAssistantMessage").last();
await expect(agentMessage).toContainText(/meeting|organize|step/i, {
timeout: 15000,
});
});
});
70 changes: 70 additions & 0 deletions apps/dojo/e2e/tests/cloudflareTests/sharedStatePage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { SharedStatePage } from "../../featurePages/SharedStatePage";

test("[Cloudflare] Shared State can add a todo item", async ({ page }) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/shared_state");

const sharedState = new SharedStatePage(page);

await sharedState.openChat();
await sharedState.agentGreeting.waitFor({ state: "visible" });

const todoItem = "Buy groceries";
await sharedState.sendMessage(`Add todo: ${todoItem}`);
await waitForAIResponse(page);

// Check that todo appears in the list
await expect(page.getByText(todoItem)).toBeVisible({ timeout: 10000 });
});
});

test("[Cloudflare] Shared State can list todos", async ({ page }) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/shared_state");

const sharedState = new SharedStatePage(page);

await sharedState.openChat();
await sharedState.agentGreeting.waitFor({ state: "visible" });

// Add a todo
await sharedState.sendMessage("Add todo: Test task");
await waitForAIResponse(page);

// Request list
await sharedState.sendMessage("Show my todos");
await waitForAIResponse(page);

await sharedState.assertAgentReplyVisible(/Test task/i);
});
});

test("[Cloudflare] Shared State persists todos across messages", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/shared_state");

const sharedState = new SharedStatePage(page);

await sharedState.openChat();
await sharedState.agentGreeting.waitFor({ state: "visible" });

// Add multiple todos
await sharedState.sendMessage("Add todo: First task");
await waitForAIResponse(page);

await sharedState.sendMessage("Add todo: Second task");
await waitForAIResponse(page);

// Verify both appear
await expect(page.getByText("First task")).toBeVisible();
await expect(page.getByText("Second task")).toBeVisible();
});
});
46 changes: 46 additions & 0 deletions apps/dojo/e2e/tests/cloudflareTests/toolBasedGenUIPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
test,
expect,
waitForAIResponse,
retryOnAIFailure,
} from "../../test-isolation-helper";
import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage";

test("[Cloudflare] Tool-Based Gen UI generates a haiku", async ({ page }) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/tool_based_generative_ui");

const toolGenUI = new ToolBaseGenUIPage(page);

await toolGenUI.openChat();
await toolGenUI.agentGreeting.waitFor({ state: "visible" });

await toolGenUI.sendMessage("Write me a haiku about coding");
await waitForAIResponse(page);

// Should see a haiku response with Japanese and English lines
const agentMessage = page
.locator(".copilotKitAssistantMessage")
.last();

await expect(agentMessage).toBeVisible({ timeout: 15000 });
});
});

test("[Cloudflare] Tool-Based Gen UI responds to different topics", async ({
page,
}) => {
await retryOnAIFailure(async () => {
await page.goto("/cloudflare/feature/tool_based_generative_ui");

const toolGenUI = new ToolBaseGenUIPage(page);

await toolGenUI.openChat();
await toolGenUI.agentGreeting.waitFor({ state: "visible" });

await toolGenUI.sendMessage("Create a haiku about nature");
await waitForAIResponse(page);

await toolGenUI.assertAgentReplyVisible(/haiku|nature|poem/i);
});
});
1 change: 1 addition & 0 deletions apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@ag-ui/a2a-middleware": "workspace:*",
"@ag-ui/adk": "workspace:*",
"@ag-ui/agno": "workspace:*",
"@ag-ui/cloudflare": "workspace:*",
"@ag-ui/crewai": "workspace:*",
"@ag-ui/langgraph": "workspace:*",
"@ag-ui/llamaindex": "workspace:*",
Expand Down
15 changes: 15 additions & 0 deletions apps/dojo/scripts/generate-content-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,21 @@ const agentFilesMapper: Record<string, (agentKeys: string[]) => Record<string, s
{},
);
},
cloudflare: (agentKeys: string[]) => {
return agentKeys.reduce(
(acc, agentId) => ({
...acc,
[agentId]: [
path.join(
__dirname,
integrationsFolderPath,
`/cloudflare/typescript/examples/src/agents/${agentId}/agent.ts`,
),
],
}),
{},
);
},
};

async function runGenerateContent() {
Expand Down
5 changes: 5 additions & 0 deletions apps/dojo/scripts/prep-dojo-everything.js
100755 β†’ 100644
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ const ALL_TARGETS = {
name: "A2A Middleware",
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
},
cloudflare: {
command: 'pnpm install --no-frozen-lockfile',
name: 'Cloudflare',
cwd: path.join(integrationsRoot, 'cloudflare/typescript/examples')
},
dojo: {
command: "pnpm install --no-frozen-lockfile && pnpm build --filter=demo-viewer...",
name: "Dojo",
Expand Down
7 changes: 7 additions & 0 deletions apps/dojo/scripts/run-dojo-everything.js
100755 β†’ 100644
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ const ALL_SERVICES = {
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
env: { PORT: 8014 },
}],
cloudflare: [{
command: 'pnpm start',
name: 'Cloudflare',
cwd: path.join(integrationsRoot, 'cloudflare/typescript/examples'),
env: { PORT: 4114, HOST: '0.0.0.0' }
}],
'dojo': [{
command: 'pnpm run start',
name: 'Dojo',
Expand All @@ -157,6 +163,7 @@ const ALL_SERVICES = {
LLAMA_INDEX_URL: 'http://localhost:8007',
MASTRA_URL: 'http://localhost:8008',
PYDANTIC_AI_URL: 'http://localhost:8009',
CLOUDFLARE_URL: 'http://localhost:4114',
ADK_MIDDLEWARE_URL: 'http://localhost:8010',
A2A_MIDDLEWARE_BUILDINGS_MANAGEMENT_URL: 'http://localhost:8011',
A2A_MIDDLEWARE_FINANCE_URL: 'http://localhost:8012',
Expand Down
Loading