-
Notifications
You must be signed in to change notification settings - Fork 0
DC-207 Add: Run Playwright/Pa11y tests in CI; fix: example spec #90
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4a8fa49
DC-207 Add: Run Playwright tests in CI; fix: example spec
noxmwalsh 7dec9b9
DC-207 Fix: Wait for uswds-loading class to be gone
noxmwalsh e4665d4
DC-207 Update: Update command, set GITHUB_TOKEN read to permission read
noxmwalsh feb894c
DC-207 Fix: double-dash being consumed by playwright
noxmwalsh d988eaa
DC-207 Add: Pa11y runs on CI
noxmwalsh 7c805da
DC-207 Add: Set PUPPETEER_EXECUTABLE_PATH to indicate chrome path
noxmwalsh 58e2c5a
DC-207 Update: Add timeout and install Chrome via puppeteer install
noxmwalsh 7f31bf0
DC-207 Add: Puppeteer as a dependency
noxmwalsh 3333db2
DC-207 Update: command usage in CI script related to pa11y
noxmwalsh 7d4ecf8
DC-207 Update: command to be less redundent; make clear it runs on al…
noxmwalsh 6df9fa0
DC-207 Update: Puppeteer version
noxmwalsh 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
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,115 @@ | ||
| name: Playwright E2E | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["main"] | ||
|
|
||
| jobs: | ||
| e2e: | ||
| name: E2E Tests | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| services: | ||
| mssql: | ||
| image: mcr.microsoft.com/mssql/server:2022-latest | ||
| env: | ||
| ACCEPT_EULA: Y | ||
| MSSQL_SA_PASSWORD: YourStrong@Passw0rd | ||
| ports: | ||
| - 1433:1433 | ||
| options: >- | ||
| --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P YourStrong@Passw0rd -Q 'SELECT 1' -C -b -o /dev/null || exit 1" | ||
| --health-interval=10s | ||
| --health-timeout=5s | ||
| --health-retries=10 | ||
| --health-start-period=10s | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Determine state connector ref | ||
| id: connector-ref | ||
| run: | | ||
| BRANCH="${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}" | ||
| FALLBACK="${{ github.event_name == 'pull_request' && github.base_ref || 'main' }}" | ||
| REPO_URL="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository_owner }}/sebt-self-service-portal-state-connector.git" | ||
| if git ls-remote --exit-code --heads "$REPO_URL" "refs/heads/${BRANCH}" 1>/dev/null 2>&1; then | ||
| echo "ref=${BRANCH}" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "ref=${FALLBACK}" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Checkout state connector | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: codeforamerica/sebt-self-service-portal-state-connector | ||
| ref: ${{ steps.connector-ref.outputs.ref }} | ||
| path: state-connector | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: "10.0.200" | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: "10" | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "24" | ||
| cache: "pnpm" | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile --prefer-offline | ||
|
|
||
| - name: Build backend | ||
| run: ./.github/workflows/scripts/build-backend.sh --configuration Release | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: cd src/SEBT.Portal.Web && pnpm exec playwright install --with-deps chromium | ||
|
|
||
| - name: Install Chrome for Pa11y | ||
| run: cd src/SEBT.Portal.Web && pnpm exec puppeteer browsers install chrome | ||
|
|
||
| - name: Run Pa11y and Playwright E2E tests | ||
| env: | ||
| CI: true | ||
| SKIP_WEB_SERVER: "1" | ||
| STATE: dc | ||
| NEXT_PUBLIC_STATE: dc | ||
| ASPNETCORE_ENVIRONMENT: Development | ||
| ConnectionStrings__DefaultConnection: "Server=localhost,1433;Database=SebtPortal;User Id=sa;Password=YourStrong@Passw0rd;TrustServerCertificate=True;" | ||
| JwtSettings__SecretKey: "ci-e2e-jwt-secret-at-least-32-characters-long" | ||
| IdentifierHasher__SecretKey: "ci-e2e-identifier-hasher-key-32chars" | ||
| Oidc__CompleteLoginSigningKey: "ci-e2e-oidc-signing-key-at-least-32-chars" | ||
| UseMockHouseholdData: "true" | ||
| run: | | ||
| pnpm dev & | ||
| echo "Waiting for server at http://localhost:3000..." | ||
| for i in $(seq 1 90); do | ||
| curl -sf --max-time 15 http://localhost:3000 > /dev/null && echo "Server ready" && break | ||
| sleep 2 | ||
| done | ||
| curl -sf --max-time 15 http://localhost:3000 > /dev/null || (echo "Server failed to start" && exit 1) | ||
| echo "Running Pa11y accessibility tests..." | ||
| pnpm ci:test:a11y | ||
| echo "Running Playwright E2E tests..." | ||
| pnpm ci:test:e2e | ||
|
|
||
| - name: Upload Playwright report | ||
| uses: actions/upload-artifact@v4 | ||
| if: ${{ !cancelled() }} | ||
| with: | ||
| name: playwright-report | ||
| path: src/SEBT.Portal.Web/playwright-report/ | ||
| retention-days: 7 | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
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.