Skip to content

Commit 5d0579e

Browse files
Bug 1872252 - [remote] Make mach puppeteer-test to use WebDriver BiDi by default r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D199620
1 parent b400755 commit 5d0579e

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

remote/doc/Testing.md

+7
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ You can also run them against Chrome as:
133133
% ./mach puppeteer-test --product=chrome
134134
```
135135

136+
By default, Puppeteer will be configured to use the WebDriver BiDi protocol. You
137+
can also force Puppeteer to use the CDP protocol with the `--cdp` option:
138+
139+
```shell
140+
% ./mach puppeteer-test --cdp
141+
```
142+
136143
By default the mach command will automatically install Puppeteer but that's
137144
only needed for the very first time, or when a new Puppeteer release has been
138145
vendored in. To skip the install step use the `--no-install` option.

remote/mach_commands.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ def run_test(self, logger, *tests, **params):
384384
385385
Possible optional test parameters:
386386
387-
`bidi`:
388-
Boolean to indicate whether to test Firefox with BiDi protocol.
389387
`binary`:
390388
Path for the browser binary to use. Defaults to the local
391389
build.
390+
`cdp`:
391+
Boolean to indicate whether to test Firefox with CDP protocol.
392392
`headless`:
393393
Boolean to indicate whether to activate Firefox' headless mode.
394394
`extra_prefs`:
@@ -399,7 +399,7 @@ def run_test(self, logger, *tests, **params):
399399
"""
400400
setup()
401401

402-
with_bidi = params.get("bidi", False)
402+
with_cdp = params.get("cdp", False)
403403
binary = params.get("binary") or self.get_binary_path()
404404
product = params.get("product", "firefox")
405405

@@ -444,7 +444,7 @@ def run_test(self, logger, *tests, **params):
444444
".cache",
445445
)
446446

447-
if with_bidi is True:
447+
if not with_cdp:
448448
test_command = test_command + ":bidi"
449449
elif env["HEADLESS"] == "True":
450450
test_command = test_command + ":headless"
@@ -488,7 +488,7 @@ def run_test(self, logger, *tests, **params):
488488
expectation
489489
for expectation in expected_data
490490
if is_relevant_expectation(
491-
expectation, product, with_bidi, env["HEADLESS"], expected_platform
491+
expectation, product, with_cdp, env["HEADLESS"], expected_platform
492492
)
493493
]
494494

@@ -516,16 +516,16 @@ def create_parser_puppeteer():
516516
p.add_argument(
517517
"--product", type=str, default="firefox", choices=["chrome", "firefox"]
518518
)
519-
p.add_argument(
520-
"--bidi",
521-
action="store_true",
522-
help="Flag that indicates whether to test Firefox with BiDi protocol.",
523-
)
524519
p.add_argument(
525520
"--binary",
526521
type=str,
527522
help="Path to browser binary. Defaults to local Firefox build.",
528523
)
524+
p.add_argument(
525+
"--cdp",
526+
action="store_true",
527+
help="Flag that indicates whether to test Firefox with the CDP protocol.",
528+
)
529529
p.add_argument(
530530
"--ci",
531531
action="store_true",
@@ -575,7 +575,7 @@ def create_parser_puppeteer():
575575

576576

577577
def is_relevant_expectation(
578-
expectation, expected_product, with_bidi, is_headless, expected_platform
578+
expectation, expected_product, with_cdp, is_headless, expected_platform
579579
):
580580
parameters = expectation["parameters"]
581581

@@ -584,11 +584,11 @@ def is_relevant_expectation(
584584
else:
585585
is_expected_product = "firefox" not in parameters
586586

587-
if with_bidi is True:
587+
if with_cdp:
588+
is_expected_protocol = "webDriverBiDi" not in parameters
589+
else:
588590
is_expected_protocol = "cdp" not in parameters
589591
is_headless = "True"
590-
else:
591-
is_expected_protocol = "webDriverBiDi" not in parameters
592592

593593
if is_headless == "True":
594594
is_expected_mode = "headful" not in parameters
@@ -620,8 +620,8 @@ def is_relevant_expectation(
620620
)
621621
def puppeteer_test(
622622
command_context,
623-
bidi=None,
624623
binary=None,
624+
cdp=False,
625625
ci=False,
626626
disable_fission=False,
627627
enable_webrender=False,
@@ -683,8 +683,8 @@ def puppeteer_test(
683683
install_puppeteer(command_context, product, ci)
684684

685685
params = {
686-
"bidi": bidi,
687686
"binary": binary,
687+
"cdp": cdp,
688688
"headless": headless,
689689
"enable_webrender": enable_webrender,
690690
"extra_prefs": prefs,

taskcluster/ci/source-test/puppeteer.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ puppeteer:
3838
command: >
3939
cd $GECKO_PATH/ &&
4040
$MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org &&
41-
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --headless --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json
41+
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --cdp --headless --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json
4242
4343
puppeteer-with-bidi:
4444
description: Puppeteer tests against Firefox Webdriver BiDi remote protocol
@@ -49,4 +49,4 @@ puppeteer-with-bidi:
4949
command: >
5050
cd $GECKO_PATH/ &&
5151
$MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org &&
52-
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --bidi --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json
52+
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json

0 commit comments

Comments
 (0)