Remote/GutenbergCDPUsage

From MozillaWiki
Jump to: navigation, search

Usage of CDP methods in https://github.com/WordPress/gutenberg end-to-end tests.


Methods

From https://bugzilla.mozilla.org/show_bug.cgi?id=1539202#c9:

$ DEBUG=puppeteer:* npm run test-e2e packages/e2e-tests/specs/ > gutenberg-logs 2>&1
$ cat gutenberg-logs  | grep -oE '"method":"[^"]+\.[^"]+"' | sed 's/"method":"//' | sed 's/"//' | sort | uniq


  • DOM.getBoxModel
  • DOM.getContentQuads
  • DOM.setFileInputFiles
  • Emulation.setDeviceMetricsOverride
  • Emulation.setTouchEmulationEnabled
  • Input.dispatchKeyEvent
  • Input.dispatchMouseEvent
  • Inspector.detached
  • Log.enable
  • Log.entryAdded
  • Network.continueInterceptedRequest
  • Network.dataReceived
  • Network.emulateNetworkConditions
  • Network.enable
  • Network.loadingFailed
  • Network.loadingFinished
  • Network.requestIntercepted
  • Network.requestServedFromCache
  • Network.requestWillBeSent
  • Network.resourceChangedPriority
  • Network.responseReceived
  • Network.setCacheDisabled
  • Network.setRequestInterception
  • Page.bringToFront
  • Page.domContentEventFired
  • Page.enable
  • Page.frameAttached
  • Page.frameClearedScheduledNavigation
  • Page.frameDetached
  • Page.frameNavigated
  • Page.frameResized
  • Page.frameScheduledNavigation
  • Page.frameStartedLoading
  • Page.frameStoppedLoading
  • Page.getFrameTree
  • Page.handleJavaScriptDialog
  • Page.javascriptDialogClosed
  • Page.javascriptDialogOpening
  • Page.lifecycleEvent
  • Page.loadEventFired
  • Page.navigate
  • Page.navigatedWithinDocument
  • Page.reload
  • Page.setLifecycleEventsEnabled
  • Page.windowOpen
  • Performance.enable
  • Runtime.callFunctionOn
  • Runtime.consoleAPICalled
  • Runtime.enable
  • Runtime.evaluate
  • Runtime.executionContextCreated
  • Runtime.executionContextDestroyed
  • Runtime.executionContextsCleared
  • Runtime.getProperties
  • Runtime.releaseObject
  • Security.enable
  • Security.securityStateChanged
  • Target.setAutoAttach


Methods & Events ranked by frequency

Note that Puppeteer doesn't necessarily depend on many of the Network, Runtime, Fetch and Page items.

Methods

cat gutenberg-logs | grep '"id":'  | grep -oE '"method":"[^"]+\.[^"]+"' | sed 's/"method":"//' | sed 's/"//' | sort | uniq -c | sort -r

14924 Input.dispatchKeyEvent
12462 Runtime.callFunctionOn
7709 Input.dispatchMouseEvent
3107 Runtime.releaseObject
1891 Page.getLayoutMetrics
1891 DOM.getContentQuads
1514 Runtime.executionContextCreated
1019 Runtime.evaluate
 947 DOM.resolveNode
 947 DOM.describeNode
 881 Fetch.continueRequest
 676 Page.frameNavigated
 598 Emulation.setTouchEmulationEnabled
 598 Emulation.setDeviceMetricsOverride
 560 Page.navigate
 529 Runtime.getProperties
 238 Page.handleJavaScriptDialog
  81 Target.setAutoAttach
  81 Target.attachToTarget
  81 Runtime.enable
  81 Performance.enable
  81 Page.setLifecycleEventsEnabled
  81 Page.setInterceptFileChooserDialog
  81 Page.getFrameTree
  81 Page.enable
  81 Page.createIsolatedWorld
  81 Page.addScriptToEvaluateOnNewDocument
  81 Network.enable
  81 Log.enable
  79 Target.closeTarget
  78 Target.setDiscoverTargets
  77 Target.getBrowserContexts
  77 Target.createTarget
  28 Page.reload
  22 Input.insertText
  14 Network.setCacheDisabled
  12 Fetch.fulfillRequest
   8 Page.bringToFront
   8 Fetch.enable
   6 Fetch.disable
   4 DOM.getBoxModel
   3 DOM.setFileInputFiles
   2 Network.emulateNetworkConditions

Events

These events are emitted during a gutenberg test run. Gutenberg tests don't explicitly listen to any CDP events.

cat gutenberg-logs | grep -v '"id":'  | grep -oE '"method":"[^"]+\.[^"]+"' | sed 's/"method":"//' | sed 's/"//' | sort | uniq -c | sort -r

65119 Network.dataReceived
56977 Network.requestWillBeSent
56906 Network.loadingFinished
55864 Network.responseReceived
37106 Network.requestServedFromCache
6232 Page.lifecycleEvent
3367 Target.targetInfoChanged
1510 Runtime.consoleAPICalled
1346 Runtime.executionContextDestroyed
 893 Fetch.requestPaused
 699 Page.navigatedWithinDocument
 681 Page.frameStoppedLoading
 678 Page.frameStartedLoading
 674 Page.domContentEventFired
 666 Runtime.executionContextsCleared
 664 Page.loadEventFired
 621 Target.targetCreated
 238 Page.javascriptDialogOpening
 238 Page.javascriptDialogClosed
 235 Target.targetDestroyed
  89 Page.frameResized
  81 Target.attachedToTarget
  79 Target.detachedFromTarget
  30 Page.frameScheduledNavigation
  30 Page.frameRequestedNavigation
  30 Page.frameClearedScheduledNavigation
  11 Network.resourceChangedPriority
  10 Page.frameAttached
   7 Page.frameDetached
   4 Log.entryAdded
   3 Page.windowOpen
   3 Network.loadingFailed