Skip to main content
InterviewHubPRO
Section Overview
Q44

Question 44 of 50

Part 3: Advanced Internals, Scale & Production Quality (Senior / Lead)

88%
Software Testing & QA (50 Qs)•Part 3: Advanced Internals, Scale & Production Quality (Senior / Lead)

Sharding and Parallelization in Playwright: Test distribution across multiple CI machines.

senior LevelCode ExampleTestingSystem Design

In Simple Words: When an E2E test suite takes 40 minutes to run sequentially on one machine:

  • Playwright Native Sharding: Split the test suite evenly across $N$ parallel CI runners:
    yaml
    # GitHub Actions Matrix
    strategy:
      matrix:
        shardIndex: [1, 2, 3, 4]
        shardTotal: [4]
    steps:
      - run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
    
  • Runs 4 machines simultaneously, reducing CI test duration from 40 minutes down to 10 minutes!