Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run full E2E test suite on PRs #4996

Merged
merged 21 commits into from
Sep 26, 2024
Merged

Run full E2E test suite on PRs #4996

merged 21 commits into from
Sep 26, 2024

Conversation

flozia
Copy link
Collaborator

@flozia flozia commented Aug 30, 2024

References:

Jira: MNTOR-3598

Description

This PR adds a GitHub workflow to run the full E2E test suite on PRs against the main branch. Ideally, we’ll mark this new workflow as optional for now so we can monitor and address its success rate before blocking PRs on it. Adding the ability to track metrics regarding the E2E test runs will be part of a follow-up effort.

The main changes for the E2E tests introduced by this PR are:

  • Adds workflow to run the ”full” E2E test suite on PRs in addition to the existing cronjob that runs against the stage environment.
  • Run E2E tests in parallel.
  • Clean up to make sure running E2E tests are passing in CI as well as locally with the same env variables set.

@flozia flozia self-assigned this Aug 30, 2024
@flozia flozia added the 🛑 Do Not Merge Do not merge this PR, even if approved. label Aug 30, 2024
Copy link

@flozia flozia force-pushed the e2e-convert-cron-to-pr branch 2 times, most recently from cf6f9b5 to 6a7fc3f Compare August 30, 2024 11:29
@flozia flozia force-pushed the e2e-convert-cron-to-pr branch 12 times, most recently from c096357 to 67367f7 Compare September 2, 2024 19:24
@flozia flozia force-pushed the e2e-convert-cron-to-pr branch 2 times, most recently from d4e90a3 to c2ee1db Compare September 3, 2024 16:29
@flozia flozia removed the 🛑 Do Not Merge Do not merge this PR, even if approved. label Sep 17, 2024
@flozia flozia changed the title WIP: Run full E2E test suite on PRs Run full E2E test suite on PRs Sep 17, 2024
@flozia flozia requested a review from rhelmer September 18, 2024 14:35
.github/workflows/e2e_pr_full.yml Show resolved Hide resolved
.github/workflows/e2e_pr_smoke.yml Show resolved Hide resolved
playwright.config.js Show resolved Hide resolved
playwright.config.js Show resolved Hide resolved
playwright.config.js Show resolved Hide resolved
.github/workflows/e2e_pr_full.yml Show resolved Hide resolved
@@ -1,4 +1,4 @@
name: Monitor e2e Smoke Tests
name: Monitor E2E Test Suite (smoke)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flozia are we comfortable deleting this yml as a part of this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mansaj I think the renaming should not cause any issues or what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming wouldn't cause issue, I'm more asking if we can delete the smoke PR workflow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mansaj Yes, we can delete the smoke test suite soon. I'd like to have keep it for now and leave it mandatory for merging PR’s. The full test suite will be not mandatory until we better learn about and fix some of the cery flaky tests.

playwright.config.js Show resolved Hide resolved
playwright.config.js Show resolved Hide resolved
src/e2e/specs/auth.spec.ts Outdated Show resolved Hide resolved
src/e2e/specs/purchase.spec.ts Show resolved Hide resolved
@mansaj
Copy link
Collaborator

mansaj commented Sep 18, 2024

LGTM overall!

@flozia flozia requested a review from mansaj September 18, 2024 19:43
Copy link
Collaborator

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some great improvements here Florian, nice job! Looking forward to seeing how they run on PRs in the coming weeks.

My main suggestions are around removing the need for manually setting so many env vars for the common case. In my ideal world, if you have a working local setup (i.e. the vars under ## Secrets in .env.local.example are set), running npm run e2e:full should be enough for a successful run, but I don't know if there's a reason that that's not feasible.

.github/workflows/e2e_pr_full.yml Show resolved Hide resolved
- name: Run Playwright tests
if: github.actor != 'dependabot[bot]'
run: npm run e2e -- --update-snapshots
timeout-minutes: 40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're running a lot faster than this now, right? If so, we might want to catch stalling tests (or execution speed regressions) earlier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s right. I halved the value 20 minutes for now. If we still see the tests performing consistently way below that, we can decrease to 10.


- name: Run Playwright tests
if: github.actor != 'dependabot[bot]'
run: npm run e2e -- --update-snapshots
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this make visual regression tests always succeed, and hence not catch any issues?

Suggested change
run: npm run e2e -- --update-snapshots
run: npm run e2e

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is right! This is the same configuration we are using from the cronjob running the full E2E test suite. Happy to update this later, but for now I’d like to focus on catching functional test failure.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, I created https://mozilla-hub.atlassian.net/browse/MNTOR-3655 to follow up.

timeout-minutes: 40
env:
E2E_TEST_ENV: local
E2E_TEST_BASE_URL: http://localhost:6060
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential for a small improvement: if this env var is unset, auto-detect it based on E2E_TEST_ENV?

Copy link
Collaborator Author

@flozia flozia Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we rely on all those env variables being set here. For easier debugging and for consistent behavior the env variables were taken over from the workflow that runs the daily cronjob on stage.

There is a task to audit and consolidate the workflow env variables as a next step.

ONEREP_API_KEY: ${{ secrets.ONEREP_API_KEY }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/blurts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be set either, right? Since it's already set in .env?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above: #4996 (comment).

Comment on lines +67 to +72
E2E_TEST_ACCOUNT_EMAIL: ${{ secrets.E2E_TEST_ACCOUNT_EMAIL }}
E2E_TEST_ACCOUNT_EMAIL_ZERO_BREACHES: ${{ secrets.E2E_TEST_ACCOUNT_EMAIL_ZERO_BREACHES }}
E2E_TEST_ACCOUNT_EMAIL_EXPOSURES_STARTED: ${{ secrets.E2E_TEST_ACCOUNT_EMAIL_EXPOSURES_STARTED }}
E2E_TEST_ACCOUNT_PASSWORD: ${{ secrets.E2E_TEST_ACCOUNT_PASSWORD }}
E2E_TEST_PAYPAL_LOGIN: ${{ secrets.E2E_TEST_PAYPAL_LOGIN }}
E2E_TEST_PAYPAL_PASSWORD: ${{ secrets.E2E_TEST_PAYPAL_PASSWORD }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just add these to .env? I don't think they're sensitive right - worst case, someone can abuse them to make our e2e tests fail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sensitive but I think we'd want to keep them private. Someone can reset the password for these emails and it'd be annoying for us.

.github/workflows/e2e_pr_smoke.yml Show resolved Hide resolved
src/e2e/pages/welcomeScanPage.ts Show resolved Hide resolved
src/e2e/specs/auth.spec.ts Outdated Show resolved Hide resolved
src/e2e/specs/dashboard.spec.ts Show resolved Hide resolved
@flozia flozia force-pushed the e2e-convert-cron-to-pr branch 5 times, most recently from 26854a3 to 52d8b8f Compare September 25, 2024 15:35
@flozia flozia merged commit 9305737 into main Sep 26, 2024
16 checks passed
@flozia flozia deleted the e2e-convert-cron-to-pr branch September 26, 2024 15:40
Copy link

Cleanup completed - database 'blurts-server-pr-4996' destroyed, cloud run service 'blurts-server-pr-4996' destroyed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants