fix(test): fix race in confusing confuse with previous navigation test (#730)
This commit is contained in:
parent
89a93113f0
commit
4a3bd6008b
|
|
@ -539,8 +539,10 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
|
||||||
let imgResponse = null;
|
let imgResponse = null;
|
||||||
server.setRoute(imgPath, (req, res) => imgResponse = res);
|
server.setRoute(imgPath, (req, res) => imgResponse = res);
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
// get the global object to make sure that the main execution context is alive and well.
|
||||||
|
await page.evaluate(() => this);
|
||||||
// Trigger navigation which might resolve next setContent call.
|
// Trigger navigation which might resolve next setContent call.
|
||||||
page.evaluate(url => window.location.href = url, server.EMPTY_PAGE);
|
const evalPromise = page.evaluate(url => window.location.href = url, server.EMPTY_PAGE);
|
||||||
const contentPromise = page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`).then(() => loaded = true);
|
const contentPromise = page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`).then(() => loaded = true);
|
||||||
await server.waitForRequest(imgPath);
|
await server.waitForRequest(imgPath);
|
||||||
|
|
||||||
|
|
@ -551,6 +553,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
|
||||||
|
|
||||||
imgResponse.end();
|
imgResponse.end();
|
||||||
await contentPromise;
|
await contentPromise;
|
||||||
|
await evalPromise;
|
||||||
});
|
});
|
||||||
it('should work with doctype', async({page, server}) => {
|
it('should work with doctype', async({page, server}) => {
|
||||||
const doctype = '<!DOCTYPE html>';
|
const doctype = '<!DOCTYPE html>';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue