|
| 1 | +name: Playwright E2E |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + branches: ["main"] |
| 8 | + |
| 9 | +jobs: |
| 10 | + e2e: |
| 11 | + name: E2E Tests |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 15 |
| 14 | + |
| 15 | + services: |
| 16 | + mssql: |
| 17 | + image: mcr.microsoft.com/mssql/server:2022-latest |
| 18 | + env: |
| 19 | + ACCEPT_EULA: Y |
| 20 | + MSSQL_SA_PASSWORD: YourStrong@Passw0rd |
| 21 | + ports: |
| 22 | + - 1433:1433 |
| 23 | + options: >- |
| 24 | + --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P YourStrong@Passw0rd -Q 'SELECT 1' -C -b -o /dev/null || exit 1" |
| 25 | + --health-interval=10s |
| 26 | + --health-timeout=5s |
| 27 | + --health-retries=10 |
| 28 | + --health-start-period=10s |
| 29 | +
|
| 30 | + steps: |
| 31 | + - name: Checkout code |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Determine state connector ref |
| 35 | + id: connector-ref |
| 36 | + run: | |
| 37 | + BRANCH="${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}" |
| 38 | + FALLBACK="${{ github.event_name == 'pull_request' && github.base_ref || 'main' }}" |
| 39 | + REPO_URL="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository_owner }}/sebt-self-service-portal-state-connector.git" |
| 40 | + if git ls-remote --exit-code --heads "$REPO_URL" "refs/heads/${BRANCH}" 1>/dev/null 2>&1; then |
| 41 | + echo "ref=${BRANCH}" >> "$GITHUB_OUTPUT" |
| 42 | + else |
| 43 | + echo "ref=${FALLBACK}" >> "$GITHUB_OUTPUT" |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Checkout state connector |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + repository: codeforamerica/sebt-self-service-portal-state-connector |
| 50 | + ref: ${{ steps.connector-ref.outputs.ref }} |
| 51 | + path: state-connector |
| 52 | + |
| 53 | + - name: Setup .NET |
| 54 | + uses: actions/setup-dotnet@v5 |
| 55 | + with: |
| 56 | + dotnet-version: "10.0.200" |
| 57 | + |
| 58 | + - name: Setup pnpm |
| 59 | + uses: pnpm/action-setup@v4 |
| 60 | + with: |
| 61 | + version: "10" |
| 62 | + |
| 63 | + - name: Setup Node.js |
| 64 | + uses: actions/setup-node@v4 |
| 65 | + with: |
| 66 | + node-version: "24" |
| 67 | + cache: "pnpm" |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: pnpm install --frozen-lockfile --prefer-offline |
| 71 | + |
| 72 | + - name: Build backend |
| 73 | + run: ./.github/workflows/scripts/build-backend.sh --configuration Release |
| 74 | + |
| 75 | + - name: Install Playwright browsers |
| 76 | + run: cd src/SEBT.Portal.Web && pnpm exec playwright install --with-deps chromium |
| 77 | + |
| 78 | + - name: Run Playwright tests |
| 79 | + env: |
| 80 | + CI: true |
| 81 | + STATE: dc |
| 82 | + NEXT_PUBLIC_STATE: dc |
| 83 | + ASPNETCORE_ENVIRONMENT: Development |
| 84 | + ConnectionStrings__DefaultConnection: "Server=localhost,1433;Database=SebtPortal;User Id=sa;Password=YourStrong@Passw0rd;TrustServerCertificate=True;" |
| 85 | + JwtSettings__SecretKey: "ci-e2e-jwt-secret-at-least-32-characters-long" |
| 86 | + IdentifierHasher__SecretKey: "ci-e2e-identifier-hasher-key-32chars" |
| 87 | + Oidc__CompleteLoginSigningKey: "ci-e2e-oidc-signing-key-at-least-32-chars" |
| 88 | + UseMockHouseholdData: "true" |
| 89 | + run: cd src/SEBT.Portal.Web && pnpm exec playwright test --project=chromium |
| 90 | + |
| 91 | + - name: Upload Playwright report |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + if: ${{ !cancelled() }} |
| 94 | + with: |
| 95 | + name: playwright-report |
| 96 | + path: src/SEBT.Portal.Web/playwright-report/ |
| 97 | + retention-days: 7 |
0 commit comments