@@ -17,24 +17,31 @@ async function openTab(
1717 if ( isMobile ) {
1818 const tabSelect = page . locator ( "select#tabs" ) ;
1919 await expect ( tabSelect ) . toBeVisible ( { timeout : 10000 } ) ;
20+ await expect ( tabSelect ) . toBeEnabled ( { timeout : 5000 } ) ;
2021 await tabSelect . selectOption ( { label : tabName } ) ;
22+ // Wait for mobile navigation to settle
23+ await page . waitForLoadState ( "domcontentloaded" ) ;
2124 } else {
2225 await page . getByRole ( "link" , { name : tabName } ) . click ( ) ;
2326 }
2427
2528 const slug = tabName . toLowerCase ( ) ;
26- await page . waitForURL ( `http://localhost:3000/my-posts?tab=${ slug } ` ) ;
29+ await page . waitForURL ( `http://localhost:3000/my-posts?tab=${ slug } ` , {
30+ timeout : 15000 ,
31+ } ) ;
2732 await expect ( page ) . toHaveURL ( new RegExp ( `\\/my-posts\\?tab=${ slug } ` ) ) ;
2833
2934 // Wait for loading state to complete
3035 await expect ( page . getByText ( "Fetching your posts..." ) ) . toBeHidden ( {
3136 timeout : 20000 ,
3237 } ) ;
3338
34- // Wait for network to settle and at least one article to be visible
39+ // Wait for network to settle and content to load
3540 await page . waitForLoadState ( "domcontentloaded" ) ;
41+
42+ // Wait for at least one article to be visible with increased timeout for mobile
3643 await expect ( page . locator ( "article" ) . first ( ) ) . toBeVisible ( {
37- timeout : 15000 ,
44+ timeout : 20000 ,
3845 } ) ;
3946}
4047
@@ -74,7 +81,9 @@ test.describe("Authenticated my-posts Page", () => {
7481 const tabSelect = page . locator ( "select#tabs" ) ;
7582 await expect ( tabSelect ) . toBeVisible ( { timeout : 10000 } ) ;
7683 // Verify the select has the correct options
77- await expect ( tabSelect . locator ( 'option:has-text("Drafts")' ) ) . toBeVisible ( ) ;
84+ await expect (
85+ tabSelect . locator ( 'option:has-text("Drafts")' ) ,
86+ ) . toBeVisible ( ) ;
7887 await expect (
7988 tabSelect . locator ( 'option:has-text("Scheduled")' ) ,
8089 ) . toBeVisible ( ) ;
0 commit comments