File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,25 @@ setup('authenticate', async ({ page }) => {
1212
1313 await page . click ( '#wp-submit' )
1414
15- await page . waitForURL ( / w p - a d m i n / )
16- await page . waitForSelector ( '#wpbody-content, #adminmenu' )
15+ // If WordPress shows the DB upgrade interstitial it includes a link to
16+ // `upgrade.php`. In that case navigate back to `/wp-admin` (the upgrade
17+ // process is handled by the environment) and then wait for the admin UI.
18+ const upgradeLink = page . locator ( 'a[href*="upgrade.php"]' )
19+ if ( 0 < await upgradeLink . count ( ) ) {
20+ // Click the upgrade link to reach the upgrade interstitial page.
21+ await upgradeLink . first ( ) . click ( )
22+
23+ // If the interstitial shows an "Update WordPress Database" action, click it.
24+ const updateBtn = page . locator ( 'a:has-text("Update WordPress Database")' )
25+ if ( 0 < await updateBtn . count ( ) ) {
26+ await updateBtn . first ( ) . click ( )
27+ }
28+ // Give the upgrade process more time to complete and the admin UI to load.
29+ await page . waitForSelector ( '#wpbody-content, #adminmenu' , { timeout : 120000 } )
30+ } else {
31+ // Normal path: wait for admin UI.
32+ await page . waitForSelector ( '#wpbody-content, #adminmenu' , { timeout : 60000 } )
33+ }
1734
1835 await expect ( page . locator ( '#adminmenu' ) ) . toBeVisible ( )
1936
You can’t perform that action at this time.
0 commit comments