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:
@@ -14,16 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const utils = require('./utils');
|
||||
const DeviceDescriptors = utils.requireRoot('DeviceDescriptors');
|
||||
const iPhone = DeviceDescriptors['iPhone 6'];
|
||||
const iPhoneLandscape = DeviceDescriptors['iPhone 6 landscape'];
|
||||
|
||||
module.exports.addTests = function({testRunner, expect, product}) {
|
||||
module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
||||
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||
|
||||
const iPhone = puppeteer.devices['iPhone 6'];
|
||||
const iPhoneLandscape = puppeteer.devices['iPhone 6 landscape'];
|
||||
|
||||
describe('Page.viewport', function() {
|
||||
it('should get the proper viewport size', async({page, server}) => {
|
||||
expect(page.viewport()).toEqual({width: 800, height: 600});
|
||||
|
||||
Reference in New Issue
Block a user