From c4a0661e07327d769ea7fe44c613de53f7d9c2b4 Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Fri, 6 Nov 2026 17:09:47 +0200 Subject: [PATCH] Build/Test Tools: Wait for maintenance mode to end in E2E tests. The maintenance spec deletes the lock file from the host. On macOS, the Docker file share can show the file as present for about a second after that, and the next spec fails with a require() warning. The spec now waits until the home page loads without this error. See #66455. --- tests/e2e/specs/maintenance-mode.test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/e2e/specs/maintenance-mode.test.js b/tests/e2e/specs/maintenance-mode.test.js index df9d409a07895..6ccbfbb8063f1 100644 --- a/tests/e2e/specs/maintenance-mode.test.js +++ b/tests/e2e/specs/maintenance-mode.test.js @@ -20,8 +20,16 @@ test.describe( 'Maintenance mode', () => { writeFileSync( maintenanceLockFile, '' ); // Year 2286. } ); - test.afterAll( async () => { + test.afterAll( async ( { request } ) => { unlinkSync( maintenanceLockFile ); + + // A Docker file share can report a deleted file as present for about a + // second, and require() then fails in wp_is_maintenance_mode(). + await expect( async () => { + const response = await request.get( '/' ); + await expect( response ).toBeOK(); + expect( await response.text() ).not.toContain( '.maintenance' ); + }, 'should leave maintenance mode after the lock file is deleted' ).toPass( { timeout: 10_000 } ); } ); test( 'should display maintenance mode page', async ( { page } ) => {