fix(test): fix flaky worker test
This commit is contained in:
parent
e2710dec29
commit
98ed5f62bb
|
|
@ -25,12 +25,16 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
|
|||
|
||||
describe('Workers', function() {
|
||||
it('Page.workers', async function({page, server}) {
|
||||
const consoleMessagePromise = new Promise(x => page.once('console', x));
|
||||
await Promise.all([
|
||||
page.waitForEvent('workercreated'),
|
||||
page.goto(server.PREFIX + '/worker/worker.html')]);
|
||||
const worker = page.workers()[0];
|
||||
expect(worker.url()).toContain('worker.js');
|
||||
|
||||
// We might otherwise evaluate before the worker has had time to run its initial script.
|
||||
await consoleMessagePromise;
|
||||
|
||||
expect(await worker.evaluate(() => self['workerFunction']())).toBe('worker function result');
|
||||
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
Loading…
Reference in a new issue