chore: remove top level errors and DeviceDescriptors (#6043)
As far as I can tell these became irrelevant as of v1.15 which added
`puppeteer.errors` and `puppeteer.devices [1]. This is a breaking change
but one that's easily mitigated. We've said that we don't consider
changes to our folder/file structure a breaking change, but we can't
really do that if we have these two top level files that we've
documented.
[1]: e3abb0aa32 (diff-522b24108d7446af4c59873472a90444)
This commit is contained in:
parent
5ff698ec98
commit
7a4170fe6e
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Copyright 2019 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = require('./lib/common/DeviceDescriptors');
|
17
Errors.js
17
Errors.js
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Copyright 2018 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = require('./lib/common/Errors');
|
@ -514,8 +514,6 @@ const iPhone = puppeteer.devices['iPhone 6'];
|
||||
})();
|
||||
```
|
||||
|
||||
> **NOTE** The old way (Puppeteer versions <= v1.14.0) devices can be obtained with `require('puppeteer/DeviceDescriptors')`.
|
||||
|
||||
#### puppeteer.errors
|
||||
- returns: <[Object]>
|
||||
- `TimeoutError` <[function]> A class of [TimeoutError].
|
||||
|
@ -17,12 +17,11 @@
|
||||
'use strict';
|
||||
|
||||
const puppeteer = require('puppeteer');
|
||||
const devices = require('puppeteer/DeviceDescriptors');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.emulate(devices['iPhone 6']);
|
||||
await page.emulate(puppeteer.devices['iPhone 6']);
|
||||
await page.goto('https://www.nytimes.com/');
|
||||
await page.screenshot({ path: 'full.png', fullPage: true });
|
||||
await browser.close();
|
||||
|
@ -39,8 +39,6 @@
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"Errors.js",
|
||||
"DeviceDescriptors.js",
|
||||
"index.js",
|
||||
"install.js",
|
||||
"typescript-if-required.js"
|
||||
|
@ -592,22 +592,6 @@ describe('Launcher specs', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Top-level requires', function () {
|
||||
it('should require top-level Errors', async () => {
|
||||
const { puppeteer, puppeteerPath } = getTestState();
|
||||
const Errors = require(path.join(puppeteerPath, '/Errors'));
|
||||
expect(Errors.TimeoutError).toBe(puppeteer.errors.TimeoutError);
|
||||
});
|
||||
it('should require top-level DeviceDescriptors', async () => {
|
||||
const { puppeteer, puppeteerPath } = getTestState();
|
||||
const { devicesMap } = require(path.join(
|
||||
puppeteerPath,
|
||||
'/DeviceDescriptors'
|
||||
));
|
||||
expect(devicesMap['iPhone 6']).toBe(puppeteer.devices['iPhone 6']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Browser target events', function () {
|
||||
itFailsFirefox('should work', async () => {
|
||||
const { server, puppeteer, defaultBrowserOptions } = getTestState();
|
||||
|
Loading…
Reference in New Issue
Block a user