mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(puppeteer): introduce puppeteer.errors and puppeteer.devices (#4312)
These getters are introduced as a more convenient substitute for
a `require('puppeteer/Errors')` and
`require('puppeteer/DeviceDescriptors')`.
This way we can make cross-browser story nicer - a single require
of `puppeteer` or `puppeteer-firefox` fully defines Puppeteer
environment.
This commit is contained in:
@@ -16,11 +16,10 @@
|
||||
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports.addTests = function({testRunner, expect, puppeteer, Errors}) {
|
||||
module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
||||
const {describe, xdescribe, fdescribe} = testRunner;
|
||||
const {it, fit, xit} = testRunner;
|
||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||
const {TimeoutError} = Errors;
|
||||
|
||||
describe('BrowserContext', function() {
|
||||
it('should have default context', async function({browser, server}) {
|
||||
@@ -94,7 +93,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, Errors}) {
|
||||
it('should timeout waiting for a non-existent target', async function({browser, server}) {
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
const error = await context.waitForTarget(target => target.url() === server.EMPTY_PAGE, {timeout: 1}).catch(e => e);
|
||||
expect(error).toBeInstanceOf(TimeoutError);
|
||||
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
||||
await context.close();
|
||||
});
|
||||
it('should isolate localStorage and cookies', async function({browser, server}) {
|
||||
|
||||
Reference in New Issue
Block a user