* 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
29941
src/protocol.d.ts
vendored
29941
src/protocol.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -25,16 +25,22 @@ const {
|
||||
describe('Page.Events.Dialog', function () {
|
||||
setupTestBrowserHooks();
|
||||
setupTestPageAndContextHooks();
|
||||
|
||||
it('should fire', async () => {
|
||||
const { page } = getTestState();
|
||||
|
||||
page.on('dialog', (dialog) => {
|
||||
expect(dialog.type()).toBe('alert');
|
||||
expect(dialog.defaultValue()).toBe('');
|
||||
expect(dialog.message()).toBe('yo');
|
||||
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.defaultValue()).toBe('');
|
||||
expect(dialog.message()).toBe('yo');
|
||||
});
|
||||
|
||||
itFailsFirefox('should allow accepting prompts', async () => {
|
||||
|
@ -163,15 +163,21 @@ describe('navigation', function () {
|
||||
|
||||
// Make sure that network events do not emit 'undefined'.
|
||||
// @see https://crbug.com/750469
|
||||
page.on('request', (request) => expect(request).toBeTruthy());
|
||||
page.on('requestfinished', (request) => expect(request).toBeTruthy());
|
||||
page.on('requestfailed', (request) => expect(request).toBeTruthy());
|
||||
const requests = [];
|
||||
page.on('request', (request) => requests.push('request'));
|
||||
page.on('requestfinished', (request) => requests.push('requestfinished'));
|
||||
page.on('requestfailed', (request) => requests.push('requestfailed'));
|
||||
|
||||
let error = null;
|
||||
await page
|
||||
.goto(httpsServer.EMPTY_PAGE)
|
||||
.catch((error_) => (error = error_));
|
||||
if (isChrome) expect(error.message).toContain(EXPECTED_SSL_CERT_MESSAGE);
|
||||
else expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
||||
|
||||
expect(requests.length).toBe(2);
|
||||
expect(requests[0]).toBe('request');
|
||||
expect(requests[1]).toBe('requestfailed');
|
||||
});
|
||||
itFailsFirefox(
|
||||
'should fail when navigating to bad SSL after redirects',
|
||||
|
Loading…
Reference in New Issue
Block a user