gecko-dev/remote
Julian Descottes 69fa6f5492 Bug 1726800 - [remote] Verify commands as early as possible in MessageHandler r=webdriver-reviewers,whimboo
Depends on D123655
With this patch, the MessageHandler can immediately check if a command is implemented by the modules, and therefore reject as early as possible.
This is implemented via a checkCommand method on MessageHandler.

Other required changes:
- ModuleRegistry now owns the logic to import BiDi modules.
- ModuleCache exposes a `getAllModuleClasses` to get all the relevant modules for a moduleName+destination pair.

Error messages have been improved and are verified with a dedicated test

Differential Revision: https://phabricator.services.mozilla.com/D123655
2021-10-12 16:48:43 +00:00
..
cdp Bug 1735131 - [remote] Ignore "document-element-inserted" notifications without a window object. r=webdriver-reviewers,jdescottes 2021-10-11 15:11:07 +00:00
components Bug 1706581 - [remote] Write CDP connection details to DevToolsActivePort file. r=webdriver-reviewers,jdescottes 2021-10-07 18:43:25 +00:00
doc Bug 1734084 - [remote] Fix indentation of commands in remote/doc/Testing.md r=webdriver-reviewers,whimboo 2021-10-05 08:06:54 +00:00
marionette Bug 1691954 - [marionette] Avoid MarionetteEvents JSErrors using shared process state r=webdriver-reviewers,whimboo 2021-09-30 09:13:07 +00:00
server Bug 1721148 - [remote] Report WebSocket handshake failures to the client. r=webdriver-reviewers,jgraham 2021-07-23 16:12:32 +00:00
shared Bug 1726800 - [remote] Verify commands as early as possible in MessageHandler r=webdriver-reviewers,whimboo 2021-10-12 16:48:43 +00:00
test Bug 1734208 - [remote] Ignore stdout in Puppeteer if dumpio isn't used. r=webdriver-reviewers,jdescottes 2021-10-11 05:46:47 +00:00
webdriver-bidi Bug 1726800 - [remote] Verify commands as early as possible in MessageHandler r=webdriver-reviewers,whimboo 2021-10-12 16:48:43 +00:00
.eslintrc.js Bug 1719850 - [marionette] Enforce no-unused-vars for global variables in marionette eslint configuration r=webdriver-reviewers,whimboo 2021-07-09 17:22:09 +00:00
.gitignore
README.md Bug 1701674 - [remote] Add handling of expectation data to readme. r=remote-protocol-reviewers,jdescottes 2021-04-27 12:43:31 +00:00
jar.mn Bug 1726800 - [remote] Use dedicated error class for command errors in MessageHandler r=webdriver-reviewers,whimboo 2021-10-12 16:48:42 +00:00
mach_commands.py Bug 1601245 - [remote] Enable Puppeteer and CDP browser-chrome mochitests for Fission. r=webdriver-reviewers,jdescottes 2021-10-06 04:30:27 +00:00
moz.build Bug 1693805 - [remote] Add support for handling WebDriver BiDi connections. r=webdriver-reviewers,jgraham,jdescottes 2021-07-09 08:00:52 +00:00

README.md

The Firefox remote agent is a low-level debugging interface based on the CDP protocol.

With it, you can inspect the state and control execution of documents running in web content, instrument Gecko in interesting ways, simulate user interaction for automation purposes, and debug JavaScript execution.

This component provides an experimental and partial implementation of a remote devtools interface using the CDP protocol and transport layer.

See https://firefox-source-docs.mozilla.org/remote/ for documentation.

It is available in Firefox and is started this way:

% ./mach run --remote-debugging-port

Puppeteer

Puppeteer is a Node library which provides a high-level API to control Chrome, Chromium, and Firefox over the Chrome DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) browsers.

To verify that our implementation of the CDP protocol is valid we do not only run xpcshell and browser-chrome mochitests in Firefox CI but also the Puppeteer unit tests.

Expectation Data

With the tests coming from upstream, it is not guaranteed that they all pass in Gecko-based browsers. For this reason it is necessary to provide metadata about the expected results of each test. This is provided in a manifest file under test/puppeteer-expected.json.

For each test of the Puppeteer unit test suite an equivalent entry will exist in this manifest file. By default tests are expected to PASS.

Tests that are intermittent may be marked with multiple statuses using a list of possibilities e.g. for a test that usually passes, but intermittently fails:

"Page.click should click the button (click.spec.ts)": [
  "PASS", "FAIL"
],

Disabling Tests

Tests are disabled by using the manifest file test/puppeteer-expected.json. For example, if a test is unstable, it can be disabled using SKIP:

"Workers Page.workers (worker.spec.ts)": [
  "SKIP"
],

For intermittents it's generally preferable to give the test multiple expectations rather than disable it.

Autogenerating Expectation Data

After changing some code it may be necessary to update the expectation data for the relevant tests. This can of course be done manually, but mach is able to automate the process:

mach puppeteer-test --write-results

By default it writes the output to test/puppeteer-expected.json.

Given that the unit tests run in Firefox CI only for Linux it is advised to download the expectation data (available as artifact) from the TaskCluster job.