Skip to content

Commit

Permalink
Bug 1683392 - [puppeteer] Use "npm ci" only when tests are run on Tas…
Browse files Browse the repository at this point in the history
…kCluster. r=remote-protocol-reviewers,jdescottes

This patch adds a new "--ci" argument for the
"mach puppeteer-test" command. As such it can
also be used locally to simulate a test job in CI.

Differential Revision: https://phabricator.services.mozilla.com/D101780
  • Loading branch information
whimboo committed Feb 1, 2021
1 parent b46dca3 commit 45553af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion remote/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ def create_parser_puppeteer():
type=str,
help="Path to browser binary. Defaults to local Firefox build.",
)
p.add_argument(
"--ci",
action="store_true",
help="Flag that indicates that tests run in a CI environment.",
)
p.add_argument(
"--enable-fission",
action="store_true",
Expand Down Expand Up @@ -571,6 +576,7 @@ class PuppeteerTest(MachCommandBase):
def puppeteer_test(
self,
binary=None,
ci=False,
enable_fission=False,
headless=False,
extra_prefs=None,
Expand All @@ -583,6 +589,8 @@ def puppeteer_test(
**kwargs
):

self.ci = ci

logger = mozlog.commandline.setup_logging(
"puppeteer-test", kwargs, {"mach": sys.stdout}
)
Expand Down Expand Up @@ -669,7 +677,9 @@ def install_puppeteer(self, product):
if changed_files and os.path.isdir(lib_dir):
# clobber lib to force `tsc compile` step
shutil.rmtree(lib_dir)
npm("ci", cwd=os.path.join(self.topsrcdir, puppeteer_dir), env=env)

command = "ci" if self.ci else "install"
npm(command, cwd=os.path.join(self.topsrcdir, puppeteer_dir), env=env)


def exit(code, error=None):
Expand Down
4 changes: 2 additions & 2 deletions taskcluster/ci/source-test/remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ puppeteer:
command: >
cd $GECKO_PATH/ &&
$MOZ_FETCHES_DIR/firefox/firefox --screenshot http://example.org &&
./mach puppeteer-test -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --headless --write-results /builds/worker/results.json --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json --log-raw /builds/worker/pup_raw.log
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --headless --write-results /builds/worker/results.json --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json --log-raw /builds/worker/pup_raw.log
puppeteer-fis:
description: Puppeteer tests against Firefox CDP-based remote protocol with Fission (site isolation) turned on
Expand All @@ -56,4 +56,4 @@ puppeteer-fis:
using: run-task
command: >
cd $GECKO_PATH/ &&
./mach puppeteer-test -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --headless --enable-fission --write-results /builds/worker/results.json --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json --log-raw /builds/worker/pup_raw.log
./mach puppeteer-test --ci -vv --binary $MOZ_FETCHES_DIR/firefox/firefox --headless --enable-fission --write-results /builds/worker/results.json --log-tbpl - --log-errorsummary /builds/worker/pup_errorsummary.json --log-raw /builds/worker/pup_raw.log

0 comments on commit 45553af

Please sign in to comment.