Skip to content

[unticketed]: manage users role change error handling #4858

[unticketed]: manage users role change error handling

[unticketed]: manage users role change error handling #4858

name: Frontend E2E Tests
on:
workflow_dispatch:
workflow_call:
pull_request:
paths:
- frontend/**
- .github/workflows/ci-frontend-e2e.yml
defaults:
run:
working-directory: ./frontend
env:
NODE_VERSION: 22
LOCKFILE_PATH: ./frontend/package-lock.json
PACKAGE_MANAGER: npm
NODE_OPTIONS: --dns-result-order=ipv4first
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-tests:
name: Run E2E Tests
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
shard: [1, 2, 3, 4]
total_shards: [4]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: ${{ env.PACKAGE_MANAGER }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
- run: |
npm ci
npx playwright install --with-deps
- name: Start API Server for e2e tests
run: |
cd ../api
# Enable core dumps for debugging segfaults
ulimit -c unlimited
mkdir -p /tmp/cores
echo "/tmp/cores/core.%e.%p.%t" | sudo tee /proc/sys/kernel/core_pattern
# Run init first to generate JWT keys in override.env
make init
# Now run the seeding and populate commands
make db-seed-local-with-agencies populate-search-opportunities populate-search-agencies start
cd ../frontend
# Ensure the API wait script is executable
chmod +x ../api/bin/wait-for-api.sh
../api/bin/wait-for-api.sh
shell: bash
- name: Build a prod version of the site
run: |
{
cat .env.development
sed -En '/API_JWT_PUBLIC_KEY/,/-----END PUBLIC KEY-----/p' ../api/override.env
cat ../api/e2e_token.tmp
} >> .env.local
# Use the 127.0.0.1 url for tests (IPv4 only)
sed -i 's|^SENDY_API_URL=.*|SENDY_API_URL=http://127.0.0.1:3000|' .env.local
npm run build -- --no-lint
- name: Run e2e tests (Shard ${{ matrix.shard }}/${{ matrix.total_shards }})
env:
CI: true
TOTAL_SHARDS: ${{ matrix.total_shards }}
CURRENT_SHARD: ${{ matrix.shard }}
run: |
npm run test:e2e
- name: Show API logs on failure
if: failure()
run: |
cd ../api
echo "=== API Container Logs ==="
docker logs grants-api || echo "Could not retrieve API logs"
echo ""
echo "=== OpenSearch Container Logs ==="
docker logs opensearch-node || echo "Could not retrieve OpenSearch logs"
echo ""
echo "=== Container Status ==="
docker ps -a
echo ""
shell: bash
- name: Verify Blob Report Directory
run: |
echo "Contents of blob-report directory:"
ls -R blob-report || echo "blob-report directory not found"
- name: Upload Blob Report
if: always()
uses: actions/upload-artifact@v4
with:
name: blob-report-shard-${{ matrix.shard }}
path: /home/runner/work/simpler-grants-gov/simpler-grants-gov/frontend/blob-report
retention-days: 1
create-report:
name: Create Merged Test Report
if: ${{ !cancelled() }}
needs: [e2e-tests]
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: ${{ env.PACKAGE_MANAGER }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
- run: |
npm ci
npx playwright install --with-deps
- name: Download All Blob Reports
uses: actions/download-artifact@v4
with:
path: frontend/all-blob-reports
pattern: blob-report-shard-*
merge-multiple: true
- name: Verify Downloaded Artifacts
run: |
echo "Contents of all-blob-reports after download:"
ls -R all-blob-reports*
- name: Merge Blob Reports into HTML
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Verify Downloaded Artifacts
run: |
echo "Contents of all-blob-reports after download:"
ls -R playwright*
- name: Upload Merged HTML Report
uses: actions/upload-artifact@v4
with:
name: merged-html-report
path: frontend/playwright-report
retention-days: 30