* Don't use expect within Promises (#5466) If a call to expect fails within a Promise it will not be resolved, and causing the test to crash. The patch aligns the code similar to what is used by all the other tests.
This commit is contained in:
parent
dfb2e6056b
commit
6cfe142af1
5
src/protocol.d.ts
vendored
5
src/protocol.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
// This is generated from /utils/protocol-types-generator/index.js
|
// This is generated from /utils/protocol-types-generator/index.js
|
||||||
type binary = string;
|
type binary = string;
|
||||||
|
|
||||||
declare module Protocol {
|
declare module Protocol {
|
||||||
export module Accessibility {
|
export module Accessibility {
|
||||||
@ -15498,5 +15498,6 @@ unsubscribes current runtime agent from Runtime.bindingCalled notifications.
|
|||||||
"Runtime.removeBinding": Runtime.removeBindingReturnValue;
|
"Runtime.removeBinding": Runtime.removeBindingReturnValue;
|
||||||
"Schema.getDomains": Schema.getDomainsReturnValue;
|
"Schema.getDomains": Schema.getDomainsReturnValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Protocol;
|
export default Protocol;
|
||||||
|
@ -25,16 +25,22 @@ const {
|
|||||||
describe('Page.Events.Dialog', function () {
|
describe('Page.Events.Dialog', function () {
|
||||||
setupTestBrowserHooks();
|
setupTestBrowserHooks();
|
||||||
setupTestPageAndContextHooks();
|
setupTestPageAndContextHooks();
|
||||||
|
|
||||||
it('should fire', async () => {
|
it('should fire', async () => {
|
||||||
const { page } = getTestState();
|
const { page } = getTestState();
|
||||||
|
|
||||||
page.on('dialog', (dialog) => {
|
const onDialog = sinon.stub().callsFake((dialog) => {
|
||||||
|
dialog.accept();
|
||||||
|
});
|
||||||
|
page.on('dialog', onDialog);
|
||||||
|
|
||||||
|
await page.evaluate(() => alert('yo'));
|
||||||
|
|
||||||
|
expect(onDialog.callCount).toEqual(1);
|
||||||
|
const dialog = onDialog.firstCall.args[0];
|
||||||
expect(dialog.type()).toBe('alert');
|
expect(dialog.type()).toBe('alert');
|
||||||
expect(dialog.defaultValue()).toBe('');
|
expect(dialog.defaultValue()).toBe('');
|
||||||
expect(dialog.message()).toBe('yo');
|
expect(dialog.message()).toBe('yo');
|
||||||
dialog.accept();
|
|
||||||
});
|
|
||||||
await page.evaluate(() => alert('yo'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
itFailsFirefox('should allow accepting prompts', async () => {
|
itFailsFirefox('should allow accepting prompts', async () => {
|
||||||
|
@ -163,15 +163,21 @@ describe('navigation', function () {
|
|||||||
|
|
||||||
// Make sure that network events do not emit 'undefined'.
|
// Make sure that network events do not emit 'undefined'.
|
||||||
// @see https://crbug.com/750469
|
// @see https://crbug.com/750469
|
||||||
page.on('request', (request) => expect(request).toBeTruthy());
|
const requests = [];
|
||||||
page.on('requestfinished', (request) => expect(request).toBeTruthy());
|
page.on('request', (request) => requests.push('request'));
|
||||||
page.on('requestfailed', (request) => expect(request).toBeTruthy());
|
page.on('requestfinished', (request) => requests.push('requestfinished'));
|
||||||
|
page.on('requestfailed', (request) => requests.push('requestfailed'));
|
||||||
|
|
||||||
let error = null;
|
let error = null;
|
||||||
await page
|
await page
|
||||||
.goto(httpsServer.EMPTY_PAGE)
|
.goto(httpsServer.EMPTY_PAGE)
|
||||||
.catch((error_) => (error = error_));
|
.catch((error_) => (error = error_));
|
||||||
if (isChrome) expect(error.message).toContain(EXPECTED_SSL_CERT_MESSAGE);
|
if (isChrome) expect(error.message).toContain(EXPECTED_SSL_CERT_MESSAGE);
|
||||||
else expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
else expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
||||||
|
|
||||||
|
expect(requests.length).toBe(2);
|
||||||
|
expect(requests[0]).toBe('request');
|
||||||
|
expect(requests[1]).toBe('requestfailed');
|
||||||
});
|
});
|
||||||
itFailsFirefox(
|
itFailsFirefox(
|
||||||
'should fail when navigating to bad SSL after redirects',
|
'should fail when navigating to bad SSL after redirects',
|
||||||
|
Loading…
Reference in New Issue
Block a user