chore: fix ESLint violation and lessen rule strictness (#6081)

This commit is contained in:
Jack Franklin 2020-06-23 12:55:42 +01:00 committed by GitHub
parent fdc6fda46e
commit 70a900e93b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 285 additions and 101 deletions

View File

@ -100,6 +100,11 @@ module.exports = {
"@typescript-eslint/semi": 2,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-use-before-define": 0,
// We have to use any on some types so the warning isn't valuable.
"@typescript-eslint/no-explicit-any": 0,
// We don't require explicit return types on basic functions or
// dummy functions in tests, for example
"@typescript-eslint/explicit-function-return-type": 0,
// We know it's bad and use it very sparingly but it's needed :(
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/array-type": [2, {

View File

@ -9,7 +9,7 @@ This searches for a target in this specific browser context.
<b>Signature:</b>
```typescript
waitForTarget(predicate: (x: Target) => boolean, options: {
waitForTarget(predicate: (x: Target) => boolean, options?: {
timeout?: number;
}): Promise<Target>;
```

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
download(revision: string, progressCallback: (x: number, y: number) => void): Promise<BrowserFetcherRevisionInfo>;
download(revision: string, progressCallback?: (x: number, y: number) => void): Promise<BrowserFetcherRevisionInfo>;
```
## Parameters

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
startCSSCoverage(options: {
startCSSCoverage(options?: {
resetOnNavigation?: boolean;
}): Promise<void>;
```

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
startJSCoverage(options: {
startJSCoverage(options?: {
resetOnNavigation?: boolean;
reportAnonymousScripts?: boolean;
}): Promise<void>;

View File

@ -9,7 +9,7 @@ This method scrolls element into view if needed, and then uses [Page.mouse](./pu
<b>Signature:</b>
```typescript
click(options: ClickOptions): Promise<void>;
click(options?: ClickOptions): Promise<void>;
```
## Parameters

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
click(selector: string, options: {
click(selector: string, options?: {
delay?: number;
button?: MouseButtonInput;
clickCount?: number;

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
waitForNavigation(options: {
waitForNavigation(options?: {
timeout?: number;
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
}): Promise<HTTPResponse | null>;

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
waitForSelector(selector: string, options: WaitForSelectorOptions): Promise<ElementHandle | null>;
waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<ElementHandle | null>;
```
## Parameters

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
waitForXPath(xpath: string, options: WaitForSelectorOptions): Promise<ElementHandle | null>;
waitForXPath(xpath: string, options?: WaitForSelectorOptions): Promise<ElementHandle | null>;
```
## Parameters

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
type(text: string, options: {
type(text: string, options?: {
delay?: number;
}): Promise<void>;
```

View File

@ -1,77 +1,78 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md)
## puppeteer package
## Classes
| Class | Description |
| --- | --- |
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)<!-- -->. |
| [Browser](./puppeteer.browser.md) | A Browser is created when Puppeteer connects to a Chromium instance, either through [Puppeteer.launch()](./puppeteer.puppeteer.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md)<!-- -->. |
| [BrowserContext](./puppeteer.browsercontext.md) | BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method [Browser.newPage](./puppeteer.browser.newpage.md) creates a page in the default browser context. |
| [BrowserFetcher](./puppeteer.browserfetcher.md) | |
| [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. |
| [Connection](./puppeteer.connection.md) | |
| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. |
| [Coverage](./puppeteer.coverage.md) | |
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. |
| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. |
| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. |
| [ExecutionContext](./puppeteer.executioncontext.md) | |
| [FileChooser](./puppeteer.filechooser.md) | |
| [Frame](./puppeteer.frame.md) | |
| [FrameManager](./puppeteer.framemanager.md) | |
| [HTTPRequest](./puppeteer.httprequest.md) | |
| [HTTPResponse](./puppeteer.httpresponse.md) | |
| [JSHandle](./puppeteer.jshandle.md) | |
| [Keyboard](./puppeteer.keyboard.md) | |
| [Mouse](./puppeteer.mouse.md) | |
| [Page](./puppeteer.page.md) | Page provides methods to interact with a single tab or \[extension background page\](https://developer.chrome.com/extensions/background\_pages) in Chromium. One \[Browser\] instance might have multiple \[Page\] instances. |
| [Puppeteer](./puppeteer.puppeteer.md) | The main Puppeteer class |
| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
| [Target](./puppeteer.target.md) | |
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
| [Touchscreen](./puppeteer.touchscreen.md) | |
| [Tracing](./puppeteer.tracing.md) | |
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)<!-- -->. |
## Enumerations
| Enumeration | Description |
| --- | --- |
| [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. |
## Interfaces
| Interface | Description |
| --- | --- |
| [BoundingBox](./puppeteer.boundingbox.md) | |
| [BoxModel](./puppeteer.boxmodel.md) | |
| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
| [ClickOptions](./puppeteer.clickoptions.md) | |
| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | |
| [KeyDefinition](./puppeteer.keydefinition.md) | Copyright 2017 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. |
| [PressOptions](./puppeteer.pressoptions.md) | |
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
## Variables
| Variable | Description |
| --- | --- |
| [EVALUATION\_SCRIPT\_URL](./puppeteer.evaluation_script_url.md) | |
| [keyDefinitions](./puppeteer.keydefinitions.md) | |
| [puppeteerErrors](./puppeteer.puppeteererrors.md) | |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. |
| [KeyInput](./puppeteer.keyinput.md) | |
| [MouseButtonInput](./puppeteer.mousebuttoninput.md) | |
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md)
## puppeteer package
## Classes
| Class | Description |
| --- | --- |
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access)<!-- -->. |
| [Browser](./puppeteer.browser.md) | A Browser is created when Puppeteer connects to a Chromium instance, either through [Puppeteer.launch()](./puppeteer.puppeteer.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md)<!-- -->. |
| [BrowserContext](./puppeteer.browsercontext.md) | BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method [Browser.newPage](./puppeteer.browser.newpage.md) creates a page in the default browser context. |
| [BrowserFetcher](./puppeteer.browserfetcher.md) | |
| [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. |
| [Connection](./puppeteer.connection.md) | |
| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. |
| [Coverage](./puppeteer.coverage.md) | |
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. |
| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. |
| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. |
| [ExecutionContext](./puppeteer.executioncontext.md) | |
| [FileChooser](./puppeteer.filechooser.md) | |
| [Frame](./puppeteer.frame.md) | |
| [FrameManager](./puppeteer.framemanager.md) | |
| [HTTPRequest](./puppeteer.httprequest.md) | |
| [HTTPResponse](./puppeteer.httpresponse.md) | |
| [JSHandle](./puppeteer.jshandle.md) | |
| [Keyboard](./puppeteer.keyboard.md) | |
| [Mouse](./puppeteer.mouse.md) | |
| [Page](./puppeteer.page.md) | Page provides methods to interact with a single tab or \[extension background page\](https://developer.chrome.com/extensions/background\_pages) in Chromium. One \[Browser\] instance might have multiple \[Page\] instances. |
| [Puppeteer](./puppeteer.puppeteer.md) | The main Puppeteer class |
| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
| [Target](./puppeteer.target.md) | |
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
| [Touchscreen](./puppeteer.touchscreen.md) | |
| [Tracing](./puppeteer.tracing.md) | |
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)<!-- -->. |
## Enumerations
| Enumeration | Description |
| --- | --- |
| [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. |
## Interfaces
| Interface | Description |
| --- | --- |
| [BoundingBox](./puppeteer.boundingbox.md) | |
| [BoxModel](./puppeteer.boxmodel.md) | |
| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
| [ClickOptions](./puppeteer.clickoptions.md) | |
| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | |
| [KeyDefinition](./puppeteer.keydefinition.md) | Copyright 2017 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. |
| [Metrics](./puppeteer.metrics.md) | |
| [PressOptions](./puppeteer.pressoptions.md) | |
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
## Variables
| Variable | Description |
| --- | --- |
| [EVALUATION\_SCRIPT\_URL](./puppeteer.evaluation_script_url.md) | |
| [keyDefinitions](./puppeteer.keydefinitions.md) | |
| [puppeteerErrors](./puppeteer.puppeteererrors.md) | |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. |
| [KeyInput](./puppeteer.keyinput.md) | |
| [MouseButtonInput](./puppeteer.mousebuttoninput.md) | |
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [Documents](./puppeteer.metrics.documents.md)
## Metrics.Documents property
<b>Signature:</b>
```typescript
Documents?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [Frames](./puppeteer.metrics.frames.md)
## Metrics.Frames property
<b>Signature:</b>
```typescript
Frames?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [JSEventListeners](./puppeteer.metrics.jseventlisteners.md)
## Metrics.JSEventListeners property
<b>Signature:</b>
```typescript
JSEventListeners?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [JSHeapTotalSize](./puppeteer.metrics.jsheaptotalsize.md)
## Metrics.JSHeapTotalSize property
<b>Signature:</b>
```typescript
JSHeapTotalSize?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [JSHeapUsedSize](./puppeteer.metrics.jsheapusedsize.md)
## Metrics.JSHeapUsedSize property
<b>Signature:</b>
```typescript
JSHeapUsedSize?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [LayoutCount](./puppeteer.metrics.layoutcount.md)
## Metrics.LayoutCount property
<b>Signature:</b>
```typescript
LayoutCount?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [LayoutDuration](./puppeteer.metrics.layoutduration.md)
## Metrics.LayoutDuration property
<b>Signature:</b>
```typescript
LayoutDuration?: number;
```

View File

@ -0,0 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md)
## Metrics interface
<b>Signature:</b>
```typescript
export interface Metrics
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [Documents](./puppeteer.metrics.documents.md) | number | |
| [Frames](./puppeteer.metrics.frames.md) | number | |
| [JSEventListeners](./puppeteer.metrics.jseventlisteners.md) | number | |
| [JSHeapTotalSize](./puppeteer.metrics.jsheaptotalsize.md) | number | |
| [JSHeapUsedSize](./puppeteer.metrics.jsheapusedsize.md) | number | |
| [LayoutCount](./puppeteer.metrics.layoutcount.md) | number | |
| [LayoutDuration](./puppeteer.metrics.layoutduration.md) | number | |
| [Nodes](./puppeteer.metrics.nodes.md) | number | |
| [RecalcStyleCount](./puppeteer.metrics.recalcstylecount.md) | number | |
| [RecalcStyleDuration](./puppeteer.metrics.recalcstyleduration.md) | number | |
| [ScriptDuration](./puppeteer.metrics.scriptduration.md) | number | |
| [TaskDuration](./puppeteer.metrics.taskduration.md) | number | |
| [Timestamp](./puppeteer.metrics.timestamp.md) | number | |

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [Nodes](./puppeteer.metrics.nodes.md)
## Metrics.Nodes property
<b>Signature:</b>
```typescript
Nodes?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [RecalcStyleCount](./puppeteer.metrics.recalcstylecount.md)
## Metrics.RecalcStyleCount property
<b>Signature:</b>
```typescript
RecalcStyleCount?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [RecalcStyleDuration](./puppeteer.metrics.recalcstyleduration.md)
## Metrics.RecalcStyleDuration property
<b>Signature:</b>
```typescript
RecalcStyleDuration?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [ScriptDuration](./puppeteer.metrics.scriptduration.md)
## Metrics.ScriptDuration property
<b>Signature:</b>
```typescript
ScriptDuration?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [TaskDuration](./puppeteer.metrics.taskduration.md)
## Metrics.TaskDuration property
<b>Signature:</b>
```typescript
TaskDuration?: number;
```

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Metrics](./puppeteer.metrics.md) &gt; [Timestamp](./puppeteer.metrics.timestamp.md)
## Metrics.Timestamp property
<b>Signature:</b>
```typescript
Timestamp?: number;
```

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
goBack(options: WaitForOptions): Promise<HTTPResponse | null>;
goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
```
## Parameters

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
goForward(options: WaitForOptions): Promise<HTTPResponse | null>;
goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
```
## Parameters

View File

@ -11,5 +11,5 @@ metrics(): Promise<Metrics>;
```
<b>Returns:</b>
Promise&lt;Metrics&gt;
Promise&lt;[Metrics](./puppeteer.metrics.md)<!-- -->&gt;

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
setContent(html: string, options: WaitForOptions): Promise<void>;
setContent(html: string, options?: WaitForOptions): Promise<void>;
```
## Parameters

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
waitForFunction(pageFunction: Function, options?: {
waitForFunction(pageFunction: Function | string, options?: {
timeout?: number;
polling?: string | number;
}, ...args: unknown[]): Promise<JSHandle>;
@ -17,7 +17,7 @@ waitForFunction(pageFunction: Function, options?: {
| Parameter | Type | Description |
| --- | --- | --- |
| pageFunction | Function | |
| pageFunction | Function \| string | |
| options | { timeout?: number; polling?: string \| number; } | |
| args | unknown\[\] | |

View File

@ -7,7 +7,7 @@
<b>Signature:</b>
```typescript
defaultArgs(options: ChromeArgOptions): string[];
defaultArgs(options?: ChromeArgOptions): string[];
```
## Parameters

View File

@ -12,7 +12,7 @@
"firefox_revision": "latest"
},
"scripts": {
"unit": "mocha --config mocha-config/puppeteer-unit-tests.js",
"unit": "tsc --version && mocha --config mocha-config/puppeteer-unit-tests.js",
"unit-with-coverage": "cross-env COVERAGE=1 npm run unit",
"assert-unit-coverage": "cross-env COVERAGE=1 mocha --config mocha-config/coverage-tests.js",
"funit": "PUPPETEER_PRODUCT=firefox npm run unit",
@ -91,7 +91,7 @@
"sinon": "^9.0.2",
"text-diff": "^1.0.1",
"ts-node": "^8.10.2",
"typescript": "3.9.2"
"typescript": "3.9.5"
},
"browser": {
"./lib/BrowserFetcher.js": false,

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
/* This file is used in two places:
* 1) the coverage-utils use it to gain a list of all methods we check for test

View File

@ -108,8 +108,8 @@ const trackCoverage = () => {
return {
beforeAll: () => {
const api = require('../lib/api');
const events = require('../lib/common/Events');
const api = require('../src/api');
const events = require('../src/common/Events');
for (const [className, classType] of Object.entries(api))
traceAPICoverage(coverageMap, events, className, classType);
},

View File

@ -67,7 +67,7 @@ describe('Emulation', () => {
function dispatchTouch() {
let fulfill;
const promise = new Promise((x) => (fulfill = x));
window.ontouchstart = function (e) {
window.ontouchstart = () => {
fulfill('Received touch');
};
window.dispatchEvent(new Event('touchstart'));

View File

@ -65,14 +65,18 @@ describe('navigation', function () {
const response = await page.goto(server.PREFIX + '/historyapi.html');
expect(response.status()).toBe(200);
});
it('should work with subframes return 204', async () => {
itFailsFirefox('should work with subframes return 204', async () => {
const { page, server } = getTestState();
server.setRoute('/frames/frame.html', (req, res) => {
res.statusCode = 204;
res.end();
});
await page.goto(server.PREFIX + '/frames/one-frame.html');
let error = null;
await page
.goto(server.PREFIX + '/frames/one-frame.html')
.catch((error_) => (error = error_));
expect(error).toBe(null);
});
itFailsFirefox('should fail when server returns 204', async () => {
const { page, server, isChrome } = getTestState();