1
1
import { test , expect } from "@playwright/test" ;
2
2
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
6
8
7
- await page . goto ( "/server-starter-all-features/feature/agentic_generative_ui " ) ;
9
+ await page . goto ( "/server-starter-all-features/feature/backend_tool_rendering " ) ;
8
10
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
10
15
await expect ( page . getByRole ( "button" , { name : "Weather in San Francisco" } ) ) . toBeVisible ( {
11
- timeout : 5000 ,
16
+ timeout : 15000 ,
12
17
} ) ;
13
18
14
19
// Click first suggestion and verify weather card appears
15
20
await page . getByRole ( "button" , { name : "Weather in San Francisco" } ) . click ( ) ;
16
21
17
- // Wait for either test ID or fallback to "Current Weather" text
22
+ // Wait longer for weather card to appear (backend processing time)
18
23
const weatherCard = page . getByTestId ( "weather-card" ) ;
19
24
const currentWeatherText = page . getByText ( "Current Weather" ) ;
20
25
21
- // Try test ID first, fallback to text
26
+ // Try test ID first with longer timeout, fallback to text
27
+ let weatherVisible = false ;
22
28
try {
23
- await expect ( weatherCard ) . toBeVisible ( { timeout : 10000 } ) ;
29
+ await expect ( weatherCard ) . toBeVisible ( { timeout : 20000 } ) ;
30
+ weatherVisible = true ;
24
31
} catch ( e ) {
25
32
// 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 ( / H u m i d i t y | W i n d | T e m p e r a t u r e / i) . count ( ) ;
39
+ weatherVisible = weatherContent > 0 ;
40
+ }
27
41
}
28
42
43
+ expect ( weatherVisible ) . toBeTruthy ( ) ;
44
+
29
45
// Verify weather content is present (use flexible selectors)
46
+ await page . waitForTimeout ( 1000 ) ; // Give elements time to render
47
+
30
48
const hasHumidity = await page
31
49
. getByText ( "Humidity" )
32
50
. isVisible ( )
@@ -46,7 +64,7 @@ test("[MastraAgentLocal] Backend Tool Rendering displays weather cards", async (
46
64
47
65
// Click second suggestion
48
66
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
50
68
51
69
// Verify at least one weather-related element is still visible
52
70
const weatherElements = await page . getByText ( / W e a t h e r | H u m i d i t y | W i n d | T e m p e r a t u r e / i) . count ( ) ;
0 commit comments