Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/e2e.yml
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
Comment thread
bosbaber marked this conversation as resolved.
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
18 changes: 18 additions & 0 deletions e2e/features/cross-currency-transfer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,21 @@ Feature: Cross-currency payment transfers
Then I should see the wallet address selector
When I select a wallet address
Then I should see the recipient address input field

Scenario: User can send a cross-currency payment
Given I am a verified and logged-in wallet user
And I have a source wallet address configured backed by a EUR account
And I've deposited 100.00 EUR into my EUR account
And I have a second wallet address configured backed by a USD account

When I navigate to the send page
And I select the EUR source account by wallet address
And I select the USD destination account by wallet address
And I enter a payment amount of 10.00 EUR
And I submit the payment
Then I should see a confirmation page with the payment details
Then I should see a success message indicating the payment was sent
When I navigate to the transactions page of my EUR account
Then I should see a new transaction with a debit of 10.00 EUR
When I navigate to the transactions page of my USD account
Then I should see a new transaction with a credit of the equivalent USD amount
Loading
Loading