Skip to content

Commit

Permalink
Replace delay with waitForTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
david-szabo97 committed Jan 26, 2021
1 parent 502d571 commit 6cfee3b
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ import { siteEditor } from '../../experimental-features';
async function waitForFileExists( filePath, timeout = 10000 ) {
const start = Date.now();
while ( ! fs.existsSync( filePath ) ) {
await delay( 1000 );
await page.waitForTimeout( 1000 );
if ( Date.now() - start > timeout ) {
throw Error( 'waitForFileExists timeout' );
}
}
}

function delay( time ) {
return new Promise( function ( resolve ) {
setTimeout( resolve, time );
} );
}

describe( 'Site Editor Templates Export', () => {
beforeAll( async () => {
await activateTheme( 'tt1-blocks' );
Expand Down

0 comments on commit 6cfee3b

Please sign in to comment.