testing/tps/README
author Drew Willcoxon <adw@mozilla.com>
Mon, 20 Mar 2023 04:03:10 +0000
changeset 657175 e86d4f075920e260a620e5e80b072d41de1ab9dc
parent 610284 fcef8271055ba1c2d722fb3777de0858a14029f9
permissions -rw-r--r--
Bug 1823080 - Fetch the weather suggestion on a slight delay after wake. r=daisuke This adds a delay after wake just like the delay after online notifications. It's conceivable that online notifications might happen soon after the wake notification. [Sync also does this](https://searchfox.org/mozilla-central/rev/ed93119be4818da1509bbcb7b28e245853eeedd5/services/sync/modules/policies.sys.mjs#528-534). I renamed `cameOnlineDelayMs` to `fetchDelayAfterComingOnlineMs`. It's longer but I think it's clearer. I don't think we need a separate delay ms for wake; we can just use the same one that we use for online. I also added a test for a wake notification followed by online notifications. Differential Revision: https://phabricator.services.mozilla.com/D172892

TPS is a test automation framework for Firefox Sync. See
https://developer.mozilla.org/en/TPS for documentation.

Installation
============

TPS requires several packages to operate properly. To install TPS and
required packages, use the INSTALL.sh script, provided:

  python3 create_venv.py /path/to/create/virtualenv

This script will create a virtalenv and install TPS into it.

You must then activate the virtualenv by executing:

-  (mac/linux): source /path/to/virtualenv/Scripts/activate
-  (win): /path/to/virtualenv/Scripts/activate.bat

TPS can then be run by executing:

  runtps --binary=/path/to/firefox

> Note: You can run the tps tests in headless mode by using `MOZ_HEADLESS=1`. This will make
> your computer somewhat useable while the tests are running.

When you are done with TPS, you can deactivate the virtualenv by executing
`deactivate`

Configuration
=============
To edit the TPS configuration, do not edit config/config.json.in in the tree.
Instead, edit config.json inside your virtualenv; it will be located at the
top level of where you specified the virtualenv be created - eg, for the
example above, it will be `/path/to/create/virtualenv/config.json`

Setting Up Test Accounts
========================

Firefox Accounts
----------------
To create a test account for using the Firefox Account authentication perform the
following steps:

> Note: Currently, the TPS tests rely on how restmail returns the verification code
> You should use restmail or something very similar.
> Gmail and other providers might give a `The request was blocked for security reasons`

1. Go to the URL: http://restmail.net/mail/%account_prefix%@restmail.net
  - Replace `%account_prefix%` with your own test name
2. Go to https://accounts.firefox.com/signup?service=sync&context=fx_desktop_v1
3. Sign in with the previous chosen email address and a password
4. Go back to the Restmail URL, reload the page
5. Search for the verification link and open that page

Now you will be able to use this account for TPS. Note that these
steps can be done in either a test profile or in a private browsing window - you
might want to avoid doing that in a "real" profile that's already connected to
Sync.