[tests] fix a few tests to avoid unhandled promise rejection (#778)
A few tests were not waiting for navigation to complete.
This commit is contained in:
parent
f398e69dbb
commit
166c909ab2
12
test/test.js
12
test/test.js
@ -1514,8 +1514,10 @@ describe('Page', function() {
|
||||
it('should work', SX(async function() {
|
||||
expect(await page.evaluate(() => navigator.userAgent)).toContain('Mozilla');
|
||||
page.setUserAgent('foobar');
|
||||
page.goto(EMPTY_PAGE);
|
||||
const request = await server.waitForRequest('/empty.html');
|
||||
const [request] = await Promise.all([
|
||||
server.waitForRequest('/empty.html'),
|
||||
page.goto(EMPTY_PAGE),
|
||||
]);
|
||||
expect(request.headers['user-agent']).toBe('foobar');
|
||||
}));
|
||||
it('should emulate device user-agent', SX(async function() {
|
||||
@ -1530,8 +1532,10 @@ describe('Page', function() {
|
||||
await page.setExtraHTTPHeaders({
|
||||
foo: 'bar'
|
||||
});
|
||||
page.goto(EMPTY_PAGE);
|
||||
const request = await server.waitForRequest('/empty.html');
|
||||
const [request] = await Promise.all([
|
||||
server.waitForRequest('/empty.html'),
|
||||
page.goto(EMPTY_PAGE),
|
||||
]);
|
||||
expect(request.headers['foo']).toBe('bar');
|
||||
}));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user