CircleCI
Running Playwright Tests in Parallel on CircleCI and Currents
Last updated
Was this helpful?
Was this helpful?
# .circleci/config.yml
version: 2.1
jobs:
run-test:
docker:
- image: mcr.microsoft.com/playwright:v1.60.0-noble
# Enable parallelism of 3
parallelism: 3
steps:
- checkout
- run: npm i -D @playwright/test
- run: npx playwright install
- run: npx playwright install chrome
- run:
name: Run tests
# Enable Playwright Shards
# - Add CURRENTS_RECORD_KEY and CURRENTS_PROJECT_ID to the "currents" CircleCI context
command: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npx pwc --key "$CURRENTS_RECORD_KEY" --project-id "$CURRENTS_PROJECT_ID" --shard="${SHARD}/${CIRCLE_NODE_TOTAL}"
# Invoke jobs via workflows
workflows:
run-test-workflow:
jobs:
- run-test:
# Use "currents" CircleCI context to enable access to secrets
context: currents