Relay e2e tests #841
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: Relay e2e tests | |
on: | |
schedule: | |
- cron: 0 8 * * * | |
workflow_call: | |
inputs: | |
environment: | |
required: true | |
default: stage | |
type: string | |
health_check: | |
required: false | |
default: false | |
type: boolean | |
secrets: | |
E2E_TEST_ACCOUNT_FREE: | |
required: true | |
E2E_TEST_ACCOUNT_PASSWORD: | |
required: true | |
E2E_TEST_ACCOUNT_PREMIUM: | |
required: true | |
E2E_TEST_BASE_URL: | |
required: true | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Environment to run the e2e against | |
required: true | |
default: stage | |
type: choice | |
options: | |
- stage | |
- prod | |
- dev | |
health_check: | |
description: Enable health check | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
relaye2e: | |
name: ${{ inputs.health_check && 'Relay e2e health check' || 'Relay e2e all tests' }} | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version-file: frontend/package.json | |
cache: npm | |
- name: Install Node dependencies | |
run: npm install | |
- name: Install Playwright Browsers | |
run: | | |
npm install -D @playwright/test --with-deps | |
npx playwright install | |
- name: Run Playwright tests | |
run: > | |
commandenv="${{ inputs.environment != null && inputs.environment || 'stage' | |
}}" | |
if ${{ contains(inputs.health_check, 'true') }}; then | |
E2E_TEST_ENV=$commandenv npx playwright test --grep "@health_check" | |
else | |
npm run test:$commandenv | |
fi | |
env: | |
E2E_TEST_ENV: ${{ inputs.environment != null && inputs.environment || 'stage' }} | |
E2E_TEST_ACCOUNT_FREE: ${{ secrets.E2E_TEST_ACCOUNT_FREE }} | |
E2E_TEST_ACCOUNT_PASSWORD: ${{ secrets.E2E_TEST_ACCOUNT_PASSWORD }} | |
E2E_TEST_ACCOUNT_PREMIUM: ${{ secrets.E2E_TEST_ACCOUNT_PREMIUM }} | |
E2E_TEST_BASE_URL: ${{ secrets.E2E_TEST_BASE_URL }} | |
- name: Upload html report as artifact to troubleshoot failures. | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 5 | |
- name: Send GitHub Action trigger data to Slack workflow | |
id: slack | |
uses: slackapi/[email protected] | |
if: failure() | |
with: | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Link to job:* *<https://github.com/mozilla/fx-private-relay/actions/runs/${{ github.run_id }}|Relay e2e tests>*" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Workflow:* \n ${{ github.workflow }}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Status:*\n ${{ job.status }} " | |
} | |
] | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Ref:*\n ${{ github.ref }} " | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Triggered by:*\n ${{ github.triggering_actor }}" | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_FAILURES_WEBHOOK }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |