{
  "format": 3,
  "id": "4.3",
  "title": "Groups, whole-group shards and worker processes",
  "layers": {
    "runner": {
      "label": "Runner"
    }
  },
  "lanes": {
    "runner": {
      "label": "RUNNER PROCESS",
      "layer": "runner"
    },
    "worker": {
      "label": "WORKER PROCESS",
      "layer": "runner"
    }
  },
  "frames": {},
  "nodes": {
    "selected": {
      "label": "Selected files and tests",
      "layer": "runner",
      "lane": "runner"
    },
    "groups": {
      "label": "Compatible file groups",
      "layer": "runner",
      "lane": "runner"
    },
    "parallel": {
      "label": "Parallel tests",
      "layer": "runner",
      "lane": "runner"
    },
    "serial": {
      "label": "Serial describe",
      "layer": "runner",
      "lane": "runner"
    },
    "hooks": {
      "label": "All-hook batches",
      "layer": "runner",
      "lane": "runner"
    },
    "shards": {
      "label": "Whole-group shards",
      "layer": "runner",
      "lane": "runner"
    },
    "dispatch": {
      "label": "Dispatcher · slots",
      "layer": "runner",
      "lane": "runner"
    },
    "limits": {
      "label": "Project worker limit",
      "layer": "runner",
      "lane": "runner"
    },
    "compatible": {
      "label": "Worker compatibility",
      "layer": "runner",
      "lane": "runner"
    },
    "tests": {
      "label": "First test",
      "layer": "runner",
      "lane": "worker"
    },
    "replacement": {
      "label": "Replacement worker",
      "layer": "runner",
      "lane": "worker"
    },
    "next": {
      "label": "Next test",
      "layer": "runner",
      "lane": "worker"
    },
    "last": {
      "label": "Next test",
      "layer": "runner",
      "lane": "worker"
    }
  },
  "edges": {
    "select": {
      "from": "selected",
      "to": "groups",
      "label": "filter, group"
    },
    "parallel": {
      "from": "groups",
      "to": "parallel"
    },
    "serial": {
      "from": "serial",
      "to": "groups",
      "label": "serial"
    },
    "hooks": {
      "from": "parallel",
      "to": "hooks",
      "label": "all-hooks"
    },
    "shard": {
      "from": "groups",
      "to": "shards",
      "label": "keep whole"
    },
    "parallelShard": {
      "from": "hooks",
      "to": "shards"
    },
    "dispatch": {
      "from": "shards",
      "to": "dispatch",
      "label": "schedule"
    },
    "limit": {
      "from": "limits",
      "to": "dispatch"
    },
    "reuse": {
      "from": "dispatch",
      "to": "compatible",
      "label": "check hash"
    },
    "run": {
      "from": "compatible",
      "to": "tests",
      "label": "assign group"
    },
    "replace": {
      "from": "compatible",
      "to": "replacement",
      "label": "replace"
    },
    "next": {
      "from": "tests",
      "to": "next"
    },
    "last": {
      "from": "next",
      "to": "last"
    }
  },
  "scenarios": [
    {
      "id": "intro",
      "label": "How groups reach workers",
      "display": {
        "counterLabel": false,
        "edges": "progressive",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "steps": [
        {
          "id": "selection-happens-in-the-runner",
          "title": "Selection happens in the runner",
          "text": "testMatch and testIgnore filter files; grep filters test titles including tags.",
          "show": [
            "selected"
          ],
          "current": [
            "selected"
          ],
          "edges": [],
          "defs": [
            "selection",
            "file-selection"
          ],
          "sources": [
            {
              "label": "projectUtils.ts:147-160",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/projectUtils.ts#L147-L160"
            },
            {
              "label": "loadUtils.ts:242-249",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/loadUtils.ts#L242-L249"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "compatible-tests-form-file-group",
          "title": "Compatible tests form file groups",
          "text": "Nonparallel tests share a file group within the same worker hash; projects, repetition and worker fixtures separate groups.",
          "show": [
            "selected",
            "groups"
          ],
          "current": [
            "groups"
          ],
          "edges": [
            "select"
          ],
          "defs": [
            "group",
            "compatible-grouping"
          ],
          "code": "group",
          "sources": [
            {
              "label": "testGroups.ts:30-37",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L30-L37"
            },
            {
              "label": "testGroups.ts:68-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L68-L81"
            },
            {
              "label": "testGroups.ts:112-120",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L112-L120"
            },
            {
              "label": "config.ts:91-93",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/common/config.ts#L91-L93"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "parallel-mode-has-exceptions",
          "title": "Parallel mode has exceptions",
          "text": "Parallel tests without all-hooks or an outer sequential suite can form individual groups; a serial describe stays together.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial"
          ],
          "current": [
            "parallel",
            "serial"
          ],
          "edges": [
            "select",
            "parallel",
            "serial"
          ],
          "defs": [
            "parallel",
            "parallel-tests"
          ],
          "code": "bigfile",
          "sources": [
            {
              "label": "loadUtils.ts:263-267",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/loadUtils.ts#L263-L267"
            },
            {
              "label": "testGroups.ts:85-93",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L85-L93"
            },
            {
              "label": "testGroups.ts:95-109",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L95-L109"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "all-hooks-share-batches",
          "title": "All-hooks share batches",
          "text": "Parallel tests with all-hooks and no outer sequential suite are batched using expected parallelism. Sharding first uses shard count, then worker count.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks"
          ],
          "current": [
            "hooks"
          ],
          "edges": [
            "select",
            "parallel",
            "serial",
            "hooks"
          ],
          "defs": [
            "hooks",
            "all-hook-batches"
          ],
          "sources": [
            {
              "label": "testGroups.ts:85-93",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L85-L93"
            },
            {
              "label": "testGroups.ts:95-109",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L95-L109"
            },
            {
              "label": "testGroups.ts:122-131",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L122-L131"
            },
            {
              "label": "loadUtils.ts:191-203",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/loadUtils.ts#L191-L203"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "shards-keep-groups-whole",
          "title": "Shards keep groups whole",
          "text": "Shard target sizes use test counts. A whole group goes to the shard containing its first test position; statically skipped tests normally do not count.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards"
          ],
          "current": [
            "shards"
          ],
          "edges": [
            "select",
            "parallel",
            "serial",
            "hooks",
            "shard",
            "parallelShard"
          ],
          "defs": [
            "shard",
            "whole-groups"
          ],
          "sources": [
            {
              "label": "testGroups.ts:164-168",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L164-L168"
            },
            {
              "label": "testGroups.ts:183-193",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L183-L193"
            },
            {
              "label": "testGroups.ts:170-181",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L170-L181"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "slots-bound-dispatch-and-reuse",
          "title": "Slots bound dispatch and reuse",
          "text": "The dispatcher allocates bounded slots, respects project limits and scheduling locks, and prefers a free compatible worker. A mismatched or stopping worker stops before replacement.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "replacement"
          ],
          "current": [
            "dispatch",
            "limits",
            "compatible",
            "replacement"
          ],
          "edges": [
            "select",
            "parallel",
            "serial",
            "hooks",
            "shard",
            "parallelShard",
            "dispatch",
            "limit",
            "reuse",
            "replace"
          ],
          "defs": [
            "dispatch",
            "worker-slots",
            "project-limit",
            "compatible-reuse",
            "Replacement"
          ],
          "sources": [
            {
              "label": "dispatcher.ts:73-98",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L73-L98"
            },
            {
              "label": "dispatcher.ts:236-240",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L236-L240"
            },
            {
              "label": "dispatcher.ts:87-92",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L87-L92"
            },
            {
              "label": "dispatcher.ts:115-118",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L115-L118"
            },
            {
              "label": "dispatcher.ts:149-157",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L149-L157"
            },
            {
              "label": "suiteUtils.ts:76-78",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/common/suiteUtils.ts#L76-L78"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "workers-run-assigned-tests-in-or",
          "title": "Workers run assigned tests in order",
          "text": "The worker awaits each test before advancing to the next test in its assigned group.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "replacement",
            "tests",
            "next",
            "last"
          ],
          "current": [
            "tests"
          ],
          "edges": [
            "select",
            "parallel",
            "serial",
            "hooks",
            "shard",
            "parallelShard",
            "dispatch",
            "limit",
            "reuse",
            "replace",
            "run",
            "next",
            "last"
          ],
          "defs": [
            "order",
            "ordered-execution"
          ],
          "sources": [
            {
              "label": "workerMain.ts:242-250",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/workerMain.ts#L242-L250"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        }
      ]
    },
    {
      "id": "default-files",
      "label": "Default files",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "nodeLabels": {
        "tests": "A",
        "next": "B",
        "last": "C"
      },
      "whole": {
        "title": "Whole file groups",
        "text": "Example: two files, four tests, two shards. The worker rows show shard 1."
      },
      "steps": [
        {
          "id": "testmatch-and-grep-select-the-fi",
          "title": "testMatch and grep select the files and tests: a has A, B, C; b has D.",
          "text": "testMatch and grep select the files and tests: a has A, B, C; b has D.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "selected"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "projectUtils.ts:147-160",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/projectUtils.ts#L147-L160"
            },
            {
              "label": "loadUtils.ts:242-249",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/loadUtils.ts#L242-L249"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "by-default-the-tests-of-one-file",
          "title": "By default, the tests of one file form one group.",
          "text": "By default, the tests of one file form one group.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "groups"
          ],
          "edges": [
            "select"
          ],
          "defs": [],
          "code": "group",
          "log": [],
          "sources": [
            {
              "label": "testGroups.ts:30-37",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L30-L37"
            },
            {
              "label": "testGroups.ts:68-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L68-L81"
            },
            {
              "label": "testGroups.ts:112-120",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L112-L120"
            },
            {
              "label": "config.ts:91-93",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/common/config.ts#L91-L93"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "shard-1-takes-the-whole-group-a",
          "title": "Shard 1 takes the whole group A B C. Worker 1 runs A.",
          "text": "Shard 1 takes the whole group A B C. Worker 1 runs A.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "tests"
          ],
          "edges": [
            "shard",
            "dispatch"
          ],
          "defs": [],
          "log": [
            "Running 3 tests using 1 worker, shard 1 of 2"
          ],
          "sources": [
            {
              "label": "testGroups.ts:164-168",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L164-L168"
            },
            {
              "label": "testGroups.ts:183-193",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L183-L193"
            },
            {
              "label": "testGroups.ts:170-181",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L170-L181"
            },
            {
              "label": "workerMain.ts:242-250",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/workerMain.ts#L242-L250"
            },
            {
              "label": "base.ts:243-250",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/reporters/base.ts#L243-L250"
            },
            {
              "label": "tasks.ts:413-422",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/tasks.ts#L413-L422"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "the-same-worker-runs-b-in-file-o",
          "title": "The same worker runs B, in file order.",
          "text": "The same worker runs B, in file order.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "next"
          ],
          "edges": [
            "next"
          ],
          "defs": [],
          "log": [
            "Running 3 tests using 1 worker, shard 1 of 2"
          ],
          "sources": [
            {
              "label": "workerMain.ts:242-250",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/workerMain.ts#L242-L250"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "worker-1-runs-c-one-group-needs",
          "title": "Worker 1 runs C. One group needs one worker, so worker 2 never starts.",
          "text": "Worker 1 runs C. One group needs one worker, so worker 2 never starts.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "last"
          ],
          "edges": [
            "last"
          ],
          "defs": [],
          "log": [
            "Running 3 tests using 1 worker, shard 1 of 2"
          ],
          "sources": [
            {
              "label": "workerMain.ts:242-250",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/workerMain.ts#L242-L250"
            },
            {
              "label": "tasks.ts:413-422",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/tasks.ts#L413-L422"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "selected",
          "step": "testmatch-and-grep-select-the-fi",
          "log": []
        },
        {
          "node": "groups",
          "step": "by-default-the-tests-of-one-file",
          "log": [],
          "edge": "select"
        },
        {
          "node": "shards",
          "step": "shard-1-takes-the-whole-group-a",
          "log": [],
          "edge": "shard"
        },
        {
          "node": "dispatch",
          "step": "shard-1-takes-the-whole-group-a",
          "log": [
            "Running 3 tests using 1 worker, shard 1 of 2"
          ],
          "edge": "dispatch"
        },
        {
          "node": "tests",
          "step": "shard-1-takes-the-whole-group-a",
          "log": []
        },
        {
          "node": "next",
          "step": "the-same-worker-runs-b-in-file-o",
          "log": [],
          "edge": "next"
        },
        {
          "node": "last",
          "step": "worker-1-runs-c-one-group-needs",
          "log": [],
          "edge": "last"
        }
      ]
    },
    {
      "id": "parallel-exceptions",
      "label": "Parallel exceptions",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "whole": {
        "title": "fullyParallel splits a file into tests",
        "text": "A serial describe and a shared beforeAll keep tests together."
      },
      "steps": [
        {
          "id": "with-fullyparallel-each-test-can",
          "title": "With fullyParallel, each test can be its own group.",
          "text": "With fullyParallel, each test can be its own group.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "parallel"
          ],
          "edges": [],
          "defs": [],
          "code": "bigfile",
          "log": [],
          "sources": [
            {
              "label": "loadUtils.ts:263-267",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/loadUtils.ts#L263-L267"
            },
            {
              "label": "testGroups.ts:85-93",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L85-L93"
            },
            {
              "label": "testGroups.ts:95-109",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L95-L109"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "two-shards-share-the-groups-a-an",
          "title": "Two shards share the groups: A and B, then C.",
          "text": "Two shards share the groups: A and B, then C.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "shards"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "testGroups.ts:183-193",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L183-L193"
            },
            {
              "label": "testGroups.ts:170-181",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L170-L181"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "a-serial-describe-with-a-and-b-s",
          "title": "A serial describe with A and B stays one group.",
          "text": "A serial describe with A and B stays one group.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "serial"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "testGroups.ts:85-93",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L85-L93"
            },
            {
              "label": "testGroups.ts:95-109",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L95-L109"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "four-tests-with-a-shared-beforea",
          "title": "Four tests with a shared beforeAll form two batches, one per shard.",
          "text": "Four tests with a shared beforeAll form two batches, one per shard.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "hooks"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "testGroups.ts:122-131",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L122-L131"
            },
            {
              "label": "loadUtils.ts:191-203",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/loadUtils.ts#L191-L203"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "parallel",
          "step": "with-fullyparallel-each-test-can",
          "log": []
        },
        {
          "node": "shards",
          "step": "two-shards-share-the-groups-a-an",
          "log": []
        },
        {
          "node": "serial",
          "step": "a-serial-describe-with-a-and-b-s",
          "log": []
        },
        {
          "node": "hooks",
          "step": "four-tests-with-a-shared-beforea",
          "log": []
        }
      ]
    },
    {
      "id": "reuse-limits",
      "label": "Reuse limits",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": true,
        "nodeBadges": true,
        "log": "incremental"
      },
      "whole": {
        "title": "A free slot takes an allowed group",
        "text": "Example: two workers; project P allows one."
      },
      "steps": [
        {
          "id": "p-allows-one-worker-so-its-secon",
          "title": "P allows one worker, so its second file waits.",
          "text": "P allows one worker, so its second file waits.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "limits"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "dispatcher.ts:236-240",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L236-L240"
            },
            {
              "label": "dispatcher.ts:87-92",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L87-L92"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "project-q-needs-its-own-worker-i",
          "title": "Project Q needs its own worker. It takes the second slot.",
          "text": "Project Q needs its own worker. It takes the second slot.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "dispatch"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "testGroups.ts:30-37",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L30-L37"
            },
            {
              "label": "dispatcher.ts:236-240",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L236-L240"
            },
            {
              "label": "dispatcher.ts:87-92",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L87-L92"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "after-a-spec-ts-the-same-p-worke",
          "title": "After a.spec.ts, the same P worker takes b.spec.ts.",
          "text": "After a.spec.ts, the same P worker takes b.spec.ts.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "tests"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "dispatcher.ts:115-118",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L115-L118"
            },
            {
              "label": "suiteUtils.ts:76-78",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/common/suiteUtils.ts#L76-L78"
            },
            {
              "label": "workerMain.ts:242-250",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/workerMain.ts#L242-L250"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        },
        {
          "id": "if-a-group-needs-other-worker-fi",
          "title": "If a group needs other worker fixtures, the old worker stops first.",
          "text": "If a group needs other worker fixtures, the old worker stops first.",
          "show": [
            "selected",
            "groups",
            "parallel",
            "serial",
            "hooks",
            "shards",
            "dispatch",
            "limits",
            "compatible",
            "tests",
            "replacement",
            "next",
            "last"
          ],
          "current": [
            "replacement"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "dispatcher.ts:149-157",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L149-L157"
            }
          ],
          "deeper": [
            {
              "title": "0.1 API calls leave from Node, page calls from the browser",
              "href": "/0-anatomy/0-1-anatomy-of-a-test/"
            },
            {
              "title": "4.1 Projects wait for successful dependencies",
              "href": "/4-runner/4-1-config-and-projects/"
            },
            {
              "title": "4.2 Built on demand, torn down in reverse",
              "href": "/4-runner/4-2-custom-fixtures/"
            },
            {
              "title": "4.4 A retry is a new attempt in a new worker",
              "href": "/4-runner/4-4-retries-and-flaky/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "limits",
          "step": "p-allows-one-worker-so-its-secon",
          "log": []
        },
        {
          "node": "dispatch",
          "step": "project-q-needs-its-own-worker-i",
          "log": []
        },
        {
          "node": "tests",
          "step": "after-a-spec-ts-the-same-p-worke",
          "log": []
        },
        {
          "node": "replacement",
          "step": "if-a-group-needs-other-worker-fi",
          "log": []
        }
      ]
    }
  ],
  "definitions": {
    "selection": {
      "term": "Selection",
      "text": "testMatch and testIgnore filter files; grep filters test titles including tags."
    },
    "group": {
      "term": "Compatible file group",
      "text": "Nonparallel tests share a file group within the same worker hash; projects, repetition and worker fixtures separate groups."
    },
    "parallel": {
      "term": "Parallel groups",
      "text": "Parallel tests without all-hooks or an outer sequential suite can form individual groups; a serial describe stays together."
    },
    "hooks": {
      "term": "All-hook batches",
      "text": "Parallel tests with all-hooks and no outer sequential suite are batched using expected parallelism. Sharding first uses shard count, then worker count."
    },
    "shard": {
      "term": "Whole-group sharding",
      "text": "Shard target sizes use test counts. A whole group goes to the shard containing its first test position; statically skipped tests normally do not count."
    },
    "dispatch": {
      "term": "Worker dispatch",
      "text": "The dispatcher allocates bounded slots, respects project limits and scheduling locks, and prefers a free compatible worker. A mismatched or stopping worker stops before replacement."
    },
    "order": {
      "term": "Ordered execution",
      "text": "The worker awaits each test before advancing to the next test in its assigned group."
    },
    "file-selection": {
      "term": "File selection",
      "text": "testMatch and testIgnore filter supported test files."
    },
    "compatible-grouping": {
      "term": "Compatible grouping",
      "text": "Worker hash and required file partition groups."
    },
    "parallel-tests": {
      "term": "Parallel tests",
      "text": "Without all-hooks, parallel groups use the test or outer sequential suite as key."
    },
    "all-hook-batches": {
      "term": "All-hook batches",
      "text": "Batch size uses the number of tests and expected parallelism."
    },
    "whole-groups": {
      "term": "Whole groups",
      "text": "A shard receives a group according to its first test position."
    },
    "worker-slots": {
      "term": "Worker slots",
      "text": "The dispatcher allocates the configured number of slots."
    },
    "project-limit": {
      "term": "Project limit",
      "text": "The scheduler checks running workers against the project limit."
    },
    "compatible-reuse": {
      "term": "Compatible reuse",
      "text": "The dispatcher prefers a free worker with the same hash."
    },
    "Replacement": {
      "term": "Replacement",
      "text": "A mismatched or stopping worker is stopped before replacement."
    },
    "ordered-execution": {
      "term": "Ordered execution",
      "text": "The worker awaits each test before advancing."
    }
  },
  "code": {
    "group": {
      "title": "Inside Playwright · testGroups.ts",
      "source": {
        "label": "testGroups.ts:115-115",
        "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L115"
      },
      "lines": [
        "// Tests without parallel mode should run serially as a single group.",
        "if (withRequireFile.general.tests.length)",
        "  result.push(withRequireFile.general);"
      ]
    },
    "bigfile": {
      "title": "In your test · one big file",
      "lines": [
        "// 40 tests in one file:",
        "// ✗ Four workers, still one group",
        "export default defineConfig({ workers: 4 });",
        "// ✓ Let the tests of one file split",
        "export default defineConfig({",
        "  workers: 4,",
        "  fullyParallel: true,",
        "});"
      ]
    }
  },
  "conceptScenario": "intro",
  "concepts": [
    {
      "label": "Runner process",
      "layer": "runner",
      "items": [
        {
          "definition": "file-selection",
          "short": "testMatch and testIgnore filter supported test files.",
          "nodes": [
            "selected"
          ],
          "step": {
            "step": "selection-happens-in-the-runner"
          },
          "source": {
            "label": "projectUtils.ts:147-160",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/projectUtils.ts#L147-L160"
          }
        },
        {
          "definition": "compatible-grouping",
          "short": "Worker hash and required file partition groups.",
          "nodes": [
            "groups"
          ],
          "step": {
            "step": "compatible-tests-form-file-group"
          },
          "source": {
            "label": "testGroups.ts:68-81",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L68-L81"
          }
        },
        {
          "definition": "parallel-tests",
          "short": "Without all-hooks, parallel groups use the test or outer sequential suite as key.",
          "nodes": [
            "parallel",
            "serial"
          ],
          "step": {
            "step": "parallel-mode-has-exceptions"
          },
          "source": {
            "label": "testGroups.ts:95-109",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L95-L109"
          }
        },
        {
          "definition": "all-hook-batches",
          "short": "Batch size uses the number of tests and expected parallelism.",
          "nodes": [
            "hooks"
          ],
          "step": {
            "step": "all-hooks-share-batches"
          },
          "source": {
            "label": "testGroups.ts:122-131",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L122-L131"
          }
        },
        {
          "definition": "whole-groups",
          "short": "A shard receives a group according to its first test position.",
          "nodes": [
            "shards"
          ],
          "step": {
            "step": "shards-keep-groups-whole"
          },
          "source": {
            "label": "testGroups.ts:183-193",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/testGroups.ts#L183-L193"
          }
        },
        {
          "definition": "worker-slots",
          "short": "The dispatcher allocates the configured number of slots.",
          "nodes": [
            "dispatch"
          ],
          "step": {
            "step": "slots-bound-dispatch-and-reuse"
          },
          "source": {
            "label": "dispatcher.ts:236-240",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L236-L240"
          }
        },
        {
          "definition": "project-limit",
          "short": "The scheduler checks running workers against the project limit.",
          "nodes": [
            "limits"
          ],
          "step": {
            "step": "slots-bound-dispatch-and-reuse"
          },
          "source": {
            "label": "dispatcher.ts:87-92",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L87-L92"
          }
        },
        {
          "definition": "compatible-reuse",
          "short": "The dispatcher prefers a free worker with the same hash.",
          "nodes": [
            "compatible"
          ],
          "step": {
            "step": "slots-bound-dispatch-and-reuse"
          },
          "source": {
            "label": "dispatcher.ts:115-118",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L115-L118"
          }
        },
        {
          "definition": "Replacement",
          "short": "A mismatched or stopping worker is stopped before replacement.",
          "nodes": [
            "replacement"
          ],
          "step": {
            "step": "slots-bound-dispatch-and-reuse"
          },
          "source": {
            "label": "dispatcher.ts:149-157",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/runner/dispatcher.ts#L149-L157"
          }
        }
      ]
    },
    {
      "label": "Worker process",
      "layer": "runner",
      "items": [
        {
          "definition": "ordered-execution",
          "short": "The worker awaits each test before advancing.",
          "nodes": [
            "tests"
          ],
          "step": {
            "step": "workers-run-assigned-tests-in-or"
          },
          "source": {
            "label": "workerMain.ts:242-250",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/workerMain.ts#L242-L250"
          }
        }
      ]
    }
  ],
  "callouts": {
    "1": [
      "selected",
      "groups"
    ],
    "2": [
      "groups",
      "parallel",
      "serial",
      "hooks"
    ],
    "3": [
      "shards"
    ],
    "4": [
      "dispatch",
      "compatible",
      "tests"
    ]
  },
  "deeper": [
    {
      "title": "0.1 API calls leave from Node, page calls from the browser",
      "href": "/0-anatomy/0-1-anatomy-of-a-test/",
      "why": "Runner and worker processes."
    },
    {
      "title": "4.1 Projects wait for successful dependencies",
      "href": "/4-runner/4-1-config-and-projects/",
      "why": "Project selection and scheduling."
    },
    {
      "title": "4.2 Built on demand, torn down in reverse",
      "href": "/4-runner/4-2-custom-fixtures/",
      "why": "Worker fixtures and their scope."
    },
    {
      "title": "4.4 A retry is a new attempt in a new worker",
      "href": "/4-runner/4-4-retries-and-flaky/",
      "why": "New attempts in new workers."
    }
  ]
}
