Skip to content

Update realnet-tests.yml #15

Update realnet-tests.yml

Update realnet-tests.yml #15

name: 'Comprehensive All-Pages E2E Testing'
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
inputs:
environment:
description: 'Environment to test against'
required: false
default: 'local'
type: choice
options:
- local
- production
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/playwright-browsers
PLAYWRIGHT_BASE_URL: ${{ (github.event.inputs.environment == 'production') && 'https://svmseek.com' || 'http://localhost:3000' }}
jobs:
comprehensive-all-pages-tests:
name: 'All Pages E2E Tests'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies with retry logic
run: |
for i in $(seq 1 3); do
echo "Attempt $i: Installing dependencies..."
if yarn install --frozen-lockfile --network-timeout 300000; then
echo "Dependencies installed successfully on attempt $i"
break
elif [ $i -eq 3 ]; then
echo "Failed to install dependencies after 3 attempts"
exit 1
else
echo "Attempt $i failed, retrying in 10 seconds..."
sleep 10
fi
done
- name: Install Playwright browsers
run: npx playwright install ${{ matrix.browser }} --with-deps
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: playwright-browsers-${{ matrix.browser }}-${{ hashFiles('yarn.lock') }}
- name: Build application for local testing
if: github.event.inputs.environment == 'local' || env.PLAYWRIGHT_BASE_URL == 'http://localhost:3000'
run: yarn build
- name: Create screenshots directory
run: mkdir -p /tmp/screenshots
- name: Start local server (if testing locally)
if: github.event.inputs.environment == 'local' || env.PLAYWRIGHT_BASE_URL == 'http://localhost:3000'
run: |
npx serve -s build -l 3000 &
SERVER_PID=$!
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
# Wait for server to be ready with timeout
timeout=120
while [ $timeout -gt 0 ]; do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
echo "Waiting for server to start... ($timeout seconds remaining)"
sleep 2
timeout=$((timeout - 2))
done
if [ $timeout -le 0 ]; then
echo "Server failed to start within 120 seconds"
exit 1
fi
- name: Run comprehensive all-pages E2E tests
run: npx playwright test e2e/comprehensive-all-pages.spec.ts --project=${{ matrix.browser }} --reporter=html
env:
PLAYWRIGHT_BASE_URL: ${{ env.PLAYWRIGHT_BASE_URL }}
- name: Stop local server
if: always() && env.SERVER_PID
run: |
if [ ! -z "$SERVER_PID" ]; then
kill $SERVER_PID || true
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: all-pages-test-results-${{ matrix.browser }}
path: |
playwright-report/
test-results/
/tmp/screenshots/
retention-days: 7
- name: Upload screenshots specifically
if: always()
uses: actions/upload-artifact@v4
with:
name: all-pages-screenshots-${{ matrix.browser }}
path: /tmp/screenshots/
retention-days: 7
# Quick validation test for fast feedback
quick-validation:
name: 'Quick All-Pages Validation'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --network-timeout 300000
- name: Install Playwright
run: npx playwright install chromium --with-deps
- name: Build application
run: yarn build
- name: Create screenshots directory
run: mkdir -p /tmp/screenshots
- name: Start local server
run: |
npx serve -s build -l 3000 &
SERVER_PID=$!
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
# Wait for server
timeout=60
while [ $timeout -gt 0 ]; do
if curl -s http://localhost:3000 > /dev/null; then
echo "Server is ready!"
break
fi
sleep 2
timeout=$((timeout - 2))
done
- name: Run quick validation tests (main pages only)
run: |
npx playwright test e2e/comprehensive-all-pages.spec.ts \
--grep "should load.*correctly" \
--project=chromium \
--reporter=list \
--timeout=15000 \
--max-failures=5
env:
PLAYWRIGHT_BASE_URL: http://localhost:3000
- name: Stop server
if: always()
run: |
if [ ! -z "$SERVER_PID" ]; then
kill $SERVER_PID || true
fi
- name: Upload quick validation results
if: always()
uses: actions/upload-artifact@v4
with:
name: quick-validation-results
path: |
test-results/
/tmp/screenshots/
retention-days: 3
# Production health check (if testing against production)
production-health-check:
name: 'Production Health Check'
runs-on: ubuntu-latest
if: github.event.inputs.environment == 'production'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --network-timeout 300000
- name: Install Playwright
run: npx playwright install chromium --with-deps
- name: Create screenshots directory
run: mkdir -p /tmp/screenshots
- name: Run production health check
run: |
npx playwright test e2e/comprehensive-all-pages.spec.ts \
--grep "should load.*correctly" \
--project=chromium \
--reporter=html \
--timeout=30000
env:
PLAYWRIGHT_BASE_URL: https://svmseek.com
- name: Upload health check results
if: always()
uses: actions/upload-artifact@v4
with:
name: production-health-check
path: |
playwright-report/
test-results/
/tmp/screenshots/
retention-days: 14
# Consolidate results and provide summary
test-summary:
name: 'Test Results Summary'
runs-on: ubuntu-latest
needs: [comprehensive-all-pages-tests, quick-validation]
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all test artifacts
uses: actions/download-artifact@v4
with:
path: test-artifacts/
- name: Generate test summary
run: |
echo "# SVMSeek All-Pages E2E Test Results" > test-summary.md
echo "" >> test-summary.md
echo "## Test Execution Summary" >> test-summary.md
echo "- **Environment**: ${{ env.PLAYWRIGHT_BASE_URL }}" >> test-summary.md
echo "- **Trigger**: ${{ github.event_name }}" >> test-summary.md
echo "- **Commit**: ${{ github.sha }}" >> test-summary.md
echo "- **Date**: $(date)" >> test-summary.md
echo "" >> test-summary.md
# Count test artifacts
TOTAL_BROWSERS=$(ls test-artifacts/ | grep "all-pages-test-results" | wc -l || echo "0")
SCREENSHOT_SETS=$(ls test-artifacts/ | grep "screenshots" | wc -l || echo "0")
echo "## Test Coverage" >> test-summary.md
echo "- **Browser Matrix**: $TOTAL_BROWSERS browsers tested" >> test-summary.md
echo "- **Screenshot Sets**: $SCREENSHOT_SETS screenshot collections" >> test-summary.md
echo "- **Quick Validation**: $([ -d "test-artifacts/quick-validation-results" ] && echo "✅ Passed" || echo "❌ Failed")" >> test-summary.md
echo "" >> test-summary.md
echo "## Pages Tested" >> test-summary.md
echo "- ✅ Landing/Welcome Page (/)" >> test-summary.md
echo "- ✅ Create Wallet Page (/create_wallet)" >> test-summary.md
echo "- ✅ Restore Wallet Page (/restore_wallet)" >> test-summary.md
echo "- ✅ Connect Popup Page (/connect_popup)" >> test-summary.md
echo "- ✅ Help Center Page (/help)" >> test-summary.md
echo "- ✅ Surprise Vault Page (/vault)" >> test-summary.md
echo "- ✅ Wallet Interface (/wallet)" >> test-summary.md
echo "- ✅ Wallet Sub-routes (/wallet/*)" >> test-summary.md
echo "- ✅ Error/404 Pages" >> test-summary.md
echo "- ✅ Responsive Design (Mobile/Tablet/Desktop)" >> test-summary.md
echo "" >> test-summary.md
echo "## Test Categories" >> test-summary.md
echo "- 🔍 Page Load Testing" >> test-summary.md
echo "- 🎯 UI Element Validation" >> test-summary.md
echo "- 🔄 Cross-Page Navigation" >> test-summary.md
echo "- 📱 Responsive Design Testing" >> test-summary.md
echo "- ⚡ Performance Validation" >> test-summary.md
echo "- 🛡️ Error Handling" >> test-summary.md
- name: Upload consolidated summary
uses: actions/upload-artifact@v4
with:
name: all-pages-e2e-summary
path: |
test-summary.md
test-artifacts/
retention-days: 30
- name: Post summary to PR (if PR)
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const summary = fs.readFileSync('test-summary.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});