You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(project): improve integration test docs and add convenience target (#14796)
Because
* The integration test section of the README was missing key details
that
developers need when running tests locally, including the
`.env.integration-tests` file, test markers, troubleshooting tips, and
key file locations
* Running integration tests locally required 5 manual steps that could
be automated into a single make command
* Yashika's internal integration test setup guide had useful steps that
were not reflected in the README
This commit
* Rewrites the integration test section with a clear step-by-step guide
for running tests locally via VNC
* Adds a `make integration_test_vnc TEST="..."` convenience target that
handles `.env` copy, `SKIP_DUMMY=1`, `PYTEST_ARGS` configuration, and
stack setup in a single command
* Adds `PYTEST_BASE_URL` default (`https://nginx/nimbus/`) so it no
longer needs to be exported manually
* Documents test markers, environment variables, key files, and
troubleshooting tips
* Preserves the native Firefox (non-Docker) workflow as an alternative
Fixes#14795
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
For a full reference of all the common commands that can be run inside the container, refer to [this section of the Makefile](https://github.com/mozilla/experimenter/blob/main/Makefile#L16-L38)
432
432
433
-
#### make integration_test_legacy
433
+
###Integration Tests
434
434
435
-
Run the integration test suite for experimenter inside a containerized instance of Firefox. You must also be already running a `make up` dev instance in another shell to run the integration tests.
435
+
The integration tests run Selenium against a full Experimenter stack (app server, nginx, kinto, Firefox) inside Docker containers. They are defined in `experimenter/tests/integration/nimbus/` and configured in `.circleci/config.yml`.
436
436
437
-
#### make FIREFOX_CHANNEL integration_test_nimbus_desktop
437
+
#### Running a specific test locally (recommended)
438
438
439
-
Run the integration test suite for nimbus inside a containerized instance of Firefox. You must also be already running a `make up` dev instance in another shell to run the integration tests.
439
+
The easiest way to run and debug integration tests is via VNC, which lets you watch Firefox execute the test in real time.
440
440
441
-
FIREFOX_CHANNEL should either be `release`, `nightly` or `beta`, and include it in the make command.
442
-
443
-
#### make integration_test_nimbus_sdk
444
-
445
-
Run the Nimbus SDK integration tests, which tests the advanced targeting configurations against the Nimbus SDK.
446
-
447
-
#### make integration_vnc_shell
448
-
449
-
First start a prod instance of Experimenter with:
441
+
1. Run a single make command with the test you want to run:
450
442
451
443
```bash
452
-
make refresh&&make up_prod_detached
444
+
make integration_test_vnc TEST="test_archive_experiment[FIREFOX_DESKTOP]"
453
445
```
454
446
455
-
Then start the VNC service:
447
+
This automatically handles environment setup (copies `.env.integration-tests`, sets `SKIP_DUMMY=1`, configures `PYTEST_ARGS` with `--reruns 0` and `--base-url`), rebuilds containers, and drops you into a shell inside the Firefox/Selenium container.
3. From the shell inside the container, run the test script:
456
454
457
455
```bash
458
-
make integration_vnc_shell
456
+
./experimenter/tests/nimbus_integration_tests.sh
459
457
```
460
458
461
-
Then open your VNC client (Safari does this on OSX or just use [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/)) and open `vnc://localhost:5900` with password `secret`.
459
+
This installs Firefox, Poetry dependencies, and runs pytest with your `PYTEST_ARGS`. You can watch the test execute in the VNC window.
462
460
463
-
To use NoVNC, navgate to this url `http://localhost:7902` with the password `secret`. Then you can follow the same steps as above.
461
+
#### Make targets
464
462
465
-
When the command executes successfully, you will have terminal access to the running Firefox container. After you follow the above steps to connect via VNC, run `firefox` and confirm that a Firefox browser loads.
463
+
| Target | Description |
464
+
|--------|-------------|
465
+
|`make integration_test_vnc TEST="..."`| One-command setup: copies `.env`, rebuilds, starts stack, drops into VNC shell with `PYTEST_ARGS` pre-configured |
466
+
|`make integration_vnc_shell`| Opens a bash shell in the Firefox/Selenium container with VNC enabled (manual env setup required) |
467
+
|`make FIREFOX_CHANNEL=release integration_test_nimbus_desktop`| Runs the full desktop test suite (`release`, `beta`, or `nightly`) |
|`make integration_sdk_shell`| Opens a shell with the mobile SDK set up for testing |
466
471
467
-
To then run the tests, set `PYTEST_ARGS` with the tests you want to run, i.e.: `export PYTEST_ARGS=-k test_archive[FIREFOX_DESKTOP]`. You will need to include the nimbus client you want to test against as well. You can also set the Firefox Channel you want to run against via the `FIREFOX_CHANNEL` environment variable. Then execute the test script. The following is an example using the above environment variables:
|`PYTEST_ARGS`|[Pytest CLI options](https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags). Use `-k` to select tests, `-m` to select markers, `--reruns 0` to disable retries when debugging. |`-k test_archive_experiment[FIREFOX_DESKTOP] --reruns 0 --base-url https://nginx/nimbus/`|
477
+
|`PYTEST_BASE_URL`| Base URL for the Experimenter instance under test. |`https://nginx/nimbus/`|
478
+
|`FIREFOX_CHANNEL`| Firefox channel to test against. Defaults to `release`. |`release`, `beta`, `nightly`|
473
479
474
-
1. Install [geckodriver](https://github.com/mozilla/geckodriver/releases) and have it available in your path. You should be able to run `geckodriver --version` from your command line. On MacOS you can do `brew install geckodriver` if you have homebrew installed.
475
-
2. Add your Firefox install to your path. You should be able to run `firefox --version` from your command line.
476
-
```sh
477
-
alias firefox="path-to/firefox"
478
-
```
479
-
Example for macos add this to your `~/.zshrc` file:
480
-
```sh
481
-
alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox"
482
-
```
483
-
3. Setup experimenter:
484
-
```sh
485
-
make refresh build_integration_test SKIP_DUMMY=1 up_prod_detached
486
-
```
487
-
Navigate with your browser to `https://localhost/nimbus` to confirm everything is working.
488
-
4. To then run the tests, set `PYTEST_ARGS` with the tests you want to run, i.e.: `PYTEST_ARGS=-k test_archive_experiment[FIREFOX_DESKTOP]`. You will need to include the nimbus client you want to test against as well. You can also set the Firefox Channel you want to run against via the `FIREFOX_CHANNEL` environment variable. Then execute the test script. The following is an example using the above environment variables:
Firefox should pop up and start running through your test! You can change the firefox version the tests run on by copying the path of the `firefox-bin` and adding it to the `firefox_options` fixture in the `tests/integration/nimbus/conftest.py` file:
482
+
Tests are organized with pytest markers. Use `-m <marker>` in `PYTEST_ARGS` to run a specific group:
494
483
495
-
```sh
496
-
firefox_options.binary = "path/to/firefox-bin"
497
-
```
484
+
| Marker | Description |
485
+
|--------|-------------|
486
+
|`nimbus_ui`| UI-only tests (no external service integration) |
487
+
|`desktop_enrollment`| Tests that integrate with Nimbus and external services |
488
+
|`cirrus_enrollment`| Tests that integrate with the demo app and Cirrus |
489
+
|`remote_settings_launch`| A single test for launching to Remote Settings |
490
+
|`remote_settings_experiments`| Remote Settings tests for experiments |
491
+
|`remote_settings_rollouts`| Remote Settings tests for rollouts (basic flows) |
492
+
|`remote_settings_live_updates`| Remote Settings tests for rollout live updates |
493
+
|`run_targeting`| JEXL targeting tests in Firefox |
Firefox will launch and run the test. To use a different Firefox binary, set it in the `firefox_options` fixture in `experimenter/tests/integration/nimbus/conftest.py`:
516
522
517
-
```sh
518
-
make FIREFOX_CHANNEL=release integration_test_nimbus_desktop PYTEST_ARGS=ktest_rollout_create_and_update
523
+
```python
524
+
firefox_options.binary ="/path/to/firefox-bin"
519
525
```
520
526
521
-
#### make integration_sdk_shell
522
-
523
-
This builds and sets up the mobile sdk for use in testing.
527
+
#### Key files
528
+
529
+
| Path | Description |
530
+
|------|-------------|
531
+
|`experimenter/tests/integration/nimbus/conftest.py`| Pytest fixtures including `create_experiment` and Selenium setup |
|`.env.integration-tests`| Env file with short Kinto polling intervals for tests |
538
+
|`.circleci/config.yml`| CI job definitions and `PYTEST_ARGS` used in CI |
539
+
540
+
#### Troubleshooting
541
+
542
+
-**502 from nginx**: The experimenter container IP may have changed after a restart. Run `docker restart <nginx-container>` to re-resolve it.
543
+
-**Port conflicts**: Only run one Experimenter stack at a time — they share host ports (3001, 5432, 7001, 8000, 8888). Kill existing containers first with `docker compose kill` in the other directory.
544
+
-**Feature dropdown selects wrong feature**: The feature search is substring-based and selects the first alphabetical match. Use a feature name that won't substring-match other features.
545
+
-**Flaky button clicks**: Some tests may intermittently fail due to Selenium timing. Use `--reruns 1` in CI or re-run locally. When debugging, use `--reruns 0` to see the actual failure.
0 commit comments