optimized the e2e suite, separated the yml for cron #1
Workflow file for this run
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
name: Monitor Cron e2e Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 8 * * *' | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Environment to run the e2e against' | |
required: false | |
default: 'dev' | |
type: choice | |
options: | |
- stage | |
- prod | |
- dev | |
type: | |
description: 'What Type of Test do you want to run?' | |
required: false | |
default: 'all' | |
type: choice | |
options: | |
- all | |
- smoke | |
- ui | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20.5.1 | |
- name: Install dependencies | |
run: npm ci | |
- name: Copy env var | |
run: cp .env-dist .env | |
- name: Store Playwright's Version | |
run: | | |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//') | |
echo "Playwright's 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@v3 | |
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 - ${{ inputs.environment != null && inputs.environment || 'stage' }} | |
if: github.actor != 'dependabot[bot]' | |
run: npm run e2e:${{ inputs.type != null && inputs.type || '' }} | |
timeout-minutes: 10 | |
env: | |
E2E_TEST_ENV: ${{ inputs.environment != null && inputs.environment || 'stage' }} | |
E2E_TEST_BASE_URL: ${{ secrets.E2E_TEST_BASE_URL }} | |
E2E_TEST_ACCOUNT_EMAIL: ${{ secrets.E2E_TEST_ACCOUNT_EMAIL }} | |
E2E_TEST_ACCOUNT_PASSWORD: ${{ secrets.E2E_TEST_ACCOUNT_PASSWORD }} | |
E2E_START_LOCAL_SERVER: 'false' | |
ADMINS: ${{ secrets.ADMINS }} | |
FXA_ENABLED: true | |
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }} | |
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} | |
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} | |
HIBP_KANON_API_TOKEN: ${{ secrets.HIBP_KANON_API_TOKEN }} | |
HIBP_API_TOKEN: ${{ secrets.HIBP_API_TOKEN }} | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-results | |
path: src/e2e/test-results/ | |
retention-days: 30 |