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 } ) => {