-
Notifications
You must be signed in to change notification settings - Fork 30
test: PR requires e2e tests to pass #2221
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
Draft
bosbaber
wants to merge
3
commits into
main
Choose a base branch
from
stephan/int1-629
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,138 @@ | ||
| name: E2E | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| e2e: | ||
| name: Playwright E2E (local stack) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
| env: | ||
| # Non-interactive OpenSSL subject values when local:certs generates the | ||
| # self-signed TLS certificates (see local/scripts/local-tools.sh). | ||
| HEADLESS: '1' | ||
| # The Traefik proxy serves a self-signed cert. In CI we don't wire the cert | ||
| # into the browser trust store, so tell Playwright to ignore HTTPS errors | ||
| # (honoured by e2e/playwright.config.ts). | ||
| PLAYWRIGHT_IGNORE_HTTPS_ERRORS: 'true' | ||
| # NODE_TLS_REJECT_UNAUTHORIZED=0 is intentionally NOT set here: at job | ||
| # scope it would also disable TLS verification for dependency downloads in | ||
| # `pnpm install` / `pnpm build`. It is set per-step only where Node must | ||
| # talk to the self-signed local stack. | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup Node, PNPM and dependencies | ||
| uses: ./.github/workflows/setup | ||
|
|
||
| - name: Build all packages | ||
| run: pnpm build | ||
|
|
||
| # docker compose is invoked with `--env-file ./local/.env.local | ||
| # --env-file ./local/.env` (see the `compose` script in package.json). | ||
| # .env.local is committed but .env is untracked, so create an empty one — | ||
| # every service default is baked in as ${VAR:-default} and points at the | ||
| # in-stack MockGatehub, so no secrets are required. | ||
| - name: Create local docker env file | ||
| run: touch local/.env | ||
|
|
||
| # Brings up the full Docker stack (Postgres, Redis, Traefik, Rafiki, | ||
| # MockGatehub), adds /etc/hosts aliases, generates + trusts the TLS certs, | ||
| # and runs the Rafiki asset setup script. The Rafiki asset step | ||
| # (local/scripts/rafiki-setup.js) calls the self-signed HTTPS stack, so it | ||
| # needs TLS verification disabled. | ||
| - name: Bring up local stack | ||
| run: pnpm local:setup | ||
| env: | ||
| NODE_TLS_REJECT_UNAUTHORIZED: '0' | ||
|
|
||
| # The wallet + boutique apps run on the host (not in Docker) and are what | ||
| # Traefik proxies testnet.test / api.testnet.test to. This mirrors the | ||
| # `dev` script minus its `pnpm local:up` step — the Docker stack is already | ||
| # up from local:setup, so we start only the four host processes. They read | ||
| # the committed packages/*/.env.local files. Run detached — the job | ||
| # teardown kills them when the runner is torn down. | ||
| - name: Start wallet and boutique apps | ||
| env: | ||
| NODE_TLS_REJECT_UNAUTHORIZED: '0' | ||
| run: | | ||
| mkdir -p "$RUNNER_TEMP/testnet-logs" | ||
| nohup pnpm exec concurrently \ | ||
| -n "WALLET-BE,WALLET-FE,BOUTIQUE-BE,BOUTIQUE-FE" \ | ||
| "pnpm wallet:backend dev" \ | ||
| "pnpm wallet:frontend dev" \ | ||
| "pnpm boutique:backend dev" \ | ||
| "pnpm boutique:frontend dev" \ | ||
| > "$RUNNER_TEMP/testnet-logs/dev.log" 2>&1 & | ||
| echo "Started host apps (pid $!)" | ||
|
|
||
| - name: Wait for the stack to be ready | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| wait_for() { | ||
| local name="$1" cmd="$2" attempts="${3:-60}" | ||
| echo "Waiting for $name ..." | ||
| for i in $(seq 1 "$attempts"); do | ||
| if eval "$cmd" >/dev/null 2>&1; then | ||
| echo " $name is ready (after $((i * 5))s)" | ||
| return 0 | ||
| fi | ||
| sleep 5 | ||
| done | ||
| echo "::error::Timed out waiting for $name" | ||
| return 1 | ||
| } | ||
|
|
||
| # Wallet backend listening on the host (direct HTTP port). | ||
| wait_for "wallet backend (localhost:3003)" \ | ||
| 'curl -s -o /dev/null http://localhost:3003' 60 | ||
|
|
||
| # Wallet frontend served through Traefik at the e2e base URL. Next.js | ||
| # compiles the first requested page lazily, so poll for a 200. | ||
| wait_for "wallet frontend (https://testnet.test)" \ | ||
| '[ "$(curl -ks -o /dev/null -w "%{http_code}" https://testnet.test/auth/login)" = "200" ]' 60 | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: pnpm --filter @interledger/testnet-e2e exec playwright install --with-deps chromium | ||
|
|
||
| # NODE_TLS_REJECT_UNAUTHORIZED=0 lets any Node-based test helpers reach the | ||
| # self-signed https://testnet.test endpoints (the browser itself is covered | ||
| # by PLAYWRIGHT_IGNORE_HTTPS_ERRORS). | ||
| - name: Run E2E tests | ||
| run: pnpm e2e:test | ||
| env: | ||
| NODE_TLS_REJECT_UNAUTHORIZED: '0' | ||
|
|
||
| - name: Dump service logs on failure | ||
| if: failure() | ||
| run: | | ||
| echo "===== docker compose ps =====" | ||
| pnpm compose ps || true | ||
| echo "===== host apps (dev.log tail) =====" | ||
| tail -n 300 "$RUNNER_TEMP/testnet-logs/dev.log" || true | ||
| echo "===== docker compose logs (tail) =====" | ||
| pnpm compose logs --no-color --tail=200 || true | ||
|
|
||
| - name: Upload Playwright report | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-report | ||
| path: | | ||
| e2e/playwright-report | ||
| e2e/test-results | ||
| retention-days: 7 | ||
| if-no-files-found: ignore | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.