-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4996 from mozilla/e2e-convert-cron-to-pr
Run full E2E test suite on PRs
- Loading branch information
Showing
16 changed files
with
268 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Monitor E2E Test Suite (full) | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
e2e-tests-full: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
# Service containers to run with `container-job` | ||
services: | ||
# Label used to access the service container | ||
postgres: | ||
# Docker Hub image | ||
image: postgres | ||
# Provide the password for postgres | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: blurts | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.9.x | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
- name: Setting up postgres | ||
run: npm run db:migrate | ||
env: | ||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/blurts | ||
- name: Store Playwright's Version | ||
run: | | ||
# Get the current Playwright version listed in package.json | ||
PLAYWRIGHT_VERSION=$(npx playwright --version | sed 's/Version //') | ||
echo "Playwright Version: $PLAYWRIGHT_VERSION" | ||
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | ||
- name: Cache Playwright Browsers for Playwright's Version | ||
id: cache-playwright-browsers | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/ms-playwright | ||
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | ||
|
||
- name: Setup Playwright Browser | ||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run Playwright tests | ||
if: github.actor != 'dependabot[bot]' | ||
run: npm run e2e -- --update-snapshots | ||
timeout-minutes: 20 | ||
env: | ||
E2E_TEST_ENV: local | ||
E2E_TEST_BASE_URL: http://localhost:6060 | ||
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 }} | ||
ADMINS: ${{ secrets.ADMINS }} | ||
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET_LOCAL }} | ||
OAUTH_ACCOUNT_URI: ${{ secrets.OAUTH_ACCOUNT_URI }} | ||
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 | ||
HIBP_KANON_API_TOKEN: ${{ secrets.HIBP_KANON_API_TOKEN }} | ||
HIBP_API_TOKEN: ${{ secrets.HIBP_API_TOKEN }} | ||
HIBP_KANON_API_ROOT: "http://localhost:6060/api/mock/hibp" | ||
ONEREP_API_BASE: "http://localhost:6060/api/mock/onerep/" | ||
PREMIUM_PRODUCT_ID: ${{ secrets.STAGE_PREMIUM_PRODUCT_ID }} | ||
PREMIUM_PLAN_ID_MONTHLY_US: ${{ secrets.STAGE_PREMIUM_PLAN_ID_MONTHLY_US }} | ||
PREMIUM_PLAN_ID_YEARLY_US: ${{ secrets.STAGE_PREMIUM_PLAN_ID_YEARLY_US }} | ||
REDIS_URL: "redis://redis.mock" | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: test-results | ||
path: src/e2e/test-results/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* 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 { parseIso8601Datetime } from "../../../utils/parse"; | ||
|
||
export function isPrePlusDate( | ||
plusReleaseDateString: string, | ||
dateStringToCompare: string, | ||
) { | ||
const brokerScanReleaseDateParts = plusReleaseDateString.split("-"); | ||
if (brokerScanReleaseDateParts[0] === "") { | ||
brokerScanReleaseDateParts[0] = "2023"; | ||
} | ||
const brokerScanReleaseDate = new Date( | ||
Date.UTC( | ||
Number.parseInt(brokerScanReleaseDateParts[0], 10), | ||
Number.parseInt(brokerScanReleaseDateParts[1] ?? "12", 10) - 1, | ||
Number.parseInt(brokerScanReleaseDateParts[2] ?? "05", 10), | ||
), | ||
); | ||
|
||
return ( | ||
(parseIso8601Datetime(dateStringToCompare)?.getTime() ?? 0) < | ||
brokerScanReleaseDate.getTime() | ||
); | ||
} |
Oops, something went wrong.