summaryrefslogtreecommitdiffstats
path: root/testing/performance
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/performance
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--testing/performance/.eslintrc.js12
-rw-r--r--testing/performance/README.txt1
-rw-r--r--testing/performance/fxrecord/perfdocs/config.yml8
-rw-r--r--testing/performance/fxrecord/perfdocs/index.rst8
-rw-r--r--testing/performance/hooks.py40
-rw-r--r--testing/performance/hooks_android_startup.py60
-rw-r--r--testing/performance/hooks_perfstats.py21
-rw-r--r--testing/performance/hooks_recording.py170
-rw-r--r--testing/performance/mach-try-perf/perfdocs/android-chrome-try-perf.pngbin0 -> 90188 bytes
-rw-r--r--testing/performance/mach-try-perf/perfdocs/comment-zero-alert-number.pngbin0 -> 215106 bytes
-rw-r--r--testing/performance/mach-try-perf/perfdocs/compare-view-sample.pngbin0 -> 239695 bytes
-rw-r--r--testing/performance/mach-try-perf/perfdocs/config.yml8
-rw-r--r--testing/performance/mach-try-perf/perfdocs/index.rst357
-rw-r--r--testing/performance/mach-try-perf/perfdocs/standard-try-perf.pngbin0 -> 96208 bytes
-rw-r--r--testing/performance/mach-try-perf/perfdocs/standard-workflow.rst73
-rw-r--r--testing/performance/mach-try-perf/perfdocs/variants-try-perf.pngbin0 -> 111679 bytes
-rw-r--r--testing/performance/pageload_sites.json608
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/Alerts_view.pngbin0 -> 246609 bytes
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/Alerts_view_toolbar.pngbin0 -> 14146 bytes
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/config.yml8
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/filtering_alerts.pngbin0 -> 99357 bytes
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/flowchart.pngbin0 -> 399193 bytes
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/index.rst114
-rw-r--r--testing/performance/perf-sheriffing/perfdocs/single_alert.pngbin0 -> 342468 bytes
-rw-r--r--testing/performance/perftest.toml23
-rw-r--r--testing/performance/perftest_WPT_chrome_init_file.js110
-rw-r--r--testing/performance/perftest_WPT_firefox_init_file.js111
-rw-r--r--testing/performance/perftest_android_startup.js33
-rw-r--r--testing/performance/perftest_bbc_link.js29
-rw-r--r--testing/performance/perftest_facebook.js51
-rw-r--r--testing/performance/perftest_jsconf_cold.js28
-rw-r--r--testing/performance/perftest_jsconf_warm.js34
-rw-r--r--testing/performance/perftest_pageload.js29
-rw-r--r--testing/performance/perftest_perfstats.js52
-rw-r--r--testing/performance/perftest_politico_link.js28
-rw-r--r--testing/performance/perftest_record.js562
-rw-r--r--testing/performance/perftest_youtube_link.js28
-rw-r--r--testing/performance/sites.txt21
38 files changed, 2627 insertions, 0 deletions
diff --git a/testing/performance/.eslintrc.js b/testing/performance/.eslintrc.js
new file mode 100644
index 0000000000..f040032509
--- /dev/null
+++ b/testing/performance/.eslintrc.js
@@ -0,0 +1,12 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+module.exports = {
+ env: {
+ browser: true,
+ node: true,
+ },
+};
diff --git a/testing/performance/README.txt b/testing/performance/README.txt
new file mode 100644
index 0000000000..7cce5088c4
--- /dev/null
+++ b/testing/performance/README.txt
@@ -0,0 +1 @@
+This directory contains perftests owned by the performance team.
diff --git a/testing/performance/fxrecord/perfdocs/config.yml b/testing/performance/fxrecord/perfdocs/config.yml
new file mode 100644
index 0000000000..59f10455fa
--- /dev/null
+++ b/testing/performance/fxrecord/perfdocs/config.yml
@@ -0,0 +1,8 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+---
+name: fxrecord
+manifest: None
+static-only: True
+suites: {}
diff --git a/testing/performance/fxrecord/perfdocs/index.rst b/testing/performance/fxrecord/perfdocs/index.rst
new file mode 100644
index 0000000000..313d4b74a3
--- /dev/null
+++ b/testing/performance/fxrecord/perfdocs/index.rst
@@ -0,0 +1,8 @@
+========
+Fxrecord
+========
+
+`Fxrecord <https://github.com/mozilla/fxrecord>`__ is a tool for measuring the
+startup performance of Firefox for Desktop. It captures a video of Firefox for
+desktop starting on a laptop and computes visual metrics using the same manner
+as Raptor using Browsertime.
diff --git a/testing/performance/hooks.py b/testing/performance/hooks.py
new file mode 100644
index 0000000000..1a02f1ab3c
--- /dev/null
+++ b/testing/performance/hooks.py
@@ -0,0 +1,40 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+import os
+
+from mozperftest.test.browsertime import add_option, add_options
+
+sites = os.path.join(os.path.dirname(__file__), "sites.txt")
+with open(sites) as f:
+ sites = [site for site in f.read().split("\n") if site.strip()]
+
+
+def next_site():
+ for site in sites:
+ yield site
+
+
+get_site = next_site()
+
+options = [
+ ("firefox.preference", "network.http.speculative-parallel-limit:6"),
+ # XXX potentially move those as first class options in mozperf?
+ ("pageCompleteWaitTime", "10000"),
+ ("visualMetrics", "true"),
+ ("video", "true"),
+ ("firefox.windowRecorder", "false"),
+ ("videoParams.addTimer", "false"),
+ ("videoParams.createFilmstrip", "false"),
+ ("videoParams.keepOriginalVideo", "true"),
+]
+
+
+def before_runs(env, **kw):
+ env.set_arg("cycles", len(sites))
+ add_options(env, options)
+
+
+def before_cycle(env, **kw):
+ url = next(get_site)
+ add_option(env, "browsertime.url", url)
diff --git a/testing/performance/hooks_android_startup.py b/testing/performance/hooks_android_startup.py
new file mode 100644
index 0000000000..863df74447
--- /dev/null
+++ b/testing/performance/hooks_android_startup.py
@@ -0,0 +1,60 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+import pathlib
+import re
+import subprocess
+from datetime import datetime, timedelta
+
+import requests
+from mozperftest.system.android_startup import (
+ BASE_URL_DICT,
+ DATETIME_FORMAT,
+ KEY_ARCHITECTURE,
+ KEY_COMMIT,
+ KEY_DATETIME,
+ KEY_NAME,
+ KEY_PRODUCT,
+)
+
+HTTP_200_OKAY = 200
+
+
+def before_iterations(kw):
+ product = kw["AndroidStartUp_product"]
+ architecture = "arm64-v8a"
+ if product == "geckoview_example":
+ architecture = "aarch64"
+ commit_info = subprocess.getoutput("hg log -l 1")
+ commit_date = re.search(r"date:\s+([:\s\w]+)\s+", str(commit_info)).group(1)
+ download_date = (
+ datetime.strptime(commit_date, "%a %b %d %H:%M:%S %Y") - timedelta(days=1)
+ ).strftime(DATETIME_FORMAT)
+
+ nightly_url = BASE_URL_DICT[product].format(
+ date=download_date, architecture=architecture
+ )
+ filename = f"{product}_nightly_{architecture}.apk"
+ print("Fetching {}...".format(filename), end="", flush=True)
+ download_apk_as_date(nightly_url, download_date, filename)
+ print(f"Downloaded {product} for date: {download_date}")
+
+ kw["apk_metadata"] = {
+ KEY_NAME: filename,
+ KEY_DATETIME: download_date,
+ KEY_COMMIT: "",
+ KEY_ARCHITECTURE: architecture,
+ KEY_PRODUCT: product,
+ }
+
+
+def download_apk_as_date(nightly_url, download_date_string, filename):
+ apk = requests.get(nightly_url)
+ if apk.status_code != HTTP_200_OKAY:
+ raise Exception(
+ f"Something went wrong downloading the apk check to make sure you have entered"
+ f" a date that is valid and that the apk for the date you have requested("
+ f"{download_date_string}) is available and that the URL({nightly_url}) is also "
+ f"valid"
+ )
+ pathlib.Path(filename).write_bytes(apk.content)
diff --git a/testing/performance/hooks_perfstats.py b/testing/performance/hooks_perfstats.py
new file mode 100644
index 0000000000..fe6d79c5af
--- /dev/null
+++ b/testing/performance/hooks_perfstats.py
@@ -0,0 +1,21 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from mozperftest.test.browsertime import add_options
+from mozperftest.test.browsertime.runner import NodeException
+
+common_options = [("firefox.perfStats", "true")]
+
+
+def on_exception(env, layer, exc):
+ if not isinstance(exc, NodeException):
+ raise exc
+ return True
+
+
+def logcat_processor():
+ pass
+
+
+def before_runs(env, **kw):
+ add_options(env, common_options)
diff --git a/testing/performance/hooks_recording.py b/testing/performance/hooks_recording.py
new file mode 100644
index 0000000000..e35f5f4d94
--- /dev/null
+++ b/testing/performance/hooks_recording.py
@@ -0,0 +1,170 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+import json
+import os
+import platform
+from pathlib import Path
+
+from mozperftest.test.browsertime import add_option, add_options
+
+# Uncomment the manual_login line if you need to do a manual login.
+# The extra browsertime arguments get overwritten below so they
+# need to be set here. The value is the time you need to do a login.
+options = [
+ ("pageCompleteWaitTime", "10000"),
+ # ("browsertime.manual_login", 100000),
+]
+
+next_site = None
+
+RECORDING_LIST = Path(Path(__file__).parent, "pageload_sites.json")
+
+SCM_1_LOGIN_SITES = ("facebook", "netflix")
+
+
+def before_iterations(kw):
+ global next_site
+ print("Setting up next site to record.")
+
+ with RECORDING_LIST.open() as f:
+ site_list = json.load(f)
+ # currently can't record websites that require user interactions(Logins)
+ if kw.get("android"):
+ site_list = site_list["mobile"]
+ else:
+ site_list = site_list["desktop"]
+
+ def __should_record(test):
+ # If a test page selection was provided, only select those
+ # tests and exclude all the others
+ specified_tests = kw["proxy_perftest_page"]
+ if specified_tests is not None:
+ if test.get("name") == specified_tests:
+ if test.get("login"):
+ print(f"WARNING: You selected a login test: {test.get('name')}")
+ return True
+ else:
+ return False
+
+ # Only perform login recordings in automation or when
+ # RAPTOR_LOGINS is defined
+ record = False
+ if not test.get("login") or test.get("login-test"):
+ record = True
+ if not (
+ "MOZ_AUTOMATION" in os.environ or "RAPTOR_LOGINS" in os.environ
+ ) and test.get("login-test"):
+ record = False
+ print(
+ f"Skipping login test `{test.get('name')}` "
+ f"because login info cannot be obtained."
+ )
+
+ # When pushing to Try, only attempt login recording using the
+ # taskcluster secrets that are associated with SCM level 1 as defined
+ # in `SCM_LVL_1_SITES`.
+ if test.get("login"):
+ if "MOZ_AUTOMATION" in os.environ.keys():
+ if (
+ os.environ.get("MOZ_SCM_LEVEL") == 1
+ and test.get("name") not in SCM_1_LOGIN_SITES
+ ):
+ print(
+ f"Skipping login test `{test.get('name')}` "
+ f"Because SCM = `{os.environ.get('MOZ_SCM_LEVEL') }`"
+ f"and there is no secret available at this level"
+ )
+ return False
+ return True
+ elif "RAPTOR_LOGINS" in os.environ:
+ # Leave it to the user to have properly set up a local json file with
+ # the login websites of interest
+ return True
+
+ return record
+
+ sites = [test_site for test_site in site_list if __should_record(test_site)]
+
+ if not sites:
+ raise Exception("No tests were selected for recording!")
+
+ def next_site():
+ for site in sites:
+ yield site
+
+ next_site = next_site()
+
+ # Set the number of test-iterations to the number of builds
+ kw["test_iterations"] = len(sites)
+ return kw
+
+
+def before_runs(env):
+ global next_site
+ print("Running before_runs")
+ add_options(env, options)
+
+ if next_site:
+ test_site = next(next_site)
+ print("Next site: %s" % test_site)
+
+ if env.get_arg("android"):
+ platform_name = "android"
+ app_name = env.get_arg("android-app-name").split(".")[-1]
+ else:
+ platform_name = platform.system().lower()
+ app_name = "firefox"
+
+ name = [
+ "mitm8",
+ platform_name,
+ "gve" if app_name == "geckoview_example" else app_name,
+ test_site["name"],
+ ]
+
+ recording_file = "%s.zip" % "-".join(name)
+
+ env.set_arg("proxy-mode", "record")
+ env.set_arg(
+ "proxy-file",
+ recording_file,
+ )
+
+ add_options(env, options, overwrite=True)
+ add_option(env, "browsertime.url", test_site.get("test_url"))
+ add_option(env, "browsertime.screenshot", "true")
+ add_option(env, "browsertime.testName", test_site.get("name"))
+ add_option(env, "browsertime.testType", test_site.get("type", "pageload"))
+ add_option(
+ env, "browsertime.login", "true" if test_site.get("login") else "false"
+ )
+
+ prefs = test_site.get("preferences", {})
+ for pref, val in prefs.items():
+ add_option(env, "firefox.preference", f"{pref}:{val}")
+
+ second_url = test_site.get("secondary_url", None)
+ if second_url:
+ add_option(env, "browsertime.secondary_url", second_url)
+
+ inject_deterministic = test_site.get("inject_deterministic", True)
+ env.set_arg("proxy-deterministic", inject_deterministic)
+
+ dismiss_cookie_prompt = test_site.get("dismiss_cookie_prompt", [])
+ if dismiss_cookie_prompt:
+ parsed_cmds = [
+ ":::".join([str(i) for i in item])
+ for item in dismiss_cookie_prompt
+ if item
+ ]
+ add_option(
+ env, "browsertime.dismiss_cookie_prompt", ";;;".join(parsed_cmds)
+ )
+
+ cmds = test_site.get("test_cmds", [])
+ if cmds:
+ parsed_cmds = [":::".join([str(i) for i in item]) for item in cmds if item]
+ add_option(env, "browsertime.commands", ";;;".join(parsed_cmds))
+
+ print("Recording %s to file: %s" % (test_site.get("test_url"), recording_file))
diff --git a/testing/performance/mach-try-perf/perfdocs/android-chrome-try-perf.png b/testing/performance/mach-try-perf/perfdocs/android-chrome-try-perf.png
new file mode 100644
index 0000000000..f9b1172ea5
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/android-chrome-try-perf.png
Binary files differ
diff --git a/testing/performance/mach-try-perf/perfdocs/comment-zero-alert-number.png b/testing/performance/mach-try-perf/perfdocs/comment-zero-alert-number.png
new file mode 100644
index 0000000000..987437aad8
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/comment-zero-alert-number.png
Binary files differ
diff --git a/testing/performance/mach-try-perf/perfdocs/compare-view-sample.png b/testing/performance/mach-try-perf/perfdocs/compare-view-sample.png
new file mode 100644
index 0000000000..29c0b6ff33
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/compare-view-sample.png
Binary files differ
diff --git a/testing/performance/mach-try-perf/perfdocs/config.yml b/testing/performance/mach-try-perf/perfdocs/config.yml
new file mode 100644
index 0000000000..597373c854
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/config.yml
@@ -0,0 +1,8 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+---
+name: mach-try-perf
+manifest: None
+static-only: True
+suites: {}
diff --git a/testing/performance/mach-try-perf/perfdocs/index.rst b/testing/performance/mach-try-perf/perfdocs/index.rst
new file mode 100644
index 0000000000..55db031d0f
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/index.rst
@@ -0,0 +1,357 @@
+#############
+Mach Try Perf
+#############
+
+.. contents::
+ :depth: 2
+ :local:
+
+To make it easier for developers to find the tests they need to run we built a perf-specific try selector called ``./mach try perf``. With this tool, you no longer need to remember the obfuscated platform and test names that you need to target for your tests. Instead, the new interface shows test categories along with a simplified name of the platform that they will run on.
+
+When you trigger a try run from the perf selector, two try runs will be created. One with your changes, and one without. In your console, after you trigger the try runs, you'll find a PerfCompare link that will bring you directly to a comparison of the two pushes when they have completed.
+
+The tool is built to be conservative about the number of tests to run, so if you are looking for something that is not listed, it's likely hidden behind a flag found in the ``--help``. Here's a list of what you'll find there::
+
+ $ ./mach try perf --help
+
+ optional arguments:
+ -h, --help show this help message and exit
+ perf arguments:
+ --show-all Show all available tasks.
+ --android Show android test categories (disabled by default).
+ --chrome Show tests available for Chrome-based browsers
+ (disabled by default).
+ --custom-car Show tests available for Custom Chromium-as-Release
+ (disabled by default).
+ --safari Show tests available for Safari (disabled by default).
+ --live-sites Run tasks with live sites (if possible). You can also
+ use the `live-sites` variant.
+ --profile Run tasks with profiling (if possible). You can also
+ use the `profiling` variant.
+ --single-run Run tasks without a comparison
+ -q QUERY, --query QUERY
+ Query to run in either the perf-category selector, or
+ the fuzzy selector if --show-all is provided.
+ --browsertime-upload-apk BROWSERTIME_UPLOAD_APK
+ Path to an APK to upload. Note that this will replace
+ the APK installed in all Android Performance tests. If
+ the Activity, Binary Path, or Intents required change
+ at all relative to the existing GeckoView, and Fenix
+ tasks, then you will need to make fixes in the
+ associated taskcluster files (e.g.
+ taskcluster/ci/test/browsertime-mobile.yml).
+ Alternatively, set MOZ_FIREFOX_ANDROID_APK_OUTPUT to a
+ path to an APK, and then run the command with
+ --browsertime-upload-apk firefox-android. This option
+ will only copy the APK for browsertime, see
+ --mozperftest-upload-apk to upload APKs for startup
+ tests.
+ --mozperftest-upload-apk MOZPERFTEST_UPLOAD_APK
+ See --browsertime-upload-apk. This option does the
+ same thing except it's for mozperftest tests such as
+ the startup ones. Note that those tests only exist
+ through --show-all, as they aren't contained in any
+ existing categories.
+ --detect-changes Adds a task that detects performance changes using
+ MWU.
+ --comparator COMPARATOR
+ Either a path to a file to setup a custom comparison,
+ or a builtin name. See the Firefox source docs for
+ mach try perf for examples of how to build your own,
+ along with the interface.
+ --comparator-args [ARG=VALUE [ARG=VALUE ...]]
+ Arguments provided to the base, and new revision setup
+ stages of the comparator.
+ --variants [ [ ...]] Select variants to display in the selector from:
+ fission, bytecode-cached, live-sites, profiling, swr
+ --platforms [ [ ...]]
+ Select specific platforms to target. Android only
+ available with --android. Available platforms:
+ android-a51, android, windows, linux, macosx, desktop
+ --apps [ [ ...]] Select specific applications to target from: firefox,
+ chrome, chromium, geckoview, fenix, chrome-m, safari,
+ custom-car
+ --clear-cache Deletes the try_perf_revision_cache file
+ --extra-args [ [ ...]]
+ Set the extra args (e.x, --extra-args verbose post-
+ startup-delay=1)
+ task configuration arguments:
+ --artifact Force artifact builds where possible.
+ --no-artifact Disable artifact builds even if being used locally.
+ --browsertime Use browsertime during Raptor tasks.
+ --disable-pgo Don't run PGO builds
+ --env ENV Set an environment variable, of the form FOO=BAR. Can
+ be passed in multiple times.
+ --gecko-profile Create and upload a gecko profile during talos/raptor
+ tasks.
+ --gecko-profile-interval GECKO_PROFILE_INTERVAL
+ How frequently to take samples (ms)
+ --gecko-profile-entries GECKO_PROFILE_ENTRIES
+ How many samples to take with the profiler
+ --gecko-profile-features GECKO_PROFILE_FEATURES
+ Set the features enabled for the profiler.
+ --gecko-profile-threads GECKO_PROFILE_THREADS
+ Comma-separated list of threads to sample.
+ paths Run tasks containing tests under the specified
+ path(s).
+ --rebuild [2-20] Rebuild all selected tasks the specified number of
+ times.
+
+
+
+Workflow
+--------
+
+Below, you'll find an overview of the features available in ``./mach try perf``. If you'd like to learn more about how to use this tool to enhance your developement process, see the :ref:`Standard Workflow with Mach Try Perf` page.
+
+Standard Usage
+--------------
+
+To use mach try perf simply call ``./mach try perf``. This will open an interface for test selection like so:
+
+
+.. image:: ./standard-try-perf.png
+ :alt: Mach try perf with default options
+ :scale: 75%
+ :align: center
+
+
+Select the categories you'd like to run, hit enter, and wait for the tool to finish the pushes. **Note that it can take some time to do both pushes, and you might not see logging for some time.**
+
+.. _Running Alert Tests:
+
+Running Alert Tests
+-------------------
+
+To run all the tests that triggered a given alert, use ``./mach try perf --alert <ALERT-NUMBER>``. **It's recommended to use this when working with performance alerts.** The alert number can be found in comment 0 on any alert bug `such as this one <https://bugzilla.mozilla.org/show_bug.cgi?id=1844510>`_. As seen in the image below, the alert number can be found just above the summary table.
+
+.. image:: ./comment-zero-alert-number.png
+ :alt: Comment 0 containing an alert number just above the table.
+ :scale: 50%
+ :align: center
+
+
+Chrome and Android
+------------------
+
+Android and chrome tests are disabled by default as they are often unneeded and waste our limited resources. If you need either of these, you can add ``--chrome`` and/or ``--android`` to the command like so ``./mach try perf --android --chrome``:
+
+
+.. image:: ./android-chrome-try-perf.png
+ :alt: Mach try perf with android, and chrome options
+ :scale: 75%
+ :align: center
+
+
+Variants
+--------
+
+If you are looking for any variants (e.g. no-fission, bytecode-cached, live-sites), use the ``--variants`` options like so ``./mach try perf --variants live-sites``. This will select all possible categories that could have live-sites tests.
+
+
+.. image:: ./variants-try-perf.png
+ :alt: Mach try perf with variants
+ :scale: 75%
+ :align: center
+
+
+Note that it is expected that the offered categories have extra variants (such as bytecode-cached) as we are showing all possible combinations that can include live-sites.
+
+Platforms
+---------
+
+To target a particular platform you can use ``--platforms`` to only show categories with the given platforms.
+
+Categories
+----------
+
+In the future, this section will be populated dynamically. If you are wondering what the categories you selected will run, you can use ``--no-push`` to print out a list of tasks that will run like so::
+
+ $ ./mach try perf --no-push
+
+ Artifact builds enabled, pass --no-artifact to disable
+ Gathering tasks for Benchmarks desktop category
+ Executing queries: 'browsertime 'benchmark, !android 'shippable !-32 !clang, !live, !profil, !chrom
+ estimates: Runs 66 tasks (54 selected, 12 dependencies)
+ estimates: Total task duration 8:45:58
+ estimates: In the shortest 38% of durations (thanks!)
+ estimates: Should take about 1:04:58 (Finished around 2022-11-22 15:08)
+ Commit message:
+ Perf selections=Benchmarks desktop (queries='browsertime 'benchmark&!android 'shippable !-32 !clang&!live&!profil&!chrom)
+ Pushed via `mach try perf`
+ Calculated try_task_config.json:
+ {
+ "env": {
+ "TRY_SELECTOR": "fuzzy"
+ },
+ "tasks": [
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-ares6",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-assorted-dom",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-jetstream2",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-matrix-react-bench",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-animometer",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-htmlsuite",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-speedometer",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-stylebench",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-sunspider",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-twitch-animation",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-unity-webgl",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-firefox-webaudio",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-baseline",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-optimizing",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-baseline",
+ "test-linux1804-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-optimizing",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-ares6",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-assorted-dom",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-jetstream2",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-matrix-react-bench",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-animometer",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-htmlsuite",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-speedometer",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-stylebench",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-sunspider",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-twitch-animation",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-unity-webgl",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-firefox-webaudio",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-baseline",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-optimizing",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-baseline",
+ "test-macosx1015-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-optimizing",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-ares6",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-assorted-dom",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-jetstream2",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-matrix-react-bench",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-animometer",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-motionmark-htmlsuite",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-speedometer",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-stylebench",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-sunspider",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-twitch-animation",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-unity-webgl",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-firefox-webaudio",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-baseline",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-godot-optimizing",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-baseline",
+ "test-windows10-64-shippable-qr/opt-browsertime-benchmark-wasm-firefox-wasm-misc-optimizing"
+ ],
+ "use-artifact-builds": true,
+ "version": 1
+ }
+
+
+Adding a New Category
+---------------------
+
+It's very easy to add a new category if needed, and you can do so by modifying the `PerfParser categories attribute here <https://searchfox.org/mozilla-central/source/tools/tryselect/selectors/perf.py#179>`_. The following is an example of a complex category that gives a good idea of what you have available::
+
+ "Resource Usage": {
+ "query": {
+ "talos": ["'talos 'xperf | 'tp5"],
+ "raptor": ["'power 'osx"],
+ "awsy": ["'awsy"],
+ },
+ "suites": ["talos", "raptor", "awsy"],
+ "platform-restrictions": ["desktop"],
+ "variant-restrictions": {
+ "raptor": [],
+ "talos": [],
+ },
+ "app-restrictions": {
+ "raptor": ["firefox"],
+ "talos": ["firefox"],
+ },
+ "tasks": [],
+ },
+
+The following fields are available:
+ * **query**: Set the queries to use for each suite you need.
+ * **suites**: The suites that are needed for this category.
+ * **tasks**: A hard-coded list of tasks to select.
+ * **platform-restrictions**: The platforms that it can run on.
+ * **app-restrictions**: A list of apps that the category can run.
+ * **variant-restrictions**: A list of variants available for each suite.
+
+Note that setting the App/Variant-Restriction fields should be used to restrict the available apps and variants, not expand them as the suites, apps, and platforms combined already provide the largest coverage. The restrictions should be used when you know certain things definitely won't work, or will never be implemented for this category of tests. For instance, our ``Resource Usage`` tests only work on Firefox even though they may exist in Raptor which can run tests with Chrome.
+
+Comparators
+-----------
+
+If the standard/default push-to-try comparison is not enough, you can build your own "comparator" that can setup the base, and new revisions. The default comparator ``BasePerfComparator`` runs the standard mach-try-perf comparison, and there also exists a custom comparator called ``BenchmarkComparator`` for running custom benchmark comparisons on try (using Github PR links).
+
+If you'd like to add a custom comparator, you can either create it in a separate file and pass it in the ``--comparator``, or add it to the ``tools/tryselect/selectors/perfselector/perfcomparators.py`` and use the name of the class as the ``--comparator`` argument (e.g. ``--comparator BenchmarkComparator``). You can pass additional arguments to it using the ``--comparator-args`` option that accepts arguments in the format ``NAME=VALUE``.
+
+The custom comparator needs to be a subclass of ``BasePerfComparator``, and optionally overrides its methods. See the comparators file for more information about the interface available. Here's the general interface for it (subject to change), note that the ``@comparator`` decorator is required when making a builtin comparator::
+
+ @comparator
+ class BasePerfComparator:
+ def __init__(self, vcs, compare_commit, current_revision_ref, comparator_args):
+ """Initialize the standard/default settings for Comparators.
+
+ :param vcs object: Used for updating the local repo.
+ :param compare_commit str: The base revision found for the local repo.
+ :param current_revision_ref str: The current revision of the local repo.
+ :param comparator_args list: List of comparator args in the format NAME=VALUE.
+ """
+
+ def setup_base_revision(self, extra_args):
+ """Setup the base try run/revision.
+
+ The extra_args can be used to set additional
+ arguments for Raptor (not available for other harnesses).
+
+ :param extra_args list: A list of extra arguments to pass to the try tasks.
+ """
+
+ def teardown_base_revision(self):
+ """Teardown the setup for the base revision."""
+
+ def setup_new_revision(self, extra_args):
+ """Setup the new try run/revision.
+
+ Note that the extra_args are reset between the base, and new revision runs.
+
+ :param extra_args list: A list of extra arguments to pass to the try tasks.
+ """
+
+ def teardown_new_revision(self):
+ """Teardown the new run/revision setup."""
+
+ def teardown(self):
+ """Teardown for failures.
+
+ This method can be used for ensuring that the repo is cleaned up
+ when a failure is hit at any point in the process of doing the
+ new/base revision setups, or the pushes to try.
+ """
+
+Frequently Asked Questions (FAQ)
+--------------------------------
+
+If you have any questions which aren't already answered below please reach out to us in the `perftest matrix channel <https://matrix.to/#/#perftest:mozilla.org>`_.
+
+ * **How can I tell what a category or a set of selections will run?**
+
+ At the moment, you need to run your command with an additional option to see what will be run: ``./mach try perf --no-push``. See the `Categories`_ section for more information about this. In the future, we plan on having an dynamically updated list for the tasks in the `Categories`_ section of this document.
+
+ * **What's the difference between ``Pageload desktop``, and ``Pageload desktop firefox``?**
+
+ If you simply ran ``./mach try perf`` with no additional options, then there is no difference. If you start adding additional browsers to the try run with commands like ``./mach try perf --chrome``, then ``Pageload desktop`` will select all tests available for ALL browsers available, and ``Pageload desktop firefox`` will only select Firefox tests. When ``--chrome`` is provided, you'll also see a ``Pageload desktop chrome`` option.
+
+ * **Help! I can't find a test in any of the categories. What should I do?**
+
+ Use the option ``--show-all``. This will let you select tests from the ``./mach try fuzzy --full`` interface directly instead of the categories. You will always be able to find your tests this way. Please be careful with your task selections though as it's easy to run far too many tests in this way!
+
+ * **How do I run Fenix tests?**
+
+ Use the options ``--android --fenix``. This will enable Fenix tasks to be selected in the categories you pick, assuming those categories have Fenix tasks available. **Note that the Fenix APK is pulled from the firefox-android projet so any local changes you make will not be applied to it, and the base/new pushes will be testing the same build.** However, if you use the ``--browsertime-upload-apk <PATH-TO-APK>`` option, you will be able to upload a locally built APK of Fenix to run in try. It will be used in the new revision push. See the ``--help`` for more information on this.
+
+Future Work
+-----------
+
+The future work for this tool can be `found in this bug <https://bugzilla.mozilla.org/show_bug.cgi?id=1799178>`_. Feel free to file improvments, and bugs against it.
diff --git a/testing/performance/mach-try-perf/perfdocs/standard-try-perf.png b/testing/performance/mach-try-perf/perfdocs/standard-try-perf.png
new file mode 100644
index 0000000000..d1168665fb
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/standard-try-perf.png
Binary files differ
diff --git a/testing/performance/mach-try-perf/perfdocs/standard-workflow.rst b/testing/performance/mach-try-perf/perfdocs/standard-workflow.rst
new file mode 100644
index 0000000000..e874ecc7b8
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/standard-workflow.rst
@@ -0,0 +1,73 @@
+####################################
+Standard Workflow with Mach Try Perf
+####################################
+
+.. contents::
+ :depth: 2
+ :local:
+
+This page is a guide for the standard workflow when working with ``./mach try perf``. It contains information for how you can make the most of this tool to enhance your development experience when working on performance.
+
+Starting off with Mach Try Perf
+-------------------------------
+
+In :ref:`Mach Try Perf`, there's information about the purpose of tool along with and overview of the features. Here we'll explain how to start working with it.
+
+When ``mach try perf`` is run, the exact same interface as seen with ``./mach try fuzzy`` will be shown, and everything works in the same way. However, instead of individual tasks, categories of tasks are displayed. To find more information what a particular category, or a selection of categories, will run on try, add the ``--no-push`` option to output a JSON file in your command console with all the selected tasks. Follow `bug 1826190 <https://bugzilla.mozilla.org/show_bug.cgi?id=1826190>`_ for improvements to this.
+
+.. note::
+ Some categories, like ``Benchmarks desktop``, and ``Benchmark desktop firefox``, will only produce different sets of tasks if another option such as ``--chrome`` or ``--safari`` is passed. As those kinds of flags are added, the ``Benchmarks desktop`` category will contain increasingly more tasks to prevent the need for finding, and selecting multiple subcategories. The tool is restrictive in what can be run by default, as generally, the other browsers aren't needed in a standard workflow. This currently includes the Android platform for GeckoView, and Fenix as device capacity is limited, and it can be enabled with ``--android``.
+
+After selecting some relevant categories, and pressing enter in the interface, two pushes will start. The first push that happens is the **new** try run. It contains any patches that may have been made locally. After that, a **base** try run is produced which uses the mozilla-central those patches are based on. These two are then used to produce a Compare View link in the command console that can be used to quickly see the performance differences between the **base**, and **new** tests. Note that these two pushes can take some time, and there's some work in progress `to reduce this wait time here <https://bugzilla.mozilla.org/show_bug.cgi?id=1845789>`_.
+
+
+CompareView
+-----------
+
+The CompareView provides a comparison of how the **new** revisions/patches change the performance of the browser versus the **base** mozilla-central revision. The image below shows the CompareView comparing two try commits to each other. If it doesn't look like there's enough data, hover over the table rows to reveal the "refresh"-like buttons (at the right-end next to the total runs) that are used to retrigger the tests. The revision links at the top of this page can be used to navigate to the individual try runs.
+
+.. note::
+ The retrigger button in the CompareView is the simplest way to retrigger/rebuild tests on the base build. The base build that the try runs are produced on are cached locally to prevent wasting CI resources, however, this also means the ``--rebuild X`` option will only apply to the first try run made on a base revision. This cache can be cleared with ``--clear-cache``.
+
+.. image:: ./compare-view-sample.png
+ :alt: Sample comparison on CompareView
+ :scale: 50%
+ :align: center
+
+Some more information on this tool `can be found here <https://wiki.mozilla.org/TestEngineering/Performance/Sheriffing/CompareView>`_.
+
+Understanding the Results
+-------------------------
+
+In the image above, the **base**, and **new** columns show the average value across all tests. The number of data points used here can be changed by clicking the **Use replicates** button at the top-right of the table (only for try pushes). Alternatively, you can navigate to the try runs to retrigger the tests, or use the "refresh"-like button mentioned above. Hovering over the values in these columns will show you the spread of the data along with the standard deviation in percentage form.
+
+The **delta** column shows the difference between the two revisions' average in percentage. A negative value here means that the associated metric has decreased, and vice versa for positive values.
+
+The **Magnitude of change** gives a visual indication of how large the change is, and the **Confidence** column shows the T-test value that the comparison produced. Higher values here indicate a higher degree of certainty over the differences.
+
+The **confidence**, and **base**/**new** values are the main columns needed to understand the results. These show if the difference is something we're confident in, and provides an absolute measurement of the difference. Retriggering tests will increase the number of data points available for comparisons, and produce a higher confidence in the differences measured. It's also possible for retriggers to decrease the statistical significance of a change if it has a lot of variance.
+
+The **graphs** link navigates to the Graphs View that can be used to visualize the data points, and navigate directly to each individual job. See `Graphs View`_ below for more information on this tool.
+
+After looking over the results, and confirming that a patch either fixes a performance issue, or is confirmed to not cause performance issues, this concludes the standard workflow for ``./mach try perf``.
+
+For any additional questions, please reach out to us in the `#perftest <https://matrix.to/#/#perftest:mozilla.org>`_ channel on matrix.
+
+Additional Information
+----------------------
+
+Debugging an Alert
+==================
+
+To debug an alert in CI, use ``./mach try perf --alert <ALERT-NUMBER>`` to run the tests that alerted. After running the command, the standard workflow above still applies. See :ref:`Running Alert Tests` for more information on this.
+
+Graphs View
+===========
+
+The Graphs View will be used a lot when looking through the metrics in the Compare View. It can be used to see how the data spread looks if the tooltip hover in the Compare View is not enough. `More information on it can be found here <https://wiki.mozilla.org/TestEngineering/Performance/Sheriffing/Workflow#Reading_the_graph>`_.
+
+Perfherder
+==========
+Perfherder is a performance monitoring tool that takes data points from CI log files and graphs them over time. It's primary purpose is to find, and alert on changes that were detected, but it's often used for simple manual monitoring as well.
+
+The Graphs View, Alerts View, and Compare View, are all components of Perfherder. `More information on this system can be found here <https://wiki.mozilla.org/Performance/Tools/FAQ#Perfherder>`_.
diff --git a/testing/performance/mach-try-perf/perfdocs/variants-try-perf.png b/testing/performance/mach-try-perf/perfdocs/variants-try-perf.png
new file mode 100644
index 0000000000..54050db962
--- /dev/null
+++ b/testing/performance/mach-try-perf/perfdocs/variants-try-perf.png
Binary files differ
diff --git a/testing/performance/pageload_sites.json b/testing/performance/pageload_sites.json
new file mode 100644
index 0000000000..8037797f88
--- /dev/null
+++ b/testing/performance/pageload_sites.json
@@ -0,0 +1,608 @@
+{
+ "mobile": [
+ {
+ "login": false,
+ "name": "allrecipes",
+ "test_url": "https://www.allrecipes.com/",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='onetrust-reject-all-handler']"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "amazon",
+ "test_url": "https://www.amazon.com"
+ },
+ {
+ "login": false,
+ "name": "amazon-search",
+ "test_url": "https://www.amazon.com/s/ref=nb_sb_noss_2/139-6317191-5622045?url=search-alias%3Daps&field-keywords=mobile+phone"
+ },
+ {
+ "login": false,
+ "name": "bing",
+ "test_url": "https://www.bing.com/",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='bnp_btn_reject']"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "bing-search-restaurants",
+ "test_url": "https://www.bing.com/search?q=restaurants+in+exton+pa+19341",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='bnp_btn_reject']"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "booking",
+ "test_url": "https://www.booking.com/",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[5]/div[3]/div[3]/div[1]/button"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "cnn",
+ "test_url": "https://cnn.com",
+ "secondary_url": "https://www.cnn.com/weather",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[14]/div[3]/div[3]/div[1]/button[2]"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "cnn-ampstories",
+ "test_url": "https://cnn.com/ampstories/us/why-hurricane-michael-is-a-monster-unlike-any-other",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[14]/div[3]/div[3]/div[1]/button[2]"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "dailymail",
+ "test_url": "https://www.dailymail.co.uk/sciencetech/article-9749081/Experts-say-Hubble-repair-despite-NASA-insisting-multiple-options-fix.html"
+ },
+ {
+ "login": false,
+ "name": "ebay-kleinanzeigen",
+ "test_url": "https://m.ebay-kleinanzeigen.de"
+ },
+ {
+ "login": false,
+ "name": "ebay-kleinanzeigen-search",
+ "test_url": "https://m.ebay-kleinanzeigen.de/s-anzeigen/auf-zeit-wg-berlin/zimmer/c199-l3331"
+ },
+ {
+ "login": false,
+ "name": "espn",
+ "test_url": "http://www.espn.com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words"
+ },
+ {
+ "login": true,
+ "name": "facebook",
+ "test_url": "https://m.facebook.com"
+ },
+ {
+ "login": false,
+ "name": "facebook-cristiano",
+ "test_url": "https://m.facebook.com/Cristiano"
+ },
+ {
+ "login": true,
+ "name": "google",
+ "test_url": "https://www.google.com"
+ },
+ {
+ "login": false,
+ "name": "google-maps",
+ "test_url": "https://www.google.com/maps?force=pwa"
+ },
+ {
+ "login": true,
+ "name": "google-search-restaurants",
+ "test_url": "https://www.google.com/search?q=restaurants+near+me"
+ },
+ {
+ "login": false,
+ "name": "imdb",
+ "test_url": "https://m.imdb.com/"
+ },
+ {
+ "login": true,
+ "name": "instagram",
+ "test_url": "https://www.instagram.com"
+ },
+ {
+ "login": false,
+ "name": "sina",
+ "test_url": "https://www.sina.com.cn/"
+ },
+ {
+ "login": false,
+ "name": "microsoft-support",
+ "test_url": "https://support.microsoft.com/en-us"
+ },
+ {
+ "login": false,
+ "name": "reddit",
+ "test_url": "https://www.reddit.com"
+ },
+ {
+ "login": false,
+ "name": "stackoverflow",
+ "test_url": "https://stackoverflow.com/"
+ },
+ {
+ "login": false,
+ "name": "web-de",
+ "test_url": "https://web.de/magazine/politik/politologe-glaubt-grossen-koalition-herbst-knallen-33563566",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='edit-purpose-settings']"],
+ ["click.byXpathAndWait", "//*[@id='save-purpose-settings']"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "wikipedia",
+ "test_url": "https://en.m.wikipedia.org/wiki/Main_Page"
+ },
+ {
+ "login": false,
+ "name": "youtube",
+ "test_url": "https://m.youtube.com",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[2]/ytm-consent-bump-v2-renderer/div/div[2]/div[3]/c3-material-button[2]/button/div/div"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "youtube-watch",
+ "test_url": "https://www.youtube.com/watch?v=COU5T-Wafa4",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[2]/ytm-consent-bump-v2-renderer/div/div[2]/div[3]/c3-material-button[2]/button/div/div"
+ ]
+ ]
+ }
+ ],
+ "desktop": [
+ {
+ "login": false,
+ "name": "amazon",
+ "test_url": "https://www.amazon.com/s?k=laptop&ref=nb_sb_noss_1",
+ "secondary_url": "https://www.amazon.com/Acer-A515-46-R14K-Quad-Core-Processor-Backlit/dp/B08VKNVDDR/ref=sr_1_3?dchild=1&keywords=laptop&qid=1627047187&sr=8-3"
+ },
+ {
+ "login": false,
+ "name": "bing-search",
+ "test_url": "https://www.bing.com/search?q=barack+obama",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div[1]/div/div[2]/div[2]/button[2]/a"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "buzzfeed",
+ "test_url": "https://www.buzzfeed.com/",
+ "secondary_url": "https://www.buzzfeed.com/quizzes",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div/div/div[2]/div/button[2]"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "cnn",
+ "test_url": "https://www.cnn.com/2021/03/22/weather/climate-change-warm-waters-lake-michigan/index.html",
+ "secondary_url": "https://www.cnn.com/weather",
+ "preferences": {
+ "media.autoplay.default": 5,
+ "media.autoplay.ask-permission": true,
+ "media.autoplay.blocking_policy": 1,
+ "media.allowed-to-play.enabled": false,
+ "media.block-autoplay-until-in-foreground": true
+ },
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[13]/div[3]/div[3]/div[1]/button[2]"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "ebay",
+ "test_url": "https://www.ebay.com/",
+ "secondary_url": "https://www.ebay.com/deals",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "//*[@id='gdpr-banner-decline']"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "espn",
+ "test_url": "http://www.espn.com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[10]/div[2]/div/div/div[3]/button"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "example",
+ "test_url": "https://www.example.com"
+ },
+ {
+ "login": false,
+ "name": "expedia",
+ "test_url": "https://expedia.com/Hotel-Search?destination=New+York%2C+New+York&latLong=40.756680%2C-73.986470&regionId=178293&startDate=&endDate=&rooms=1&_xpid=11905%7C1&adults=2",
+ "secondary_url": "https://groups.expedia.com/Group-Rate/?locale=en_US&ol=1"
+ },
+ {
+ "login": true,
+ "name": "facebook",
+ "test_url": "https://www.facebook.com",
+ "secondary_url": "https://www.facebook.com/marketplace/?ref=bookmark"
+ },
+ {
+ "login": true,
+ "login-test": true,
+ "name": "facebook-login",
+ "test_url": "https://www.facebook.com",
+ "type": "interactive",
+ "test_cmds": [
+ ["setup_login", "https://www.facebook.com"],
+ ["wait.byTime", 1000],
+ ["login", ""],
+ ["measure.start", "marketplace"],
+ ["navigate", "https://www.facebook.com/marketplace"],
+ ["measure.stop", ""]
+ ]
+ },
+ {
+ "login": false,
+ "name": "fandom",
+ "test_url": "https://www.fandom.com/articles/fallout-76-will-live-and-die-on-the-creativity-of-its-playerbase",
+ "test_cmds": [
+ ["click.byXpathAndWait", "/html/body/div[9]/div/div/div[2]/div[1]"],
+ ["click.byXpathAndWait", "/html/body/div[9]/div/div/div[2]/div[2]"]
+ ]
+ },
+ {
+ "login": true,
+ "name": "google",
+ "test_url": "https://www.google.com/search?hl=en&q=barack+obama&cad=h",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[3]/div[3]/span/div/div/div/div[3]/button[1]/div"
+ ],
+ [
+ "click.byXpathAndWait",
+ "/html/body/c-wiz/div/div/div/div[2]/form/div/button/div[2]"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "google-docs",
+ "test_url": "https://docs.google.com/document/d/1US-07msg12slQtI_xchzYxcKlTs6Fp7WqIc6W5GK5M8/edit?usp=sharing",
+ "secondary_url": "https://docs.google.com/document/d/1vUnn0ePU-ynArE1OdxyEHXR2G0sl74ja_st_4OOzlgE/preview"
+ },
+ {
+ "login": true,
+ "name": "google-mail",
+ "test_url": "https://mail.google.com/",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "/html/body/div/div/span[2]/a[2]"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "google-slides",
+ "test_url": "https://docs.google.com/presentation/d/1Ici0ceWwpFvmIb3EmKeWSq_vAQdmmdFcWqaiLqUkJng/edit?usp=sharing",
+ "secondary_url": "https://docs.google.com/presentation/d/e/2PACX-1vRWwPQQFMDkSR4RtYc7HSAGm-hoprespfemIk5SatJxd2o8yrFfrMeAAUkjdfalC5PpjJ9ZKgfsuQ1T/pub?start=false&loop=false&delayms=3000"
+ },
+ {
+ "login": false,
+ "name": "imdb",
+ "test_url": "https://www.imdb.com/title/tt0084967/?ref_=nv_sr_2",
+ "secondary_url": "https://www.imdb.com/title/tt0084967/episodes/?ref_=tt_ov_epl"
+ },
+ {
+ "login": false,
+ "name": "imgur",
+ "test_url": "https://imgur.com/gallery/uTI7fKy",
+ "inject_deterministic": false,
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div/div/div[2]/div/button[2]"
+ ]
+ ],
+ "secondary_url": "https://imgur.com/gallery/WuOobqV",
+ "preferences": {
+ "media.autoplay.default": 5,
+ "media.autoplay.ask-permission": true,
+ "media.autoplay.blocking_policy": 1,
+ "media.allowed-to-play.enabled": false,
+ "media.block-autoplay-until-in-foreground": true
+ }
+ },
+ {
+ "login": true,
+ "name": "instagram",
+ "test_url": "https://www.instagram.com/"
+ },
+ {
+ "login": true,
+ "name": "linkedin",
+ "test_url": "https://www.linkedin.com/in/thommy-harris-hk-385723106/",
+ "secondary_url": "https://www.linkedin.com/company/github?trk=affiliated-pages"
+ },
+ {
+ "login": false,
+ "name": "microsoft",
+ "test_url": "https://www.microsoft.com/en-us/",
+ "secondary_url": "https://support.microsoft.com/en-us",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[3]/div[1]/div/div/div[2]/div/div/div/div[2]/button[2]"
+ ]
+ ]
+ },
+ {
+ "login": true,
+ "name": "netflix",
+ "test_url": "https://www.netflix.com/title/80117263",
+ "secondary_url": "https://www.netflix.com/title/699257"
+ },
+ {
+ "login": false,
+ "name": "nytimes",
+ "test_url": "https://www.nytimes.com/2020/02/19/opinion/surprise-medical-bill.html",
+ "secondary_url": "https://www.nytimes.com/section/opinion/columnists",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div/div[2]/main/div[3]/div[2]/div/div[2]/button[2]"
+ ]
+ ]
+ },
+ {
+ "login": true,
+ "name": "office",
+ "test_url": "https://www.office.com/launch/powerpoint/",
+ "secondary_url": "https://www.office.com/"
+ },
+ {
+ "login": true,
+ "name": "outlook",
+ "test_url": "https://outlook.live.com/mail/inbox"
+ },
+ {
+ "login": true,
+ "name": "paypal",
+ "test_url": "https://www.paypal.com/myaccount/summary/"
+ },
+ {
+ "login": true,
+ "name": "pinterest",
+ "test_url": "https://pinterest.com/",
+ "secondary_url": "https://www.pinterest.com/today/best/halloween-costumes-for-your-furry-friends/75787/"
+ },
+ {
+ "login": false,
+ "name": "reddit",
+ "test_url": "https://www.reddit.com/r/technology/comments/9sqwyh/we_posed_as_100_senators_to_run_ads_on_facebook/",
+ "secondary_url": "https://www.reddit.com/r/technology/",
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[3]/div[1]/section/div/section/section/form[1]/button"
+ ]
+ ]
+ },
+ {
+ "login": true,
+ "name": "tumblr",
+ "test_url": "https://www.tumblr.com/dashboard",
+ "secondary_url": "https://www.tumblr.com/tagged/funny+cats?sort=top"
+ },
+ {
+ "login": false,
+ "name": "twitch",
+ "test_url": "https://www.twitch.tv/videos/894226211",
+ "secondary_url": "https://www.twitch.tv/gmashley",
+ "preferences": {
+ "media.autoplay.default": 5,
+ "media.autoplay.ask-permission": true,
+ "media.autoplay.blocking_policy": 1,
+ "media.allowed-to-play.enabled": false,
+ "media.block-autoplay-until-in-foreground": true
+ },
+ "dismiss_cookie_prompt": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[1]/div/div/div/div[3]/div/button"
+ ],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[3]/div/div/div/div/div/div[1]/div[2]/div[2]/button"
+ ]
+ ]
+ },
+ {
+ "login": true,
+ "name": "twitter",
+ "test_url": "https://twitter.com/BarackObama"
+ },
+ {
+ "login": false,
+ "name": "wikia",
+ "test_url": "https://marvel.fandom.com/wiki/Black_Panther",
+ "secondary_url": "https://marvel.fandom.com/wiki/Celestials",
+ "dismiss_cookie_prompt": [
+ ["click.byXpathAndWait", "/html/body/div[6]/div/div/div[2]/div[1]"],
+ ["click.byXpathAndWait", "/html/body/div[6]/div/div/div[2]/div[2]"]
+ ]
+ },
+ {
+ "login": false,
+ "name": "wikipedia",
+ "test_url": "https://en.wikipedia.org/wiki/Barack_Obama",
+ "secondary_url": "https://en.wikipedia.org/wiki/Joe_Biden"
+ },
+ {
+ "login": true,
+ "name": "yahoo-mail",
+ "test_url": "https://mail.yahoo.com/"
+ },
+ {
+ "login": false,
+ "name": "youtube",
+ "test_url": "https://www.youtube.com",
+ "secondary_url": "https://www.youtube.com/watch?v=JrdEMERq8MA",
+ "dismiss_cookie_prompt ": [
+ [
+ "click.byXpathAndWait",
+ "/html/body/ytd-app/ytd-consent-bump-v2-lightbox/tp-yt-paper-dialog/div[4]/div[2]/div[6]/div[1]/ytd-button-renderer[1]/a"
+ ]
+ ]
+ },
+ {
+ "login": false,
+ "name": "cnn-nav",
+ "test_url": "https://www.cnn.com/",
+ "type": "interactive",
+ "test_cmds": [
+ ["measure.start", "landing"],
+ ["navigate", "https://www.cnn.com"],
+ ["wait.byTime", 4000],
+ ["measure.stop", ""],
+ ["measure.start", "world"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[5]/div/div/header/div/div[1]/div/div[2]/nav/ul/li[2]/a"
+ ],
+ ["wait.byTime", 1000],
+ ["measure.stop", ""]
+ ]
+ },
+ {
+ "login": false,
+ "name": "reddit-billgates-ama",
+ "test_url": "https://www.reddit.com/",
+ "type": "interactive",
+ "test_cmds": [
+ ["measure.start", "billg-ama"],
+ [
+ "navigate",
+ "https://www.reddit.com/r/IAmA/comments/m8n4vt/im_bill_gates_cochair_of_the_bill_and_melinda/"
+ ],
+ ["wait.byTime", 5000],
+ ["measure.stop", ""],
+ ["measure.start", "members"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[2]/div/div[3]/div[2]/div/div[1]/div/div[4]/div[1]/div"
+ ],
+ ["wait.byTime", 1000],
+ ["measure.stop", ""]
+ ]
+ },
+ {
+ "login": false,
+ "name": "reddit-billgates-post",
+ "test_url": "https://www.reddit.com/user/thisisbillgates/",
+ "type": "interactive",
+ "test_cmds": [
+ ["measure.start", "billg"],
+ ["navigate", "https://www.reddit.com/user/thisisbillgates/"],
+ ["wait.byTime", 5000],
+ ["measure.stop", ""],
+ ["measure.start", "posts"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[2]/div[2]/div/div/div/a[2]"
+ ],
+ ["wait.byTime", 15000],
+ ["measure.stop", ""],
+ ["measure.start", "comments"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[2]/div[2]/div/div/div/a[3]"
+ ],
+ ["wait.byTime", 15000],
+ ["measure.stop", ""],
+ ["measure.start", "hot"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[2]/div[4]/div[1]/div[1]/div[2]/a[2]"
+ ],
+ ["wait.byTime", 15000],
+ ["measure.stop", ""],
+ ["measure.start", "top"],
+ [
+ "click.byXpathAndWait",
+ "/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[2]/div[4]/div[1]/div[1]/div[2]/a[3]"
+ ],
+ ["wait.byTime", 15000],
+ ["measure.stop", ""]
+ ]
+ },
+ {
+ "login": false,
+ "name": "facebook-nav",
+ "test_url": "https://www.facebook.com/",
+ "type": "interactive",
+ "test_cmds": [
+ ["navigate", "https://www.facebook.com/login"],
+ ["wait.byTime", 30000],
+ ["measure.start", "landing"],
+ ["navigate", "https://www.facebook.com/"],
+ ["wait.byTime", 5000],
+ ["measure.stop", ""],
+ ["measure.start", "marketplace"],
+ ["navigate", "https://www.facebook.com/marketplace"],
+ ["wait.byTime", 5000],
+ ["measure.stop", ""],
+ ["measure.start", "groups"],
+ ["navigate", "https://www.facebook.com/groups/discover/"],
+ ["wait.byTime", 5000],
+ ["measure.stop", ""],
+ ["measure.start", "friends"],
+ ["navigate", "https://www.facebook.com/friends/"],
+ ["wait.byTime", 5000],
+ ["measure.stop", ""]
+ ]
+ }
+ ]
+}
diff --git a/testing/performance/perf-sheriffing/perfdocs/Alerts_view.png b/testing/performance/perf-sheriffing/perfdocs/Alerts_view.png
new file mode 100644
index 0000000000..feb13aea44
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/Alerts_view.png
Binary files differ
diff --git a/testing/performance/perf-sheriffing/perfdocs/Alerts_view_toolbar.png b/testing/performance/perf-sheriffing/perfdocs/Alerts_view_toolbar.png
new file mode 100644
index 0000000000..1274a02ef8
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/Alerts_view_toolbar.png
Binary files differ
diff --git a/testing/performance/perf-sheriffing/perfdocs/config.yml b/testing/performance/perf-sheriffing/perfdocs/config.yml
new file mode 100644
index 0000000000..6439645bf8
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/config.yml
@@ -0,0 +1,8 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+---
+name: perf-sheriffing
+manifest: None
+static-only: True
+suites: {}
diff --git a/testing/performance/perf-sheriffing/perfdocs/filtering_alerts.png b/testing/performance/perf-sheriffing/perfdocs/filtering_alerts.png
new file mode 100644
index 0000000000..bef851898a
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/filtering_alerts.png
Binary files differ
diff --git a/testing/performance/perf-sheriffing/perfdocs/flowchart.png b/testing/performance/perf-sheriffing/perfdocs/flowchart.png
new file mode 100644
index 0000000000..496792bfc0
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/flowchart.png
Binary files differ
diff --git a/testing/performance/perf-sheriffing/perfdocs/index.rst b/testing/performance/perf-sheriffing/perfdocs/index.rst
new file mode 100644
index 0000000000..4ab112ed8e
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/index.rst
@@ -0,0 +1,114 @@
+======================
+Performance Sheriffing
+======================
+
+.. contents::
+ :depth: 3
+
+1 Overview
+----------
+
+Performance sheriffs are responsible to make sure that performance changes in Firefox are detected
+and dealt with. They look at data and performance metrics produced by the performance testing frameworks
+and find regression, determine the root cause and get bugs on file to track all issues. The workflow we
+follow is shown below in our flowchart.
+
+1.1 Flowchart
+~~~~~~~~~~~~~
+
+.. image:: ./flowchart.png
+ :alt: Sheriffing Workflow Flowchart
+ :align: center
+
+The workflow of a sheriff is backfilling jobs to get the data, investigating that data, filing
+bugs/linking improvements based on the data, and following up with developers if needed.
+
+1.2 Contacts and the Team
+~~~~~~~~~~~~~~~~~~~~~~~~~
+In the event that you have an urgent issue and need help what can you do?
+
+If you have a question about a bug that was filed and assigned to you reach out to the sheriff who
+filed the bug on matrix. If a performance sheriff is not responsive or you have a question about a bug
+send a message to the `performance sheriffs matrix channel <https://chat.mozilla.org/#/room/#perfsheriffs:mozilla.org>`_
+and tag the sheriff. If you still have no-one responding you can message any of the following people directly
+on slack or matrix:
+
+- `@afinder <https://people.mozilla.org/p/afinder>`_
+- `@alexandrui <https://people.mozilla.org/p/alexandrui>`_
+- `@andra <https://people.mozilla.org/p/andraesanu>`_
+- `@andrej <https://people.mozilla.org/p/andrej>`_
+- `@beatrice <https://people.mozilla.org/p/bacasandrei>`_
+- `@sparky <https://people.mozilla.org/p/sparky>`_ (reach out to only if all others unreachable)
+
+All of the team is in EET (Eastern European Time) except for @andrej and @sparky who are in EST (Eastern Standard Time).
+
+1.3 Regression and improvement Definition
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Whenever we get a performance change we classify it as one of two things, either a regression (worse performance) or
+an improvement (better performance).
+
+2 How to Investigate Alerts
+---------------------------
+In this section we will go over how performance sheriffs investigate alerts.
+
+2.1 Filtering and Reading Alerts
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+On the `Perfherder <https://treeherder.mozilla.org/perfherder/alerts>`_ page you should see something like below:
+
+.. image:: ./Alerts_view.png
+ :alt: Alerts View Toolbar
+ :align: center
+
+After accessing the Perfherder alerts page make sure the filter (located in the top middle of the screenshot below)
+is set to show the correct alerts for sheriffing. The new alerts can be found when
+the **untriaged** option from the left-most dropdown is selected. As shown in the screenshot below:
+
+.. image:: ./Alerts_view_toolbar.png
+ :alt: Alerts View Toolbar
+ :align: center
+
+The rest of the dropdowns from left to right are as follows:
+
+- **Testing harness**: altering this will take you to alerts generated on different harnesses
+- **The filter input**, where you can type some text and press enter to narrow down the alerts view
+- **"Hide downstream / reassigned to / invalid"**: enable this (recommended) to reduce clutter on the page
+- **"My alerts"**: only shows alerts assigned to you.
+
+Below is a screenshot of an alert:
+
+.. image:: ./single_alert.png
+ :alt: Alerts View Toolbar
+ :align: center
+
+You can tell an alert by looking at the bold text, it will say "Alert #XXXXX", in each alert you have groupings of
+summaries of tests, and those tests:
+
+- Can run on different platforms
+- Can share suite name (like tp5o)
+- Measure various metrics
+- Share the same framework
+
+Going from left to right of the columns inside the alerts starting with test, we have:
+
+- A blue hyperlink that links to the test documentation (if available)
+- The **platform** operating system
+- **Information** about the historical data distribution of that
+- Tags and options related to the test
+
+2.2 Regressions vs Improvements
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+First thing to note about how we investigate alerts is that **we prioritize handling regressions**! Unlike the
+**improvements** regressions ship bugs to users that if not addressed make our products worse and drive users away.
+After acknowledging an alert:
+
+- Regressions go through multiple status changes (TODO: link to sections with multiple status changes) until they are finally resolved
+- An improvement has a single status of improvement
+
+2.3 Framework Thresholds
+~~~~~~~~~~~~~~~~~~~~~~~~
+Different frameworks test different things and the threshold for which the alerts are triggered and considered
+performance changes is different based on the harness:
+
+- AWSY >= 0.25%
+- Build metrics installer size >= 100kb
+- Talos, Browsertime, Build Metrics >= 2%
diff --git a/testing/performance/perf-sheriffing/perfdocs/single_alert.png b/testing/performance/perf-sheriffing/perfdocs/single_alert.png
new file mode 100644
index 0000000000..867d487961
--- /dev/null
+++ b/testing/performance/perf-sheriffing/perfdocs/single_alert.png
Binary files differ
diff --git a/testing/performance/perftest.toml b/testing/performance/perftest.toml
new file mode 100644
index 0000000000..9ef3a1878a
--- /dev/null
+++ b/testing/performance/perftest.toml
@@ -0,0 +1,23 @@
+[DEFAULT]
+
+["perftest_WPT_chrome_init_file.js"]
+
+["perftest_WPT_firefox_init_file.js"]
+
+["perftest_android_startup.js"]
+
+["perftest_bbc_link.js"]
+
+["perftest_facebook.js"]
+
+["perftest_jsconf_cold.js"]
+
+["perftest_jsconf_warm.js"]
+
+["perftest_pageload.js"]
+
+["perftest_perfstats.js"]
+
+["perftest_politico_link.js"]
+
+["perftest_youtube_link.js"]
diff --git a/testing/performance/perftest_WPT_chrome_init_file.js b/testing/performance/perftest_WPT_chrome_init_file.js
new file mode 100644
index 0000000000..da2b8d2aff
--- /dev/null
+++ b/testing/performance/perftest_WPT_chrome_init_file.js
@@ -0,0 +1,110 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+/* eslint-env node */
+"use strict";
+function setUp() {}
+
+function tearDown() {}
+
+function test() {}
+
+module.exports = {
+ setUp,
+ tearDown,
+ test,
+ owner: "Performance Testing Team",
+ name: "webpagetest-chrome",
+ description:
+ "Run webpagetest performance pageload tests on Chrome against Alexa top 50 websites",
+ longDescription: `This mozperftest gets webpagetest to run pageload tests on Chrome against the 50 most popular
+ websites and provide data. The full list of data returned from webpagetest: firstContentfulPaint,
+ visualComplete90, firstPaint, visualComplete99, visualComplete, SpeedIndex, bytesIn,bytesOut,
+ TTFB, fullyLoadedCPUms, fullyLoadedCPUpct, domElements, domContentLoadedEventStart, domContentLoadedEventEnd,
+ loadEventStart, loadEventEnd`,
+ options: {
+ test_parameters: {
+ location: "ec2-us-east-1",
+ browser: "Chrome",
+ connection: "Cable",
+ timeout_limit: 21600,
+ wait_between_requests: 5,
+ statistics: ["average", "median", "standardDeviation"],
+ label: "",
+ runs: 3,
+ fvonly: 0,
+ private: 0,
+ web10: 0,
+ script: "",
+ block: "",
+ video: 1,
+ tcpdump: 0,
+ noimages: 0,
+ keepua: 1,
+ uastring: "",
+ htmlbody: 0,
+ custom: "",
+ ignoreSSL: 0,
+ appendua: "",
+ injectScript: "",
+ disableAVIF: 0,
+ disableWEBP: 0,
+ disableJXL: 0,
+ },
+ test_list: [
+ "google.com",
+ "youtube.com",
+ "facebook.com",
+ "qq.com",
+ "baidu.com",
+ "sohu.com",
+ "360.cn",
+ "jd.com",
+ "amazon.com",
+ "yahoo.com",
+ "zoom.us",
+ "sina.com.cn",
+ "live.com",
+ "reddit.com",
+ "netflix.com",
+ "microsoft.com",
+ "instagram.com",
+ "google.com.hk",
+ "csdn.net",
+ "bing.com",
+ "vk.com",
+ "yahoo.co.jp",
+ "twitter.com",
+ "naver.com",
+ "ebay.com",
+ "force.com",
+ "amazon.in",
+ "adobe.com",
+ "aliexpress.com",
+ "linkedin.com",
+ "tianya.cn",
+ "yy.com",
+ "huanqiu.com",
+ "amazon.co.jp",
+ "okezone.com",
+ ],
+ browser_metrics: [
+ "firstContentfulPaint",
+ "visualComplete90",
+ "firstPaint",
+ "visualComplete99",
+ "visualComplete",
+ "SpeedIndex",
+ "bytesIn",
+ "bytesOut",
+ "TTFB",
+ "fullyLoadedCPUms",
+ "fullyLoadedCPUpct",
+ "domElements",
+ "domContentLoadedEventStart",
+ "domContentLoadedEventEnd",
+ "loadEventStart",
+ "loadEventEnd",
+ ],
+ },
+};
diff --git a/testing/performance/perftest_WPT_firefox_init_file.js b/testing/performance/perftest_WPT_firefox_init_file.js
new file mode 100644
index 0000000000..0114a5fbaa
--- /dev/null
+++ b/testing/performance/perftest_WPT_firefox_init_file.js
@@ -0,0 +1,111 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+/* eslint-env node */
+"use strict";
+function setUp() {}
+
+function tearDown() {}
+
+function test() {}
+
+module.exports = {
+ setUp,
+ tearDown,
+ test,
+ owner: "Performance Testing Team",
+ name: "webpagetest-firefox",
+ description:
+ "Run webpagetest performance pageload tests on Firefox against Alexa top 50 websites",
+ longDescription: `This mozperftest gets webpagetest to run pageload tests on Firefox against the 50 most popular
+ websites and provide data. The full list of data returned from webpagetest: firstContentfulPaint,
+ timeToContentfulPaint, visualComplete90, firstPaint, visualComplete99, visualComplete, SpeedIndex, bytesIn, bytesOut,
+ TTFB, fullyLoadedCPUms, fullyLoadedCPUpct, domElements, domContentLoadedEventStart, domContentLoadedEventEnd,
+ loadEventStart, loadEventEnd`,
+ options: {
+ test_parameters: {
+ location: "ec2-us-east-1",
+ browser: "Firefox",
+ connection: "Cable",
+ timeout_limit: 21600,
+ wait_between_requests: 5,
+ statistics: ["average", "median", "standardDeviation"],
+ label: "",
+ runs: 3,
+ fvonly: 0,
+ private: 0,
+ web10: 0,
+ script: "",
+ block: "",
+ video: 1,
+ tcpdump: 0,
+ noimages: 0,
+ keepua: 1,
+ uastring: "",
+ htmlbody: 0,
+ custom: "",
+ ignoreSSL: 0,
+ appendua: "",
+ injectScript: "",
+ disableAVIF: 0,
+ disableWEBP: 0,
+ disableJXL: 0,
+ },
+ test_list: [
+ "google.com",
+ "youtube.com",
+ "facebook.com",
+ "qq.com",
+ "baidu.com",
+ "sohu.com",
+ "360.cn",
+ "jd.com",
+ "amazon.com",
+ "yahoo.com",
+ "zoom.us",
+ "sina.com.cn",
+ "live.com",
+ "reddit.com",
+ "netflix.com",
+ "microsoft.com",
+ "instagram.com",
+ "google.com.hk",
+ "csdn.net",
+ "bing.com",
+ "vk.com",
+ "yahoo.co.jp",
+ "twitter.com",
+ "naver.com",
+ "ebay.com",
+ "force.com",
+ "amazon.in",
+ "adobe.com",
+ "aliexpress.com",
+ "linkedin.com",
+ "tianya.cn",
+ "yy.com",
+ "huanqiu.com",
+ "amazon.co.jp",
+ "okezone.com",
+ ],
+ browser_metrics: [
+ "firstContentfulPaint",
+ "timeToContentfulPaint",
+ "visualComplete90",
+ "firstPaint",
+ "visualComplete99",
+ "visualComplete",
+ "SpeedIndex",
+ "bytesIn",
+ "bytesOut",
+ "TTFB",
+ "fullyLoadedCPUms",
+ "fullyLoadedCPUpct",
+ "domElements",
+ "domContentLoadedEventStart",
+ "domContentLoadedEventEnd",
+ "loadEventStart",
+ "loadEventEnd",
+ ],
+ },
+};
diff --git a/testing/performance/perftest_android_startup.js b/testing/performance/perftest_android_startup.js
new file mode 100644
index 0000000000..4dfcd32af0
--- /dev/null
+++ b/testing/performance/perftest_android_startup.js
@@ -0,0 +1,33 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+/* eslint-env node */
+"use strict";
+
+async function test(context, commands) {}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "android-startup",
+ description: "Measures android startup times",
+ longDescription: `
+ This test consists of 2 main tests, cold main first frame(cmff) and cold view nav start(cvns).
+ cold main first frame is the measurement from when you click the app icon & get duration to first frame from 'am start -W'.
+ cold view nav start is the measurement from when you send a VIEW intent & get duration from logcat: START proc to PageStart.
+ `,
+ usage: `
+ ./mach perftest --flavor mobile-browser --AndroidStartUp testing/performance/perftest_android_startup.js
+ --browsertime-cycles=0 --AndroidStartUp-test-name=cold_view_nav_start --perfherder --hooks
+ testing/performance/hooks_android_startup.py --AndroidStartUp-product=fenix
+ --AndroidStartUp-release-channel=nightly
+ `,
+ options: {
+ test_parameters: {
+ single_date: null, // Dates in YYYY.MM.DD format
+ date_range: [], // 2 Dates in YYYY.MM.DD format the first and last date(inclusive)
+ startup_cache: true,
+ test_cycles: 50,
+ },
+ },
+};
diff --git a/testing/performance/perftest_bbc_link.js b/testing/performance/perftest_bbc_link.js
new file mode 100644
index 0000000000..3021c44c83
--- /dev/null
+++ b/testing/performance/perftest_bbc_link.js
@@ -0,0 +1,29 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function test(context, commands) {
+ let rootUrl = "https://www.bbc.com/";
+
+ await commands.navigate(rootUrl);
+
+ // Wait for browser to settle
+ await commands.wait.byTime(10000);
+
+ // Start the measurement
+ await commands.measure.start("pageload");
+
+ // Click on the link and wait for page complete check to finish.
+ await commands.click.byClassNameAndWait("block-link__overlay-link");
+
+ // Stop and collect the measurement
+ await commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "BBC Link",
+ component: "pageload",
+ description: "Measures time to load BBC homepage",
+};
diff --git a/testing/performance/perftest_facebook.js b/testing/performance/perftest_facebook.js
new file mode 100644
index 0000000000..bd607d6be4
--- /dev/null
+++ b/testing/performance/perftest_facebook.js
@@ -0,0 +1,51 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function test(context, commands) {
+ await commands.navigate("https://www.example.com");
+ await commands.wait.byTime(15000);
+
+ // Fill in:
+ let username = "some_user@mail.com";
+ let passworld = "topsecretpassword";
+
+ // We start by navigating to the login page.
+ await commands.navigate("https://www.facebook.com");
+
+ // When we fill in a input field/click on a link we wanna
+ // try/catch that if the HTML on the page changes in the feature
+ // sitespeed.io will automatically log the error in a user friendly
+ // way, and the error will be re-thrown so you can act on it.
+ await commands.wait.byTime(5000);
+
+ // Add text into an input field, finding the field by id
+ await commands.addText.bySelector(username, "input[name=email]");
+ await commands.wait.byTime(2000);
+ await commands.addText.bySelector(passworld, "input[name=pass]");
+ await commands.wait.byTime(2000);
+
+ // Start the measurement before we click on the
+ // submit button. Sitespeed.io will start the video recording
+ // and prepare everything.
+ // Find the sumbit button and click it and then wait
+ // for the pageCompleteCheck to finish
+ await commands.measure.start("pageload");
+
+ // There are two variants of the facebook login page:
+ try {
+ await commands.click.bySelectorAndWait("button[name=login]");
+ } catch (e) {
+ await commands.click.bySelectorAndWait("input[type=submit]");
+ }
+
+ // Stop and collect the measurement before the next page we want to measure
+ await commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "Facebook",
+ description: "Measures time to log in to Facebook",
+};
diff --git a/testing/performance/perftest_jsconf_cold.js b/testing/performance/perftest_jsconf_cold.js
new file mode 100644
index 0000000000..c6b68a3e55
--- /dev/null
+++ b/testing/performance/perftest_jsconf_cold.js
@@ -0,0 +1,28 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function test(context, commands) {
+ let rootUrl = "https://2019.jsconf.eu/";
+
+ await commands.navigate(rootUrl);
+
+ // Wait for browser to settle
+ await commands.wait.byTime(10000);
+
+ // Start the measurement
+ await commands.measure.start("pageload");
+
+ // Click on the link and wait for page complete check to finish.
+ await commands.click.byLinkTextAndWait("Artists");
+
+ // Stop and collect the measurement
+ await commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "JSConf (cold)",
+ description: "Measures time to load JSConf page (cold)",
+};
diff --git a/testing/performance/perftest_jsconf_warm.js b/testing/performance/perftest_jsconf_warm.js
new file mode 100644
index 0000000000..be58553ab6
--- /dev/null
+++ b/testing/performance/perftest_jsconf_warm.js
@@ -0,0 +1,34 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function test(context, commands) {
+ let rootUrl = "https://2019.jsconf.eu/";
+
+ await commands.navigate(rootUrl);
+
+ // Wait for browser to settle
+ await commands.wait.byTime(10000);
+
+ // Click on the link and wait a few seconds
+ await commands.click.byLinkTextAndWait("Artists");
+ await commands.wait.byTime(3000);
+
+ // Back to about
+ await commands.click.byLinkTextAndWait("About");
+ await commands.wait.byTime(3000);
+
+ // Start the measurement
+ await commands.measure.start("pageload");
+ await commands.click.byLinkTextAndWait("Artists");
+
+ // Stop and collect the measurement
+ await commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "JSConf (warm)",
+ description: "Measures time to load JSConf page (warm)",
+};
diff --git a/testing/performance/perftest_pageload.js b/testing/performance/perftest_pageload.js
new file mode 100644
index 0000000000..36a0ca8b68
--- /dev/null
+++ b/testing/performance/perftest_pageload.js
@@ -0,0 +1,29 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function setUp(context) {
+ context.log.info("setUp example!");
+}
+
+async function test(context, commands) {
+ let url = context.options.browsertime.url;
+ await commands.navigate("https://www.mozilla.org/en-US/");
+ await commands.wait.byTime(100);
+ await commands.navigate("about:blank");
+ await commands.wait.byTime(50);
+ return commands.measure.start(url);
+}
+
+async function tearDown(context) {
+ context.log.info("tearDown example!");
+}
+
+module.exports = {
+ setUp,
+ tearDown,
+ test,
+ owner: "Performance Team",
+ name: "pageload",
+ description: "Measures time to load mozilla page",
+};
diff --git a/testing/performance/perftest_perfstats.js b/testing/performance/perftest_perfstats.js
new file mode 100644
index 0000000000..ad3e49eb79
--- /dev/null
+++ b/testing/performance/perftest_perfstats.js
@@ -0,0 +1,52 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const urls = [
+ "https://accounts.google.com",
+ "https://cnn.com/ampstories/us/why-hurricane-michael-is-a-monster-unlike-any-other",
+ "https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-commits-in-git",
+ "https://expedia.com/Hotel-Search?destination=New+York%2C+New+York&latLong=40.756680%2C-73.986470&regionId=178293&startDate=&endDate=&rooms=1&_xpid=11905%7C1&adults=2",
+ "https://m.imdb.com/title/tt0083943/",
+];
+
+const idle_delay = 10000;
+
+async function test(context, commands) {
+ await commands.wait.byTime(idle_delay);
+
+ await commands.measure.start();
+
+ // Cold
+ for (const url of urls) {
+ await commands.navigate(url);
+ await commands.wait.byTime(idle_delay);
+ }
+
+ await commands.navigate("about:blank");
+ await commands.wait.byTime(idle_delay);
+
+ // Warm
+ for (const url of urls) {
+ await commands.navigate(url);
+ await commands.wait.byTime(idle_delay);
+ }
+
+ return commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "perfstats",
+ description: "Collect perfstats for the given site",
+ longDescription: `
+ This test launches browsertime with the perfStats option (will collect low-overhead timings, see Bug 1553254).
+ The test currently runs a short user journey. A selection of popular sites are visited, first as cold pageloads, and then as warm.
+ `,
+ usage: `
+ ./mach perftest --hook testing/performance/hooks_perfstats.py \
+ testing/performance/perftest_perfstats.js --browsertime-iterations 10 \
+ --perfherder-metrics name:HttpChannelCompletion_Cache name:HttpChannelCompletion_Network
+ `,
+};
diff --git a/testing/performance/perftest_politico_link.js b/testing/performance/perftest_politico_link.js
new file mode 100644
index 0000000000..019595afb8
--- /dev/null
+++ b/testing/performance/perftest_politico_link.js
@@ -0,0 +1,28 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function test(context, commands) {
+ let rootUrl = "https://www.politico.com/";
+
+ await commands.navigate(rootUrl);
+
+ // Wait for browser to settle
+ await commands.wait.byTime(10000);
+
+ // Start the measurement
+ await commands.measure.start("pageload");
+
+ // Click on the link and wait for page complete check to finish.
+ await commands.click.byClassNameAndWait("js-tealium-tracking");
+
+ // Stop and collect the measurement
+ await commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "Politico Link",
+ description: "Measures time to load Politico homepage",
+};
diff --git a/testing/performance/perftest_record.js b/testing/performance/perftest_record.js
new file mode 100644
index 0000000000..a0bfa6d134
--- /dev/null
+++ b/testing/performance/perftest_record.js
@@ -0,0 +1,562 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+/* eslint-env node */
+"use strict";
+
+const fs = require("fs");
+const http = require("http");
+
+const URL = "/secrets/v1/secret/project/perftest/gecko/level-";
+const SECRET = "/perftest-login";
+const DEFAULT_SERVER = "https://firefox-ci-tc.services.mozilla.com";
+
+const SCM_1_LOGIN_SITES = ["facebook", "netflix"];
+
+/**
+ * This function obtains the perftest secret from Taskcluster.
+ *
+ * It will NOT work locally. Please see the get_logins function, you
+ * will need to define a JSON file and set the RAPTOR_LOGINS
+ * env variable to its path.
+ */
+async function get_tc_secrets(context) {
+ const MOZ_AUTOMATION = process.env.MOZ_AUTOMATION;
+ if (!MOZ_AUTOMATION) {
+ throw Error(
+ "Not running in CI. Set RAPTOR_LOGINS to a JSON file containing the logins."
+ );
+ }
+
+ let TASKCLUSTER_PROXY_URL = process.env.TASKCLUSTER_PROXY_URL
+ ? process.env.TASKCLUSTER_PROXY_URL
+ : DEFAULT_SERVER;
+
+ let MOZ_SCM_LEVEL = process.env.MOZ_SCM_LEVEL ? process.env.MOZ_SCM_LEVEL : 1;
+
+ const url = TASKCLUSTER_PROXY_URL + URL + MOZ_SCM_LEVEL + SECRET;
+
+ const data = await new Promise((resolve, reject) => {
+ context.log.info("Obtaining secrets for login...");
+
+ http.get(
+ url,
+ {
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ },
+ },
+ res => {
+ let data = "";
+ context.log.info(`Secret status code: ${res.statusCode}`);
+
+ res.on("data", d => {
+ data += d.toString();
+ });
+
+ res.on("end", () => {
+ resolve(data);
+ });
+
+ res.on("error", error => {
+ context.log.error(error);
+ reject(error);
+ });
+ }
+ );
+ });
+
+ return JSON.parse(data);
+}
+
+/**
+ * This function gets the login information required.
+ *
+ * It starts by looking for a local file whose path is defined
+ * within RAPTOR_LOGINS. If we don't find this file, then we'll
+ * attempt to get the login information from our Taskcluster secret.
+ * If MOZ_AUTOMATION is undefined, then the test will fail, Taskcluster
+ * secrets can only be obtained in CI.
+ */
+async function get_logins(context) {
+ let logins;
+
+ let RAPTOR_LOGINS = process.env.RAPTOR_LOGINS;
+ if (RAPTOR_LOGINS) {
+ // Get logins from a local file
+ if (!RAPTOR_LOGINS.endsWith(".json")) {
+ throw Error(
+ `File given for logins does not end in '.json': ${RAPTOR_LOGINS}`
+ );
+ }
+
+ let logins_file = null;
+ try {
+ logins_file = await fs.readFileSync(RAPTOR_LOGINS, "utf8");
+ } catch (err) {
+ throw Error(`Failed to read the file ${RAPTOR_LOGINS}: ${err}`);
+ }
+
+ logins = await JSON.parse(logins_file);
+ } else {
+ // Get logins from a perftest Taskcluster secret
+ logins = await get_tc_secrets(context);
+ }
+
+ return logins;
+}
+
+/**
+ * This function returns the type of login to do.
+ *
+ * This function returns "single-form" when we find a single form. If we only
+ * find a single input field, we assume that there is one page per input
+ * and return "multi-page". Otherwise, we return null.
+ */
+async function get_login_type(context, commands) {
+ /*
+ Determine if there's a password field visible with this
+ query selector. Some sites use `tabIndex` to hide the password
+ field behind other elements. In this case, we are searching
+ for any password-type field that has a tabIndex of 0 or undefined and
+ is not hidden.
+ */
+ let input_length = await commands.js.run(`
+ return document.querySelectorAll(
+ "input[type=password][tabIndex='0']:not([type=hidden])," +
+ "input[type=password]:not([tabIndex]):not([type=hidden])"
+ ).length;
+ `);
+ if (input_length == 0) {
+ context.log.info("Found a multi-page login");
+ return multi_page_login;
+ } else if (input_length == 1) {
+ context.log.info("Found a single-page login");
+ return single_page_login;
+ }
+
+ if (
+ (await commands.js.run(
+ `return document.querySelectorAll("form").length;`
+ )) >= 1
+ ) {
+ context.log.info("Found a single-form login");
+ return single_form_login;
+ }
+
+ return null;
+}
+
+/**
+ * This function sets up the login for a single form.
+ *
+ * The username field is defined as the field which immediately precedes
+ * the password field. We have to do this in two steps because we need
+ * to make sure that the event we emit from the change has the `isTrusted`
+ * field set to `true`. Otherwise, some websites will ignore the input and
+ * the form submission.
+ */
+async function single_page_login(login_info, context, commands, prefix = "") {
+ // Get the first input field in the form that is not hidden and add the
+ // username. Assumes that email/username is always the first input field.
+ await commands.addText.bySelector(
+ login_info.username,
+ `${prefix}input:not([type=hidden]):not([type=password])`
+ );
+
+ // Get the password field and ensure it's not hidden.
+ await commands.addText.bySelector(
+ login_info.password,
+ `${prefix}input[type=password]:not([type=hidden])`
+ );
+
+ return undefined;
+}
+
+/**
+ * See single_page_login.
+ */
+async function single_form_login(login_info, context, commands) {
+ return single_page_login(login_info, context, commands, "form ");
+}
+
+/**
+ * Login to a website that uses multiple pages for the login.
+ *
+ * WARNING: Assumes that the first page is for the username.
+ */
+async function multi_page_login(login_info, context, commands) {
+ const driver = context.selenium.driver;
+ const webdriver = context.selenium.webdriver;
+
+ const username_field = await driver.findElement(
+ webdriver.By.css(`input:not([type=hidden]):not([type=password])`)
+ );
+ await username_field.sendKeys(login_info.username);
+ await username_field.sendKeys(webdriver.Key.ENTER);
+ await commands.wait.byTime(5000);
+
+ let password_field;
+ try {
+ password_field = await driver.findElement(
+ webdriver.By.css(`input[type=password]:not([type=hidden])`)
+ );
+ } catch (err) {
+ if (err.toString().includes("NoSuchElementError")) {
+ // Sometimes we're suspicious (i.e. they think we're a bot/bad-actor)
+ let name_field = await driver.findElement(
+ webdriver.By.css(`input:not([type=hidden]):not([type=password])`)
+ );
+ await name_field.sendKeys(login_info.suspicious_answer);
+ await name_field.sendKeys(webdriver.Key.ENTER);
+ await commands.wait.byTime(5000);
+
+ // Try getting the password field again
+ password_field = await driver.findElement(
+ webdriver.By.css(`input[type=password]:not([type=hidden])`)
+ );
+ } else {
+ throw err;
+ }
+ }
+
+ await password_field.sendKeys(login_info.password);
+
+ return async function () {
+ password_field.sendKeys(webdriver.Key.ENTER);
+ await commands.wait.byTime(5000);
+ };
+}
+
+/**
+ * This function sets up the login.
+ *
+ * This is done by first the login type, and then performing the
+ * actual login setup. The return is a possible button to click
+ * to perform the login.
+ */
+async function setup_login(login_info, context, commands) {
+ let login_func = await get_login_type(context, commands);
+ if (!login_func) {
+ throw Error("Could not determine the type of login page.");
+ }
+
+ try {
+ return await login_func(login_info, context, commands);
+ } catch (err) {
+ throw Error(`Could not setup login information: ${err}`);
+ }
+}
+
+/**
+ * This function performs the login.
+ *
+ * It does this by either clicking on a button with a type
+ * of "sumbit", or running a final_button function that was
+ * obtained from the setup_login function. Some pages also ask
+ * questions about setting up 2FA or other information. Generally,
+ * these contain the "skip" text.
+ */
+async function login(context, commands, final_button) {
+ try {
+ if (!final_button) {
+ // The mouse double click emits an event with `evt.isTrusted=true`
+ await commands.mouse.doubleClick.bySelector("button[type=submit]");
+ await commands.wait.byTime(10000);
+ } else {
+ // In some cases, it's preferable to be given a function for the final button
+ await final_button();
+ }
+
+ // Some pages ask to setup 2FA, skip this based on the text
+ const XPATHS = [
+ "//a[contains(text(), 'skip')]",
+ "//button[contains(text(), 'skip')]",
+ "//input[contains(text(), 'skip')]",
+ "//div[contains(text(), 'skip')]",
+ ];
+
+ for (let xpath of XPATHS) {
+ try {
+ await commands.mouse.doubleClick.byXpath(xpath);
+ } catch (err) {
+ if (err.toString().includes("not double click")) {
+ context.log.info(`Can't find a button with the text: ${xpath}`);
+ } else {
+ throw err;
+ }
+ }
+ }
+ } catch (err) {
+ throw Error(
+ `Could not login to website as we could not find the submit button/input: ${err}`
+ );
+ }
+}
+
+/**
+ * Grab the base URL from the browsertime url.
+ *
+ * This is a necessary step for getting the login values from the Taskcluster
+ * secrets, which are hashed by the base URL.
+ *
+ * The first entry is the protocal, third is the top-level domain (or host)
+ */
+function get_base_URL(fullUrl) {
+ let pathAsArray = fullUrl.split("/");
+ return pathAsArray[0] + "//" + pathAsArray[2];
+}
+
+/**
+ * This function attempts the login-login sequence for a live pageload recording
+ */
+async function perform_live_login(context, commands) {
+ let testUrl = context.options.browsertime.url;
+
+ let logins = await get_logins(context);
+ const baseUrl = get_base_URL(testUrl);
+
+ await commands.navigate("about:blank");
+
+ let login_info = logins.secret[baseUrl];
+ try {
+ await commands.navigate(login_info.login_url);
+ } catch (err) {
+ context.log.info("Unable to acquire login information");
+ throw err;
+ }
+ await commands.wait.byTime(5000);
+
+ let final_button = await setup_login(login_info, context, commands);
+ await login(context, commands, final_button);
+}
+
+async function dismissCookiePrompt(input_cmds, context, commands) {
+ context.log.info("Searching for cookie prompt elements...");
+ let cmds = input_cmds.split(";;;");
+ for (let cmdstr of cmds) {
+ let [cmd, ...args] = cmdstr.split(":::");
+ context.log.info(cmd, args);
+ let result = await commands.js.run(
+ `return document.evaluate("` +
+ args +
+ `", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;`
+ );
+ if (result) {
+ context.log.info("Element found, clicking on it.");
+ await run_command(cmdstr, context, commands);
+ } else {
+ context.log.info(
+ "Element not found! The cookie prompt may have not appeared, please check the screenshots."
+ );
+ }
+ }
+}
+
+async function pageload_test(context, commands) {
+ let testUrl = context.options.browsertime.url;
+ let secondaryUrl = context.options.browsertime.secondary_url;
+ let testName = context.options.browsertime.testName;
+ let dismissPrompt = context.options.browsertime.dismiss_cookie_prompt || "";
+ context.log.info(context.options.browsertime);
+
+ // Wait for browser to settle
+ await commands.wait.byTime(1000);
+
+ // If the user has RAPTOR_LOGINS configured correctly, a local login pageload
+ // test can be attempted. Otherwise if attempting it in CI, only sites with the
+ // associated MOZ_SCM_LEVEL will be attempted (e.g. Try = 1, autoland = 3)
+ if (context.options.browsertime.login) {
+ if (context.options.browsertime.manual_login) {
+ // Perform a manual login using the value given in manual_login
+ // as the amount of time to wait
+ await commands.navigate(testUrl);
+ context.log.info(
+ `Waiting ${context.options.browsertime.manual_login}ms for login...`
+ );
+ await commands.wait.byTime(context.options.browsertime.manual_login);
+ } else if (
+ process.env.RAPTOR_LOGINS ||
+ process.env.MOZ_SCM_LEVEL == 3 ||
+ SCM_1_LOGIN_SITES.includes(testName)
+ ) {
+ try {
+ await perform_live_login(context, commands);
+ } catch (err) {
+ context.log.info(
+ "Unable to login. Acquiring a recording without logging in"
+ );
+ context.log.info("Error:" + err);
+ }
+ } else {
+ context.log.info(`
+ NOTE: This is a login test but a manual login was not requested, and
+ we cannot find any logins defined in RAPTOR_LOGINS.
+ `);
+ }
+ }
+
+ await commands.measure.start(testUrl);
+ await commands.wait.byTime(40000);
+ if (dismissPrompt) {
+ await dismissCookiePrompt(dismissPrompt, context, commands);
+ }
+ commands.screenshot.take("test_url_" + testName);
+
+ if (secondaryUrl !== null) {
+ // Wait for browser to settle
+ await commands.wait.byTime(1000);
+
+ await commands.measure.start(secondaryUrl);
+ commands.screenshot.take("secondary_url_" + testName);
+ }
+
+ // Wait for browser to settle
+ await commands.wait.byTime(1000);
+}
+
+/**
+ * Converts a string such as `measure.start` into the
+ * actual function that is found in the `commands` module.
+ *
+ * XX: Find a way to share this function between
+ * perftest_record.js and browsertime_interactive.js
+ */
+async function get_command_function(cmd, commands) {
+ if (cmd == "") {
+ throw new Error("A blank command was given.");
+ } else if (cmd.endsWith(".")) {
+ throw new Error(
+ "An extra `.` was found at the end of this command: " + cmd
+ );
+ }
+
+ // `func` will hold the actual method that needs to be called,
+ // and the `parent_mod` is the context required to run the `func`
+ // method. Without that context, `this` becomes undefined in the browsertime
+ // classes.
+ let func = null;
+ let parent_mod = null;
+ for (let func_part of cmd.split(".")) {
+ if (func_part == "") {
+ throw new Error(
+ "An empty function part was found in the command: " + cmd
+ );
+ }
+
+ if (func === null) {
+ parent_mod = commands;
+ func = commands[func_part];
+ } else if (func !== undefined) {
+ parent_mod = func;
+ func = func[func_part];
+ } else {
+ break;
+ }
+ }
+
+ if (func == undefined) {
+ throw new Error(
+ "The given command could not be found as a function: " + cmd
+ );
+ }
+
+ return [func, parent_mod];
+}
+
+/**
+ * Performs an interactive test.
+ *
+ * These tests are interactive as the entire test is defined
+ * through a set of browsertime commands. This allows users
+ * to build arbitrary tests. Furthermore, interactive tests
+ * provide the ability to login to websites.
+ */
+async function interactive_test(input_cmds, context, commands) {
+ let cmds = input_cmds.split(";;;");
+
+ let logins;
+ if (context.options.browsertime.login) {
+ logins = await get_logins(context);
+ }
+
+ await commands.navigate("about:blank");
+
+ let user_setup = false;
+ let final_button = null;
+ for (let cmdstr of cmds) {
+ let [cmd, ...args] = cmdstr.split(":::");
+
+ if (cmd == "setup_login") {
+ if (!logins) {
+ throw Error(
+ "This test is not specified as a `login` test so no login information is available."
+ );
+ }
+ if (args.length < 1 || args[0] == "") {
+ throw Error(
+ `No URL given, can't tell where to setup the login. We only accept: ${logins.keys()}`
+ );
+ }
+ /* Structure for logins is:
+ {
+ "username": ...,
+ "password": ...,
+ "suspicious_answer": ...,
+ "login_url": ...,
+ }
+ */
+ let login_info = logins.secret[args[0]];
+
+ await commands.navigate(login_info.login_url);
+ await commands.wait.byTime(5000);
+
+ final_button = await setup_login(login_info, context, commands);
+ user_setup = true;
+ } else if (cmd == "login") {
+ if (!user_setup) {
+ throw Error("setup_login needs to be called before the login command");
+ }
+ await login(context, commands, final_button);
+ } else {
+ await run_command(cmdstr, context, commands);
+ }
+ }
+}
+
+async function run_command(cmdstr, context, commands) {
+ let [cmd, ...args] = cmdstr.split(":::");
+ let [func, parent_mod] = await get_command_function(cmd, commands);
+
+ try {
+ await func.call(parent_mod, ...args);
+ } catch (e) {
+ context.log.info(
+ `Exception found while running \`commands.${cmd}(${args})\`: ` + e
+ );
+ }
+}
+
+async function test(context, commands) {
+ let input_cmds = context.options.browsertime.commands;
+ let test_type = context.options.browsertime.testType;
+ if (test_type == "interactive") {
+ await interactive_test(input_cmds, context, commands);
+ } else {
+ await pageload_test(context, commands);
+ }
+ return true;
+}
+
+module.exports = {
+ test,
+ owner: "Bebe fstrugariu@mozilla.com",
+ name: "Mozproxy recording generator",
+ component: "raptor",
+ description: ` This test generates fresh MozProxy recordings. It iterates through a list of
+ websites provided in *_sites.json and for each one opens a browser and
+ records all the associated HTTP traffic`,
+ usage:
+ "mach perftest --proxy --hooks testing/raptor/recorder/hooks.py testing/raptor/recorder/perftest_record.js",
+};
diff --git a/testing/performance/perftest_youtube_link.js b/testing/performance/perftest_youtube_link.js
new file mode 100644
index 0000000000..be34841741
--- /dev/null
+++ b/testing/performance/perftest_youtube_link.js
@@ -0,0 +1,28 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+async function test(context, commands) {
+ let rootUrl = "https://www.politico.com/";
+
+ await commands.navigate(rootUrl);
+
+ // Wait for browser to settle
+ await commands.wait.byTime(10000);
+
+ // Start the measurement
+ await commands.measure.start("pageload");
+
+ // Click on the link and wait for page complete check to finish.
+ await commands.click.byClassNameAndWait("js-tealium-tracking");
+
+ // Stop and collect the measurement
+ await commands.measure.stop();
+}
+
+module.exports = {
+ test,
+ owner: "Performance Team",
+ name: "YouTube Link",
+ description: "Measures time to load YouTube video",
+};
diff --git a/testing/performance/sites.txt b/testing/performance/sites.txt
new file mode 100644
index 0000000000..2f6afdd686
--- /dev/null
+++ b/testing/performance/sites.txt
@@ -0,0 +1,21 @@
+https://accounts.google.com
+https://cnn.com/ampstories/us/why-hurricane-michael-is-a-monster-unlike-any-other
+https://discordapp.com/
+https://expedia.com/Hotel-Search?destination=New+York%2C+New+York&latLong=40.756680%2C-73.986470&regionId=178293&startDate=&endDate=&rooms=1&_xpid=11905%7C1&adults=2
+https://fashionbeans.com/article/coolest-menswear-stores-in-the-world
+https://m.360.cn
+https://m.facebook.com/Cristiano
+https://m.imdb.com/title/tt0083943/
+https://m.ranker.com/list/hunger-games-book-vs-movie-comparisons/lisa-waugh?ref=browse_list_5&l=2&pos=1
+https://marvel.wikia.com/wiki/Black_Panther
+https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-commits-in-git
+https://support.microsoft.com/en-us
+https://www.amazon.com/s/ref=nb_sb_noss_2/139-6317191-5622045?url=search-alias%3Daps&field-keywords=mobile+phone
+https://www.bbc.com/news/business-47245877
+https://www.booking.com/hotel/us/edwardian-san-francisco.html
+https://www.google.com
+https://www.espn.com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words
+https://www.jianshu.com/
+https://www.nytimes.com/2020/02/19/opinion/surprise-medical-bill.html
+https://www.reddit.com/r/firefox/comments/7dkq03/its_been_a_while/
+https://www.youtube.com/watch?v=COU5T-Wafa4