File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,18 @@ test.describe('Produkter', () => {
17
17
18
18
await expect ( page . getByRole ( 'button' , { name : 'KJØP' } ) ) . toBeVisible ( ) ;
19
19
20
+ // Click the buy button and wait for it to complete
20
21
await page . getByRole ( 'button' , { name : 'KJØP' } ) . click ( ) ;
21
-
22
- await page . locator ( '#header' ) . getByText ( '1' ) . waitFor ( ) ;
23
-
24
- await expect ( page . locator ( '#header' ) . getByText ( '1' ) ) . toBeVisible ( {
25
- timeout : 15000 ,
22
+
23
+ // Wait for network idle to ensure any API calls complete
24
+ await page . waitForLoadState ( 'networkidle' ) ;
25
+
26
+ // More specific selector for the cart count and consistent timeout
27
+ const cartCountSelector = '#header' ;
28
+
29
+ // Wait for cart count to be visible and equal to "1"
30
+ await expect ( page . locator ( cartCountSelector ) . getByText ( '1' ) ) . toBeVisible ( {
31
+ timeout : 30000
26
32
} ) ;
27
33
28
34
await page . getByRole ( 'link' , { name : 'Handlekurv' } ) . click ( ) ;
You can’t perform that action at this time.
0 commit comments