Skip to content

Commit 34f9b43

Browse files
committed
fix(e2e): server-starter-all backend tool tests
Signed-off-by: Tyler Slaton <[email protected]>
1 parent 1031a6e commit 34f9b43

File tree

2 files changed

+191
-37
lines changed

2 files changed

+191
-37
lines changed

typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/backendToolRenderingPage.spec.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,50 @@
11
import { test, expect } from "@playwright/test";
22

3-
test("[MastraAgentLocal] Backend Tool Rendering displays weather cards", async ({ page }) => {
4-
// Set shorter default timeout for this test
5-
test.setTimeout(30000); // 30 seconds total
3+
test("[ServerStarterAllFeatures] Backend Tool Rendering displays weather cards", async ({
4+
page,
5+
}) => {
6+
// Set longer timeout for this test since server-starter-all-features can be slower
7+
test.setTimeout(60000); // 60 seconds total
68

7-
await page.goto("/server-starter-all-features/feature/agentic_generative_ui");
9+
await page.goto("/server-starter-all-features/feature/backend_tool_rendering");
810

9-
// Verify suggestion buttons are visible
11+
// Wait for page to load - be more lenient with timeout
12+
await page.waitForLoadState("networkidle", { timeout: 15000 }).catch(() => {});
13+
14+
// Verify suggestion buttons are visible with longer timeout
1015
await expect(page.getByRole("button", { name: "Weather in San Francisco" })).toBeVisible({
11-
timeout: 5000,
16+
timeout: 15000,
1217
});
1318

1419
// Click first suggestion and verify weather card appears
1520
await page.getByRole("button", { name: "Weather in San Francisco" }).click();
1621

17-
// Wait for either test ID or fallback to "Current Weather" text
22+
// Wait longer for weather card to appear (backend processing time)
1823
const weatherCard = page.getByTestId("weather-card");
1924
const currentWeatherText = page.getByText("Current Weather");
2025

21-
// Try test ID first, fallback to text
26+
// Try test ID first with longer timeout, fallback to text
27+
let weatherVisible = false;
2228
try {
23-
await expect(weatherCard).toBeVisible({ timeout: 10000 });
29+
await expect(weatherCard).toBeVisible({ timeout: 20000 });
30+
weatherVisible = true;
2431
} catch (e) {
2532
// Fallback to checking for "Current Weather" text
26-
await expect(currentWeatherText.first()).toBeVisible({ timeout: 10000 });
33+
try {
34+
await expect(currentWeatherText.first()).toBeVisible({ timeout: 20000 });
35+
weatherVisible = true;
36+
} catch (e2) {
37+
// Last resort - check for any weather-related content
38+
const weatherContent = await page.getByText(/Humidity|Wind|Temperature/i).count();
39+
weatherVisible = weatherContent > 0;
40+
}
2741
}
2842

43+
expect(weatherVisible).toBeTruthy();
44+
2945
// Verify weather content is present (use flexible selectors)
46+
await page.waitForTimeout(1000); // Give elements time to render
47+
3048
const hasHumidity = await page
3149
.getByText("Humidity")
3250
.isVisible()
@@ -46,7 +64,7 @@ test("[MastraAgentLocal] Backend Tool Rendering displays weather cards", async (
4664

4765
// Click second suggestion
4866
await page.getByRole("button", { name: "Weather in New York" }).click();
49-
await page.waitForTimeout(2000);
67+
await page.waitForTimeout(3000); // Longer wait for backend to process
5068

5169
// Verify at least one weather-related element is still visible
5270
const weatherElements = await page.getByText(/Weather|Humidity|Wind|Temperature/i).count();

0 commit comments

Comments
 (0)