Skip to content

Commit

Permalink
test: fix flaky page event test
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Feb 11, 2020
1 parent 5323700 commit 20e2bac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/launcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
const remote = await playwright.connect({ wsEndpoint: browserServer.wsEndpoint() });
const context = await remote.newContext();
const page = await context.newPage();
let contextClosed = false;
let pageClosed = false;
context.on('close', e => contextClosed = true);
page.on('close', e => pageClosed = true);
await browserServer.close();
expect(contextClosed).toBeTruthy();
await Promise.all([
new Promise(f => context.on('close', f)),
browserServer.close()
]);
expect(pageClosed).toBeTruthy();
});
});
Expand Down

0 comments on commit 20e2bac

Please sign in to comment.