diff --git a/docs/api.md b/docs/api.md index 0206885e41..3f790857a2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -29,7 +29,7 @@ - [class: ChromiumBrowser](#class-chromiumbrowser) - [class: ChromiumBrowserContext](#class-chromiumbrowsercontext) - [class: ChromiumCoverage](#class-chromiumcoverage) -- [class: ChromiumSession](#class-chromiumsession) +- [class: CDPSession](#class-cdpsession) - [class: FirefoxBrowser](#class-firefoxbrowser) - [class: WebKitBrowser](#class-webkitbrowser) - [Environment Variables](#environment-variables) @@ -3742,7 +3742,7 @@ await browser.stopTracing(); #### chromiumBrowser.newBrowserCDPSession() -- returns: <[Promise]<[ChromiumSession]>> Promise that resolves to the newly created browser +- returns: <[Promise]<[CDPSession]>> Promise that resolves to the newly created browser session. #### chromiumBrowser.startTracing([page, options]) @@ -3815,7 +3815,7 @@ Emitted when new service worker is created in the context. #### chromiumBrowserContext.newCDPSession(page) - `page` <[Page]> Page to create new session for. -- returns: <[Promise]<[ChromiumSession]>> Promise that resolves to the newly created session. +- returns: <[Promise]<[CDPSession]>> Promise that resolves to the newly created session. ### class: ChromiumCoverage @@ -3882,11 +3882,11 @@ const v8toIstanbul = require('v8-to-istanbul'); > **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported. -### class: ChromiumSession +### class: CDPSession * extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) -The `ChromiumSession` instances are used to talk raw Chrome Devtools Protocol: +The `CDPSession` instances are used to talk raw Chrome Devtools Protocol: - protocol methods can be called with `session.send` method. - protocol events can be subscribed to with `session.on` method. @@ -3906,17 +3906,17 @@ await client.send('Animation.setPlaybackRate', { ``` -- [chromiumSession.detach()](#chromiumsessiondetach) -- [chromiumSession.send(method[, params])](#chromiumsessionsendmethod-params) +- [cdpSession.detach()](#cdpsessiondetach) +- [cdpSession.send(method[, params])](#cdpsessionsendmethod-params) -#### chromiumSession.detach() +#### cdpSession.detach() - returns: <[Promise]> -Detaches the chromiumSession from the target. Once detached, the chromiumSession object won't emit any events and can't be used +Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages. -#### chromiumSession.send(method[, params]) +#### cdpSession.send(method[, params]) - `method` <[string]> protocol method name - `params` <[Object]> Optional method parameters - returns: <[Promise]<[Object]>> @@ -4040,7 +4040,7 @@ const { chromium } = require('playwright'); [ChromiumBrowser]: #class-chromiumbrowser "ChromiumBrowser" [ChromiumBrowserContext]: #class-chromiumbrowsercontext "ChromiumBrowserContext" [ChromiumCoverage]: #class-chromiumcoverage "ChromiumCoverage" -[ChromiumSession]: #class-chromiumsession "ChromiumSession" +[CDPSession]: #class-cdpsession "CDPSession" [ConsoleMessage]: #class-consolemessage "ConsoleMessage" [Dialog]: #class-dialog "Dialog" [ElementHandle]: #class-elementhandle "ElementHandle" diff --git a/src/api.ts b/src/api.ts index e042dfe12a..831a2de6c5 100644 --- a/src/api.ts +++ b/src/api.ts @@ -31,7 +31,7 @@ export { Selectors } from './selectors'; export { CRBrowser as ChromiumBrowser } from './chromium/crBrowser'; export { CRBrowserContext as ChromiumBrowserContext } from './chromium/crBrowser'; export { CRCoverage as ChromiumCoverage } from './chromium/crCoverage'; -export { CRSession as ChromiumSession } from './chromium/crConnection'; +export { CRSession as CDPSession } from './chromium/crConnection'; export { FFBrowser as FirefoxBrowser } from './firefox/ffBrowser'; diff --git a/test/test.js b/test/test.js index 8ba57f8663..ed151c92a3 100644 --- a/test/test.js +++ b/test/test.js @@ -85,12 +85,12 @@ const BROWSER_CONFIGS = [ ...require('../lib/events').Events, ...require('../lib/chromium/events').Events, }, - missingCoverage: ['browserContext.setGeolocation', 'browserContext.setOffline', 'worker.url'], + missingCoverage: ['browserContext.setGeolocation', 'browserContext.setOffline', 'worker.url', 'cDPSession.send', 'cDPSession.detach'], }, { name: 'WebKit', events: require('../lib/events').Events, - missingCoverage: ['browserContext.clearPermissions'], + missingCoverage: ['browserContext.clearPermissions', 'cDPSession.send', 'cDPSession.detach'], }, { name: 'Chromium', diff --git a/utils/doclint/check_public_api/JSBuilder.js b/utils/doclint/check_public_api/JSBuilder.js index 37d6db7bba..ec94d553f3 100644 --- a/utils/doclint/check_public_api/JSBuilder.js +++ b/utils/doclint/check_public_api/JSBuilder.js @@ -326,6 +326,8 @@ function checkSources(sources, externalDependencies) { } function expandPrefix(name) { + if (name === 'CRSession') + return 'CDPSession'; if (name.startsWith('CR')) return 'Chromium' + name.substring(2); if (name.startsWith('FF'))