Skip to content

Commit

Permalink
test: Run sharded playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Dec 22, 2024
1 parent bc434ed commit eb0cf4b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/e2e-sharded.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: E2E / Playwright Tests
on:
push:
branches: [main, next]
paths:
- "aksel.nav.no/**"
pull_request:
branches: [main, next]
paths:
- "aksel.nav.no/**"

jobs:
build_and_start_website:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup and build Next.js application
uses: ./.github/actions/build-website
with:
use_cdn_assets: false
npm_auth_token: ${{ secrets.READER_TOKEN }}
nais_id_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
nais_project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
sanity_read_token: ${{ secrets.SANITY_READ }}
sanity_read_no_drafts_token: ${{ secrets.SANITY_READ_NO_DRAFTS }}

- name: Start App
run: yarn serve:next

playwright:
needs: build_and_start_website
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.1-jammy
strategy:
matrix:
shard: [1, 2, 3, 4] # Example for 2 shards

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Run Playwright tests
run: yarn workspace website run yarn generate-testpaths
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
SANITY_READ_NO_DRAFTS: ${{ secrets.SANITY_READ_NO_DRAFTS }}

- name: Run Playwright Tests
run: yarn workspace website run yarn playwright --shard ${{ matrix.shard }}/4
2 changes: 1 addition & 1 deletion aksel.nav.no/website/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: 1,
workers: 3,
workers: 5,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down

0 comments on commit eb0cf4b

Please sign in to comment.