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
This commit is contained in:
Julian Descottes 2024-01-29 10:45:49 +00:00
Родитель b40075555e
Коммит 5d0579eca6
3 изменённых файлов: 25 добавлений и 18 удалений

Просмотреть файл

@ -133,6 +133,13 @@ You can also run them against Chrome as:
% ./mach puppeteer-test --product=chrome % ./mach puppeteer-test --product=chrome
``` ```
By default, Puppeteer will be configured to use the WebDriver BiDi protocol. You
can also force Puppeteer to use the CDP protocol with the `--cdp` option:
```shell
% ./mach puppeteer-test --cdp
```
By default the mach command will automatically install Puppeteer but that's By default the mach command will automatically install Puppeteer but that's
only needed for the very first time, or when a new Puppeteer release has been only needed for the very first time, or when a new Puppeteer release has been
vendored in. To skip the install step use the `--no-install` option. vendored in. To skip the install step use the `--no-install` option.

Просмотреть файл

@ -384,11 +384,11 @@ class PuppeteerRunner(MozbuildObject):
Possible optional test parameters: Possible optional test parameters:
`bidi`:
Boolean to indicate whether to test Firefox with BiDi protocol.
`binary`: `binary`:
Path for the browser binary to use. Defaults to the local Path for the browser binary to use. Defaults to the local
build. build.
`cdp`:
Boolean to indicate whether to test Firefox with CDP protocol.
`headless`: `headless`:
Boolean to indicate whether to activate Firefox' headless mode. Boolean to indicate whether to activate Firefox' headless mode.
`extra_prefs`: `extra_prefs`:
@ -399,7 +399,7 @@ class PuppeteerRunner(MozbuildObject):
""" """
setup() setup()
with_bidi = params.get("bidi", False) with_cdp = params.get("cdp", False)
binary = params.get("binary") or self.get_binary_path() binary = params.get("binary") or self.get_binary_path()
product = params.get("product", "firefox") product = params.get("product", "firefox")
@ -444,7 +444,7 @@ class PuppeteerRunner(MozbuildObject):
".cache", ".cache",
) )
if with_bidi is True: if not with_cdp:
test_command = test_command + ":bidi" test_command = test_command + ":bidi"
elif env["HEADLESS"] == "True": elif env["HEADLESS"] == "True":
test_command = test_command + ":headless" test_command = test_command + ":headless"
@ -488,7 +488,7 @@ class PuppeteerRunner(MozbuildObject):
expectation expectation
for expectation in expected_data for expectation in expected_data
if is_relevant_expectation( if is_relevant_expectation(
expectation, product, with_bidi, env["HEADLESS"], expected_platform expectation, product, with_cdp, env["HEADLESS"], expected_platform
) )
] ]
@ -516,16 +516,16 @@ def create_parser_puppeteer():
p.add_argument( p.add_argument(
"--product", type=str, default="firefox", choices=["chrome", "firefox"] "--product", type=str, default="firefox", choices=["chrome", "firefox"]
) )
p.add_argument(
"--bidi",
action="store_true",
help="Flag that indicates whether to test Firefox with BiDi protocol.",
)
p.add_argument( p.add_argument(
"--binary", "--binary",
type=str, type=str,
help="Path to browser binary. Defaults to local Firefox build.", help="Path to browser binary. Defaults to local Firefox build.",
) )
p.add_argument(
"--cdp",
action="store_true",
help="Flag that indicates whether to test Firefox with the CDP protocol.",
)
p.add_argument( p.add_argument(
"--ci", "--ci",
action="store_true", action="store_true",
@ -575,7 +575,7 @@ def create_parser_puppeteer():
def is_relevant_expectation( def is_relevant_expectation(
expectation, expected_product, with_bidi, is_headless, expected_platform expectation, expected_product, with_cdp, is_headless, expected_platform
): ):
parameters = expectation["parameters"] parameters = expectation["parameters"]
@ -584,11 +584,11 @@ def is_relevant_expectation(
else: else:
is_expected_product = "firefox" not in parameters is_expected_product = "firefox" not in parameters
if with_bidi is True: if with_cdp:
is_expected_protocol = "webDriverBiDi" not in parameters
else:
is_expected_protocol = "cdp" not in parameters is_expected_protocol = "cdp" not in parameters
is_headless = "True" is_headless = "True"
else:
is_expected_protocol = "webDriverBiDi" not in parameters
if is_headless == "True": if is_headless == "True":
is_expected_mode = "headful" not in parameters is_expected_mode = "headful" not in parameters
@ -620,8 +620,8 @@ def is_relevant_expectation(
) )
def puppeteer_test( def puppeteer_test(
command_context, command_context,
bidi=None,
binary=None, binary=None,
cdp=False,
ci=False, ci=False,
disable_fission=False, disable_fission=False,
enable_webrender=False, enable_webrender=False,
@ -683,8 +683,8 @@ def puppeteer_test(
install_puppeteer(command_context, product, ci) install_puppeteer(command_context, product, ci)
params = { params = {
"bidi": bidi,
"binary": binary, "binary": binary,
"cdp": cdp,
"headless": headless, "headless": headless,
"enable_webrender": enable_webrender, "enable_webrender": enable_webrender,
"extra_prefs": prefs, "extra_prefs": prefs,

Просмотреть файл

@ -38,7 +38,7 @@ puppeteer:
command: > command: >
cd $GECKO_PATH/ && cd $GECKO_PATH/ &&
$MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org && $MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org &&
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --headless --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json ./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --cdp --headless --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json
puppeteer-with-bidi: puppeteer-with-bidi:
description: Puppeteer tests against Firefox Webdriver BiDi remote protocol description: Puppeteer tests against Firefox Webdriver BiDi remote protocol
@ -49,4 +49,4 @@ puppeteer-with-bidi:
command: > command: >
cd $GECKO_PATH/ && cd $GECKO_PATH/ &&
$MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org && $MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org &&
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --bidi --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json ./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json