Skip to content

Commit d45c44a

Browse files
authored
Merge pull request #6160 from mozilla/refactor-e2e-relay-only-MPP-4466
fix #MPP-4466 - refactor(e2e): replace health check tags with relay-only test suite
2 parents 7691602 + f1364d2 commit d45c44a

12 files changed

+110
-54
lines changed

.github/workflows/playwright.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ on:
88
required: true
99
default: stage
1010
type: string
11-
health_check:
11+
suite:
12+
description: Test suite to run
1213
required: false
13-
default: false
14-
type: boolean
14+
default: relay-only
15+
type: string
1516
secrets:
1617
E2E_TEST_ACCOUNT_FREE:
1718
required: true
@@ -32,14 +33,17 @@ on:
3233
- stage
3334
- prod
3435
- dev
35-
health_check:
36-
description: Enable health check
36+
suite:
37+
description: Test suite to run
3738
required: false
38-
default: false
39-
type: boolean
39+
default: full
40+
type: choice
41+
options:
42+
- relay-only
43+
- full
4044
jobs:
4145
relaye2e:
42-
name: ${{ inputs.health_check && 'Relay e2e health check' || 'Relay e2e all tests' }}
46+
name: ${{ inputs.suite == 'relay-only' && 'Relay e2e relay-only suite' || 'Relay e2e full suite' }}
4347
timeout-minutes: 60
4448
runs-on: ubuntu-latest
4549
steps:
@@ -55,15 +59,9 @@ jobs:
5559
npm install -D @playwright/test --with-deps
5660
npx playwright install
5761
- name: Run Playwright tests
58-
run: >
59-
if $HEALTH_CHECK; then
60-
E2E_TEST_ENV=$E2E_TEST_ENV npx playwright test --grep "@health_check"
61-
else
62-
npm run test:$E2E_TEST_ENV
63-
fi
62+
run: |
63+
npm run test:${{ inputs.suite }}:${{ inputs.environment }}
6464
env:
65-
HEALTH_CHECK: ${{ contains(inputs.health_check, 'true') }}
66-
E2E_TEST_ENV: ${{ inputs.environment != null && inputs.environment || 'stage' }}
6765
E2E_TEST_ACCOUNT_FREE: ${{ secrets.E2E_TEST_ACCOUNT_FREE }}
6866
E2E_TEST_ACCOUNT_PASSWORD: ${{ secrets.E2E_TEST_ACCOUNT_PASSWORD }}
6967
E2E_TEST_ACCOUNT_PREMIUM: ${{ secrets.E2E_TEST_ACCOUNT_PREMIUM }}
@@ -101,4 +99,3 @@ jobs:
10199
text: "*Ref:*\n ${{ github.ref }}"
102100
- type: mrkdwn
103101
text: "*Triggered by:*\n ${{ github.triggering_actor }}"
104-

.github/workflows/relay_e2e_health.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/base-load-engineer-playbook.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ another more appropriate party.
6464
2. SRE processes ticket to release the tag to production
6565
3. Update [Github Release][github-releases] to current release
6666
4. Monitor [Sentry Releases][sentry-releases] for new production issues
67-
5. [Run e2e tests][run-e2e-tests] against the prod environment via GitHub Actions.
67+
5. [Run the relay-only e2e test suite][run-e2e-tests] against the prod environment via GitHub Actions.
6868
6. (On your 3rd Tuesday) Hand-off base load duties to next engineer in rotation
6969

7070
## Wednesdays
7171

7272
1. Daily routine
73-
2. Before releasing to Stage, [run e2e tests][run-e2e-tests] against the dev environment via GitHub Actions.
74-
- Ensure that the e2e tests are passing.
73+
2. Before releasing to Stage, [run the relay-only e2e test suite][run-e2e-tests] against the dev environment via GitHub Actions.
74+
- Ensure that the relay-only e2e tests are passing.
7575
- If e2e Playwright tests are flaky--fails to pass for reasons outside of legitimate Relay bug--consider making the tests more reliable by using the [locators][playwright-locators], [auto-retrying assertions][playwright-auto-retrying-assertions], or [fixtures][playwright-fixtures]. For more suggestions on making Playwright tests more reliable or efficient, see [documentation on FxA test improvements][fxa-test-improvements].
7676
3. [Release to stage][Release-to-stage] (tag, Github release notes)
7777
- Ping all the engineers who have changes in the release to:

