Skip to content

Optional E2E tests for () #21

Optional E2E tests for ()

Optional E2E tests for () #21

Workflow file for this run

name: 'CI: Optional E2E Tests'
run-name: Optional E2E tests for ${{ inputs.commit }} (${{ inputs.correlation_id }})
# Dispatched by `job_optional_e2e_tests` in build.yml. This is a separate workflow because GitHub
# does not count failed checks of a dispatched run in the PR status, so these failures do not mark
# the PR as failed.
on:
# Only here so that GitHub registers this workflow before it is on the default branch, which a
# dispatch needs. The job is skipped for this event. Remove this trigger after the merge.
pull_request:
workflow_dispatch:
inputs:
commit:
description: The commit that the tarballs were built from
required: true
build_run_id:
description: The build.yml run that uploaded the tarball artifacts
required: true
matrix:
description: The optional E2E test matrix as JSON
required: true
pr_number:
description: The PR that the run is for, if there is one
required: false
correlation_id:
description: Lets the dispatching job find this run
required: true
# Like build.yml: a new push to a PR cancels the old run, other runs are never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ inputs.pr_number || github.run_id }}
cancel-in-progress: true
env:
HEAD_COMMIT: ${{ inputs.commit }}
# See build.yml
DISABLE_V8_COMPILE_CACHE: '1'
jobs:
job_optional_e2e_tests:
name: E2E ${{ matrix.label || matrix.test-application }} Test (optional)
if: github.event_name == 'workflow_dispatch'
# Same cache volume as the E2E jobs in build.yml. The event is always `workflow_dispatch`, so the PR number
# decides if the run gets the PR volume.
runs-on:
namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript-e2e${{ inputs.pr_number != '' && '-pr'
|| '' }}
timeout-minutes: 15
permissions:
contents: read
# To download the artifacts of the build.yml run
actions: read
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
# Needed because some apps expect a certain prefix
NEXT_PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
REACT_APP_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
E2E_OPENROUTER_API_KEY: ${{ secrets.E2E_OPENROUTER_API_KEY }}
# Only this app talks to OpenAI directly (OpenRouter has no Decisions route), so only it gets the key.
E2E_OPENAI_DECISIONS_API_KEY:
${{ matrix.test-application == 'node-openai-decisions-send-to-sentry' && secrets.E2E_OPENAI_DECISIONS_API_KEY ||
'' }}
# Used by test apps that deploy a real Cloudflare Worker, e.g. cloudflare-workers-send-to-sentry
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# Keeps the Worker name at `<prefix>-pr-<number>`, which the cleanup-e2e-workers workflow deletes
E2E_PR_NUMBER: ${{ inputs.pr_number }}
# The `runtime` of a runtime variant, see dev-packages/e2e-tests/README.md
RUNTIME: ${{ matrix.runtime }}
# Without the root node_modules, `pnpm run` would first install the whole workspace.
pnpm_config_verify_deps_before_run: 'false'
strategy:
fail-fast: false
# The fallback only keeps the expression valid for the skipped `pull_request` run.
matrix: ${{ fromJson(inputs.matrix || '{"include":[{}]}') }}
steps:
- name: Check out commit ${{ env.HEAD_COMMIT }}
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Prepare E2E test application
uses: ./.github/actions/prepare-e2e-test
with:
test-application: ${{ matrix.test-application }}
runtime: ${{ matrix.runtime }}
deno-version: ${{ matrix.deno-version }}
artifacts-run-id: ${{ inputs.build_run_id }}
github-token: ${{ github.token }}
# Installs Playwright while the app builds. Keep it right before the build: the runner sets up a background
# composite action's steps from the job's shared `github` context, which fails with "Collection was modified" if
# a foreground step starts at that moment. Starting next to `download-artifact` also made it fail to read the event file.
- name: Install Playwright
id: install-playwright
background: true
uses: ./.github/actions/install-playwright
with:
browsers: chromium
cwd: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 7
run: ${{ matrix.build-command || 'pnpm test:build' }}
- wait: [install-playwright]
- name: Run E2E test
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 10
run: ${{ matrix.assert-command || 'pnpm test:assert' }}