11import { 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 ( / 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+ }
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 ( / 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