fix(tracing): start without options (#4388)
This commit is contained in:
parent
9a2fb2a0d4
commit
ef24c69c62
@ -180,7 +180,7 @@
|
||||
- [class: Touchscreen](#class-touchscreen)
|
||||
* [touchscreen.tap(x, y)](#touchscreentapx-y)
|
||||
- [class: Tracing](#class-tracing)
|
||||
* [tracing.start(options)](#tracingstartoptions)
|
||||
* [tracing.start([options])](#tracingstartoptions)
|
||||
* [tracing.stop()](#tracingstop)
|
||||
- [class: Dialog](#class-dialog)
|
||||
* [dialog.accept([promptText])](#dialogacceptprompttext)
|
||||
@ -2319,7 +2319,7 @@ await page.goto('https://www.google.com');
|
||||
await page.tracing.stop();
|
||||
```
|
||||
|
||||
#### tracing.start(options)
|
||||
#### tracing.start([options])
|
||||
- `options` <[Object]>
|
||||
- `path` <[string]> A path to write the trace file to.
|
||||
- `screenshots` <[boolean]> captures screenshots in the trace.
|
||||
|
@ -31,9 +31,9 @@ class Tracing {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!{path: string, screenshots?: boolean, categories?: !Array<string>}} options
|
||||
* @param {!{path?: string, screenshots?: boolean, categories?: !Array<string>}} options
|
||||
*/
|
||||
async start(options) {
|
||||
async start(options = {}) {
|
||||
assert(!this._recording, 'Cannot start recording trace while already recording trace.');
|
||||
|
||||
const defaultCategories = [
|
||||
@ -75,7 +75,7 @@ class Tracing {
|
||||
|
||||
/**
|
||||
* @param {string} handle
|
||||
* @param {string} path
|
||||
* @param {?string} path
|
||||
*/
|
||||
async _readStream(handle, path) {
|
||||
let eof = false;
|
||||
|
@ -66,6 +66,12 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
||||
const buf = fs.readFileSync(outputFile);
|
||||
expect(trace.toString()).toEqual(buf.toString());
|
||||
});
|
||||
it('should work without options', async({page, server, outputFile}) => {
|
||||
await page.tracing.start();
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const trace = await page.tracing.stop();
|
||||
expect(trace).toBeTruthy();
|
||||
});
|
||||
it('should return null in case of Buffer error', async({page, server}) => {
|
||||
await page.tracing.start({screenshots: true});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
|
Loading…
Reference in New Issue
Block a user