File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,20 @@ test.describe("Weather Widget", () => {
7474 await page . goto ( "/form" ) ;
7575
7676 // Wait for the weather widget to load
77- await page . waitForSelector ( "text=Current Weather" , { timeout : 5000 } ) ;
77+ await page . waitForSelector ( "text=Current Weather" , { timeout : 3000 } ) ;
7878
7979 // Check if temperature and wind speed are displayed
80- const temperature = await page . locator ( "text=Temperature:" ) . isVisible ( ) ;
81- const windSpeed = await page . locator ( "text=Wind Speed:" ) . isVisible ( ) ;
82-
83- expect ( temperature ) . toBeTruthy ( ) ;
84- expect ( windSpeed ) . toBeTruthy ( ) ;
80+ const temperatureText = await page
81+ . locator ( "text=Temperature:" )
82+ . last ( )
83+ . textContent ( ) ;
84+ const windSpeedText = await page
85+ . locator ( "text=Wind Speed:" )
86+ . last ( )
87+ . textContent ( ) ;
88+
89+ expect ( temperatureText ) . toMatch ( / T e m p e r a t u r e : \d + \. \d + ° C / ) ;
90+ expect ( windSpeedText ) . toMatch ( / W i n d S p e e d : \d + \. \d + k m \/ h / ) ;
8591 } ) ;
8692} ) ;
8793
You can’t perform that action at this time.
0 commit comments