docs/dependency-updates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ Check out the update branch and run:
7777
```
7878
npm install
7979
npx playwright install
80-
npx playwright test
80+
npm run test:relay-only:stage
8181
```
8282

8383
This will confirm that `dotenv` picked up the settings from `.env`, and that
84-
the new playwright runs against stage.
84+
the new playwright runs the relay-only test suite against stage.
8585

8686
Once the PR is merged, you can wait for the daily test run, or manually run the
8787
test by going to the [Relay e2e Tests][] GitHub Action page, select "Run

docs/release_process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ On Tuesday, after the Release Readiness review with QA:
185185
- Spot-check the site for basic functionality
186186
- Check [sentry prod project](https://mozilla.sentry.io/releases/?environment=prod) for a spike in any new issues
187187
- Check [grafana dashboard](https://yardstick.mozilla.org/) for any unexpected spike in ops
188-
- (optional) [Run end-to-end tests](https://github.com/mozilla/fx-private-relay/actions/workflows/playwright.yml) on prod
188+
- (optional) [Run the relay-only e2e test suite](https://github.com/mozilla/fx-private-relay/actions/workflows/playwright.yml) on prod
189189
4. Update the GitHub release:
190190
- Update the summary:
191191

e2e-tests/README.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Relay e2e Test Suite
1+
# Relay e2e Test Suites
22

33
---
44

@@ -53,13 +53,37 @@ The premium account needs to have a chosen subdomain for the premium tests to pa
5353

5454
### 6. Run Tests
5555

56+
#### Running the full suite
57+
58+
```
59+
npm run test:e2e # Runs on stage (default)
60+
npm run test:full:stage # Explicit full suite on stage
61+
npm run test:full:prod # Full suite on production
62+
```
63+
64+
By default, `npm run test:e2e` will run all tests on https://relay.allizom.org/.
65+
66+
#### Running the relay-only suite
67+
68+
The relay-only suite excludes tests that depend on Mozilla Monitor, SubPlat payment flows, or third-party sites like developmentthatpays.com.
69+
5670
```
57-
npm run test:e2e
71+
npm run test:relay-only # Runs on stage (default)
72+
npm run test:relay-only:stage # Relay-only on stage
73+
npm run test:relay-only:prod # Relay-only on production
5874
```
5975

60-
By default, `npm run test:e2e` will run the tests on https://relay.allizom.org/.
76+
**Test suites:**
6177

62-
You can also run tests locally, on our dev server (https://relay-dev.allizom.org/), and in production (https://relay.firefox.com/). You can find the commands [here](https://github.com/mozilla/fx-private-relay/blob/main/package.json#L26-L31), or you can run `E2E_TEST_ENV=<env (prod, dev, stage)> npx playwright test`.
78+
- **Relay-only**: Landing page, free user functionality, premium functionality, upgrade flow
79+
- **Full**: All relay-only tests plus Monitor integration, subscription flows, tracker tests
80+
81+
**External dependencies:**
82+
83+
- Relay-only requires: Relay deployment, FXA, Restmail.net
84+
- Full suite additionally requires: Mozilla Monitor, SubPlat, developmentthatpays.com
85+
86+
You can also run tests locally or on our dev server. See all commands [here](https://github.com/mozilla/fx-private-relay/blob/main/package.json), or use `E2E_TEST_ENV=<env (prod, dev, stage, local)> npx playwright test`.
6387

6488
To view the tests live in the browser, you can add `--headed` to the end of the command:
6589

@@ -87,13 +111,22 @@ Error: A snapshot doesn't exist at example.spec.ts-snapshots/example-test-1-chro
87111

88112
This is because playwright needs to create an image initially. On the following runs, it will compare that a screenshot of the respective element matches the one added initially. Do not push your local images into the repo, the only ones that are needed for CI end in `linux`.
89113

90-
### 8. Health check
114+
### 8. Relay-Only Suite
91115

92-
Our ![health check](https://github.com/mozilla/fx-private-relay/actions/workflows/relay_e2e_health.yml) runs a subset of the entire e2e test suite everyday. This subset of tests focuses on critical tests for free and premium users for the overall health of the relay application. To add a test into the healthcheck CI, add `@health_check` into the title of your test or test group. See the following as an example,
116+
The [Relay e2e tests workflow](https://github.com/mozilla/fx-private-relay/actions/workflows/playwright.yml) runs the relay-only test suite daily at 8 AM UTC. This suite focuses on core Relay functionality without dependencies on external services like Monitor or payment processors.
93117

94-
`test.describe("Subscription flows @health_check", ...)`
118+
The relay-only suite runs automatically on a schedule, but you can also trigger it manually:
95119

96-
To run the health check manually, go to ![Relay e2e tests](https://github.com/mozilla/fx-private-relay/actions/workflows/playwright.yml), click run workflow, and check off "enable health check" before clicking "run workflow".
120+
1. Go to [Relay e2e tests](https://github.com/mozilla/fx-private-relay/actions/workflows/playwright.yml)
121+
2. Click "Run workflow"
122+
3. Select "relay-only" from the suite dropdown
123+
4. Click "Run workflow"
124+
125+
To run the relay-only suite locally:
126+
127+
```bash
128+
npm run test:relay-only:stage
129+
```
97130

98131
### 9. Diagnosing Test Failures
99132

e2e-tests/specs/relay-e2e.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test, { expect } from "../fixtures/basePages";
22
import { checkAuthState } from "../e2eTestUtils/helpers";
33

44
test.describe.configure({ mode: "parallel" });
5-
test.describe("FxA auth, random mask generation, and email forwarding @health_check", () => {
5+
test.describe("FxA auth, random mask generation, and email forwarding", () => {
66
test.skip(
77
process.env.E2E_TEST_ENV === "prod",
88
"This test only works on stage/dev environments because you cannot use masks to sign up for monitor, see 'Email forwarding and trackers removal' for a similar test",
@@ -67,7 +67,7 @@ test.skip("Email forwarding and trackers removal", () => {
6767
});
6868
});
6969

70-
test.describe("Subscription flows with PlanGrid @health_check", () => {
70+
test.describe("Subscription flows with PlanGrid", () => {
7171
/**
7272
* Verifies that all plans correctly redirect to their corresponding subscriptions page.
7373
*/

e2e-tests/specs/relay-general-functionality.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test.describe("Free - General Functionalities, Desktop", () => {
1111
await dashboardPage.maybeDeleteMasks();
1212
});
1313

14-
test("Check the free user can only create 5 masks, C1553067 @health_check", async ({
14+
test("Check the free user can only create 5 masks, C1553067", async ({
1515
dashboardPage,
1616
page,
1717
}) => {
@@ -84,7 +84,7 @@ test.describe("Free - General Functionalities, Desktop - Visual Regression", ()
8484
);
8585
});
8686

87-
test("Check that the user can delete an mask, and is prompted to confirm before they delete, C1553071 @health_check", async ({
87+
test("Check that the user can delete an mask, and is prompted to confirm before they delete, C1553071", async ({
8888
dashboardPage,
8989
page,
9090
}) => {

e2e-tests/specs/relay-home-page.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test, { expect } from "../fixtures/basePages";
22
import { defaultScreenshotOpts } from "../e2eTestUtils/helpers";
33

4-
test.describe("Firefox Relay - Landing Page - Visual Regression @health_check", () => {
4+
test.describe("Firefox Relay - Landing Page - Visual Regression", () => {
55
test.skip(
66
({ browserName }) => browserName !== "firefox",
77
"firefox only image comparisons!",
@@ -28,7 +28,7 @@ test.describe("Firefox Relay - Landing Page - Visual Regression @health_check",
2828
});
2929
});
3030

31-
test.describe("Check header buttons and their redirects, C1812638 @health_check", () => {
31+
test.describe("Check header buttons and their redirects, C1812638", () => {
3232
test.beforeEach(async ({ landingPage }) => {
3333
await landingPage.open();
3434
});

e2e-tests/specs/relay-premium-functionality.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test.describe("Premium - General Functionalities, Desktop", () => {
99
await dashboardPage.maybeDeleteMasks(true, parseInt(totalMasks as string));
1010
});
1111

12-
test("Verify that a premium user can make more than 5 masks @health_check", async ({
12+
test("Verify that a premium user can make more than 5 masks", async ({
1313
dashboardPage,
1414
}) => {
1515
expect(await dashboardPage.emailMasksUsedAmount.textContent()).toBe("0");
@@ -41,7 +41,7 @@ test.describe("Premium - General Functionalities, Desktop", () => {
4141
);
4242
});
4343

44-
test("Verify that a premium user can generate a custom mask @health_check", async ({
44+
test("Verify that a premium user can generate a custom mask", async ({
4545
dashboardPage,
4646
}) => {
4747
// When there are zero masks, a random mask must be generated first

0 commit comments

Comments
 (0)