{
  "format": 3,
  "id": "6.1",
  "title": "What a trace records",
  "layers": {
    "client": {
      "label": "Client"
    },
    "server": {
      "label": "Server"
    },
    "page": {
      "label": "Page"
    },
    "runner": {
      "label": "Runner"
    }
  },
  "lanes": {
    "client": {
      "label": "CLIENT · TRACING API",
      "layer": "client"
    },
    "server": {
      "label": "SERVER · RECORDER AND HAR",
      "layer": "server"
    },
    "page": {
      "label": "PAGE · SELECTED CAPTURE",
      "layer": "page"
    },
    "runner": {
      "label": "RUNNER · TEST TRACING",
      "layer": "runner"
    }
  },
  "frames": {},
  "nodes": {
    "start": {
      "label": "tracing.start()",
      "layer": "client",
      "lane": "client"
    },
    "save": {
      "label": "stopChunk({ path })",
      "layer": "client",
      "lane": "client"
    },
    "chunk": {
      "label": "recording chunk",
      "layer": "server",
      "lane": "server"
    },
    "calls": {
      "label": "before · input · after",
      "layer": "server",
      "lane": "server"
    },
    "network": {
      "label": "browser resources",
      "layer": "server",
      "lane": "server"
    },
    "api": {
      "label": "API network file",
      "layer": "server",
      "lane": "server"
    },
    "dom": {
      "label": "DOM snapshots",
      "layer": "page",
      "lane": "page"
    },
    "screen": {
      "label": "screenshot frames",
      "layer": "page",
      "lane": "page"
    },
    "mode": {
      "label": "record before result",
      "layer": "runner",
      "lane": "runner"
    },
    "steps": {
      "label": "steps · assertions",
      "layer": "runner",
      "lane": "runner"
    },
    "status": {
      "label": "keep or discard",
      "layer": "runner",
      "lane": "runner"
    },
    "retry": {
      "label": "retry index 1",
      "layer": "runner",
      "lane": "runner"
    },
    "apiReset": {
      "label": "next API chunk: empty",
      "layer": "server",
      "lane": "server"
    }
  },
  "edges": {
    "start": {
      "from": "start",
      "to": "chunk",
      "label": "starts"
    },
    "calls": {
      "from": "chunk",
      "to": "calls",
      "label": "records calls"
    },
    "save": {
      "from": "chunk",
      "to": "save",
      "label": "save path"
    },
    "dom": {
      "from": "chunk",
      "to": "dom",
      "label": "DOM"
    },
    "screen": {
      "from": "chunk",
      "to": "screen",
      "label": "frames"
    },
    "resources": {
      "from": "chunk",
      "to": "network",
      "label": "shares"
    },
    "result": {
      "from": "mode",
      "to": "status",
      "label": "compares"
    }
  },
  "scenarios": [
    {
      "id": "how",
      "label": "How tracing works",
      "display": {
        "counterLabel": false,
        "edges": "progressive",
        "edgeBadges": true,
        "nodeBadges": false,
        "log": "incremental"
      },
      "steps": [
        {
          "id": "start-a-session-and-chunk",
          "title": "Start a session and chunk",
          "text": "start() sets capture options and opens the first chunk. Starting a chunk discards one still recording.",
          "show": [
            "start",
            "chunk"
          ],
          "current": [
            "start",
            "chunk"
          ],
          "edges": [
            "start"
          ],
          "defs": [
            "start",
            "chunk"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:46-60",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
            },
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:196-201",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L196-L201"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "calls-add-trace-events",
          "title": "Calls add trace events",
          "text": "Before, input and after events record the call lifecycle. They are trace records, not printed messages.",
          "show": [
            "start",
            "chunk",
            "calls"
          ],
          "current": [
            "calls"
          ],
          "edges": [
            "calls"
          ],
          "defs": [
            "calls"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            }
          ],
          "deeper": [
            {
              "title": "5.1 Each wait repeats a different piece of work",
              "href": "/5-expect/5-1-three-ways-to-wait/"
            }
          ]
        },
        {
          "id": "select-browser-capture",
          "title": "Select browser capture",
          "text": "DOM snapshots and screenshot frames are separate evidence. Browser script bodies are omitted unless live; body loading can fail separately.",
          "show": [
            "start",
            "chunk",
            "calls",
            "dom",
            "screen"
          ],
          "current": [
            "dom",
            "screen"
          ],
          "edges": [
            "dom",
            "screen"
          ],
          "defs": [
            "dom",
            "screen"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:187-190",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L187-L190"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "harTracer.ts:377-391",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L377-L391"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "save-each-chunk",
          "title": "Save each chunk",
          "text": "Stopping removes call listeners and keeps capture options. Give a saved chunk a path; no path discards it.",
          "show": [
            "start",
            "chunk",
            "calls",
            "dom",
            "screen",
            "save"
          ],
          "current": [
            "save"
          ],
          "edges": [
            "save"
          ],
          "defs": [
            "save"
          ],
          "code": "save",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:467-477",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L467-L477"
            },
            {
              "label": "tracing.ts:206-224",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "network-resources-differ",
          "title": "Network resources differ",
          "text": "Browser chunks share resources for snapshots. Each API chunk starts with an empty network file.",
          "show": [
            "start",
            "chunk",
            "calls",
            "dom",
            "screen",
            "save",
            "network",
            "api",
            "apiReset"
          ],
          "current": [
            "network",
            "api",
            "apiReset"
          ],
          "edges": [
            "resources"
          ],
          "defs": [
            "network",
            "api",
            "apiReset"
          ],
          "code": "network",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "api-requests-write-records",
          "title": "API requests write records",
          "text": "HAR follows API request start and finish; finished entries become resource snapshots. API contexts have no browser DOM snapshots.",
          "show": [
            "start",
            "chunk",
            "calls",
            "dom",
            "screen",
            "save",
            "network",
            "api",
            "apiReset"
          ],
          "current": [
            "api"
          ],
          "edges": [],
          "defs": [],
          "log": [],
          "sources": [
            {
              "label": "harTracer.ts:126-130",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L126-L130"
            },
            {
              "label": "tracing.ts:636-641",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L636-L641"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "index.ts:789-791",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/index.ts#L789-L791"
            },
            {
              "label": "index.ts:755-758",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/index.ts#L755-L758"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "runner-tracing-includes-assertio",
          "title": "Runner tracing includes assertions",
          "text": "Runner steps feed test tracing. Manual browser tracing alone excludes test assertions.",
          "show": [
            "start",
            "chunk",
            "calls",
            "dom",
            "screen",
            "save",
            "network",
            "api",
            "steps",
            "apiReset"
          ],
          "current": [
            "steps"
          ],
          "edges": [],
          "defs": [
            "steps"
          ],
          "code": "runner",
          "log": [],
          "sources": [
            {
              "label": "testInfo.ts:391-402",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testInfo.ts#L391-L402"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            }
          ],
          "deeper": [
            {
              "title": "5.1 Each wait repeats a different piece of work",
              "href": "/5-expect/5-1-three-ways-to-wait/"
            },
            {
              "title": "5.2 Merge replays saved events and ignores failed tests",
              "href": "/5-expect/5-2-reporters-and-merge/"
            }
          ]
        },
        {
          "id": "record-first-retain-later",
          "title": "Record first, retain later",
          "text": "Matching actual and expected status discards retain-on-failure traces, including expected failures. On-first-retry records retry index one.",
          "show": [
            "start",
            "chunk",
            "calls",
            "dom",
            "screen",
            "save",
            "network",
            "api",
            "steps",
            "mode",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "mode",
            "status",
            "retry"
          ],
          "edges": [
            "result"
          ],
          "defs": [
            "mode",
            "status",
            "retry"
          ],
          "code": "runner",
          "log": [],
          "sources": [
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "testTracing.ts:164-170",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L164-L170"
            }
          ],
          "deeper": [
            {
              "title": "5.2 Merge replays saved events and ignores failed tests",
              "href": "/5-expect/5-2-reporters-and-merge/"
            }
          ]
        }
      ]
    },
    {
      "id": "browser",
      "label": "Browser chunks",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": false,
        "nodeBadges": true,
        "log": "incremental"
      },
      "whole": {
        "title": "Save two browser chunks",
        "text": "Example ZIP names. Both capture options are enabled."
      },
      "steps": [
        {
          "id": "tracing-start",
          "title": "tracing.start()",
          "text": "tracing.start() sets the options and opens chunk A.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "start"
          ],
          "edges": [],
          "defs": [
            "browser-state-0"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:46-60",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
            },
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:187-190",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L187-L190"
            },
            {
              "label": "tracing.ts:196-201",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L196-L201"
            },
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "harTracer.ts:377-391",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L377-L391"
            },
            {
              "label": "tracing.ts:467-477",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L467-L477"
            },
            {
              "label": "tracing.ts:206-224",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "calls-start-and-finish",
          "title": "Calls start and finish",
          "text": "Calls, DOM snapshots and screenshot frames are separate evidence.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "calls"
          ],
          "edges": [],
          "defs": [
            "browser-state-1"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:46-60",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
            },
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:187-190",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L187-L190"
            },
            {
              "label": "tracing.ts:196-201",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L196-L201"
            },
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "harTracer.ts:377-391",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L377-L391"
            },
            {
              "label": "tracing.ts:467-477",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L467-L477"
            },
            {
              "label": "tracing.ts:206-224",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "login-zip-saved",
          "title": "login.zip saved ✓",
          "text": "stopChunk({ path: 'login.zip' }) saves A and stops its call listeners.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "save"
          ],
          "edges": [],
          "defs": [
            "browser-state-2"
          ],
          "code": "save",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:46-60",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
            },
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:187-190",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L187-L190"
            },
            {
              "label": "tracing.ts:196-201",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L196-L201"
            },
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "harTracer.ts:377-391",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L377-L391"
            },
            {
              "label": "tracing.ts:467-477",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L467-L477"
            },
            {
              "label": "tracing.ts:206-224",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "network-recording",
          "title": "Network recording",
          "text": "startChunk() opens B. Browser network resources remain available for snapshots.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "network"
          ],
          "edges": [],
          "defs": [
            "browser-state-3"
          ],
          "code": "network",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:46-60",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
            },
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:187-190",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L187-L190"
            },
            {
              "label": "tracing.ts:196-201",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L196-L201"
            },
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "harTracer.ts:377-391",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L377-L391"
            },
            {
              "label": "tracing.ts:467-477",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L467-L477"
            },
            {
              "label": "tracing.ts:206-224",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "login-zip-checkout-zip",
          "title": "login.zip ✓ · checkout.zip ✓",
          "text": "Save B as checkout.zip. Both ZIPs remain, and the tracing session stays available.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "chunk"
          ],
          "edges": [],
          "defs": [
            "browser-state-4"
          ],
          "code": "save",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:46-60",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
            },
            {
              "label": "tracing.ts:166-179",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L166-L179"
            },
            {
              "label": "tracing.ts:187-190",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L187-L190"
            },
            {
              "label": "tracing.ts:196-201",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L196-L201"
            },
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "harTracer.ts:377-391",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L377-L391"
            },
            {
              "label": "tracing.ts:467-477",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L467-L477"
            },
            {
              "label": "tracing.ts:206-224",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "chunk",
          "step": "tracing-start",
          "log": [],
          "edge": "start"
        },
        {
          "node": "calls",
          "step": "calls-start-and-finish",
          "log": [],
          "edge": "calls"
        },
        {
          "node": "save",
          "step": "login-zip-saved",
          "log": []
        },
        {
          "node": "network",
          "step": "network-recording",
          "log": []
        },
        {
          "node": "chunk",
          "step": "login-zip-checkout-zip",
          "log": []
        }
      ]
    },
    {
      "id": "api-context",
      "label": "API context",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": false,
        "nodeBadges": true,
        "log": "incremental"
      },
      "whole": {
        "title": "Record requests without a page",
        "text": "The runner starts tracing when the API context appears."
      },
      "steps": [
        {
          "id": "runner-tracing-enabled",
          "title": "Runner tracing enabled",
          "text": "With runner tracing enabled, creating an API context starts its trace.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "start"
          ],
          "edges": [],
          "defs": [
            "api-context-state-0"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "harTracer.ts:126-130",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L126-L130"
            },
            {
              "label": "tracing.ts:636-641",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L636-L641"
            },
            {
              "label": "index.ts:789-791",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/index.ts#L789-L791"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "api-request-request-finished",
          "title": "API request → request finished",
          "text": "HAR follows API request start and finish events, then writes resource snapshots.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "api"
          ],
          "edges": [],
          "defs": [
            "api-context-state-1"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "harTracer.ts:126-130",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L126-L130"
            },
            {
              "label": "tracing.ts:636-641",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L636-L641"
            },
            {
              "label": "index.ts:789-791",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/index.ts#L789-L791"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "api-context",
          "title": "API context",
          "text": "An API context has no browser DOM snapshots.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "dom"
          ],
          "edges": [],
          "defs": [
            "api-context-state-2"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "harTracer.ts:126-130",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L126-L130"
            },
            {
              "label": "tracing.ts:636-641",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L636-L641"
            },
            {
              "label": "index.ts:789-791",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/index.ts#L789-L791"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        },
        {
          "id": "network-resources-reset",
          "title": "Network resources reset",
          "text": "The next API chunk starts with an empty network file.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "apiReset"
          ],
          "edges": [],
          "defs": [
            "api-context-state-3"
          ],
          "code": "network",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:208-219",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "harTracer.ts:126-130",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/har/harTracer.ts#L126-L130"
            },
            {
              "label": "tracing.ts:636-641",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L636-L641"
            },
            {
              "label": "index.ts:789-791",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/index.ts#L789-L791"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            }
          ],
          "deeper": [
            {
              "title": "3.3 An API response lives only as long as its context",
              "href": "/3-network/3-3-api-requests/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "start",
          "step": "runner-tracing-enabled",
          "log": []
        },
        {
          "node": "api",
          "step": "api-request-request-finished",
          "log": []
        },
        {
          "node": "dom",
          "step": "api-context",
          "log": []
        },
        {
          "node": "apiReset",
          "step": "network-resources-reset",
          "log": []
        }
      ]
    },
    {
      "id": "retention",
      "label": "Retention",
      "display": {
        "counterLabel": true,
        "edges": "all",
        "edgeBadges": false,
        "nodeBadges": true,
        "log": "incremental"
      },
      "whole": {
        "title": "Record first, retain later",
        "text": "The runner records assertions and decides what to keep after the result."
      },
      "steps": [
        {
          "id": "trace-retain-on-failure",
          "title": "trace: 'retain-on-failure'",
          "text": "retain-on-failure records before the test result exists.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "mode"
          ],
          "edges": [],
          "defs": [
            "retention-state-0"
          ],
          "code": "runner",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "testTracing.ts:164-170",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L164-L170"
            },
            {
              "label": "testInfo.ts:391-402",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testInfo.ts#L391-L402"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "5.1 Each wait repeats a different piece of work",
              "href": "/5-expect/5-1-three-ways-to-wait/"
            },
            {
              "title": "5.2 Merge replays saved events and ignores failed tests",
              "href": "/5-expect/5-2-reporters-and-merge/"
            }
          ]
        },
        {
          "id": "runner-test-steps",
          "title": "Runner test steps",
          "text": "Runner test steps include assertions alongside browser actions.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "steps"
          ],
          "edges": [],
          "defs": [
            "retention-state-1"
          ],
          "code": "runner",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "testTracing.ts:164-170",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L164-L170"
            },
            {
              "label": "testInfo.ts:391-402",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testInfo.ts#L391-L402"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "5.1 Each wait repeats a different piece of work",
              "href": "/5-expect/5-1-three-ways-to-wait/"
            },
            {
              "title": "5.2 Merge replays saved events and ignores failed tests",
              "href": "/5-expect/5-2-reporters-and-merge/"
            }
          ]
        },
        {
          "id": "actual-status-expected-status",
          "title": "Actual status ≠ expected status",
          "text": "Matching status discards the trace. An unexpected failure keeps it.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "status"
          ],
          "edges": [],
          "defs": [
            "retention-state-2"
          ],
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "testTracing.ts:164-170",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L164-L170"
            },
            {
              "label": "testInfo.ts:391-402",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testInfo.ts#L391-L402"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "5.1 Each wait repeats a different piece of work",
              "href": "/5-expect/5-1-three-ways-to-wait/"
            },
            {
              "title": "5.2 Merge replays saved events and ignores failed tests",
              "href": "/5-expect/5-2-reporters-and-merge/"
            }
          ]
        },
        {
          "id": "later-retries-no-recording",
          "title": "Later retries: no recording",
          "text": "on-first-retry records only the first retry.",
          "show": [
            "start",
            "save",
            "chunk",
            "calls",
            "network",
            "api",
            "dom",
            "screen",
            "mode",
            "steps",
            "status",
            "retry",
            "apiReset"
          ],
          "current": [
            "retry"
          ],
          "edges": [],
          "defs": [
            "retention-state-3"
          ],
          "code": "runner",
          "log": [],
          "sources": [
            {
              "label": "tracing.ts:230-243",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
            },
            {
              "label": "tracing.ts:131-138",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
            },
            {
              "label": "tracing.ts:577-586",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
            },
            {
              "label": "tracing.ts:614-625",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L614-L625"
            },
            {
              "label": "class-tracing.md:9",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/docs/src/api/class-tracing.md#L9"
            },
            {
              "label": "testTracing.ts:73-81",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
            },
            {
              "label": "testTracing.ts:164-170",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L164-L170"
            },
            {
              "label": "testInfo.ts:391-402",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testInfo.ts#L391-L402"
            },
            {
              "label": "tracing.ts:589-599",
              "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L589-L599"
            }
          ],
          "deeper": [
            {
              "title": "5.1 Each wait repeats a different piece of work",
              "href": "/5-expect/5-1-three-ways-to-wait/"
            },
            {
              "title": "5.2 Merge replays saved events and ignores failed tests",
              "href": "/5-expect/5-2-reporters-and-merge/"
            }
          ]
        }
      ],
      "flow": [
        {
          "node": "mode",
          "step": "trace-retain-on-failure",
          "log": []
        },
        {
          "node": "steps",
          "step": "runner-test-steps",
          "log": []
        },
        {
          "node": "status",
          "step": "actual-status-expected-status",
          "log": []
        },
        {
          "node": "retry",
          "step": "later-retries-no-recording",
          "log": []
        }
      ]
    }
  ],
  "definitions": {
    "start": {
      "term": "tracing.start()",
      "text": "Starts the session and its first chunk."
    },
    "save": {
      "term": "stopChunk({ path })",
      "text": "A path saves the chunk."
    },
    "chunk": {
      "term": "recording chunk",
      "text": "Registers an instrumentation listener."
    },
    "calls": {
      "term": "before · input · after",
      "text": "Calls append before events."
    },
    "network": {
      "term": "browser resources",
      "text": "Browser network resources are shared across chunks."
    },
    "api": {
      "term": "API network file",
      "text": "Each API chunk starts with an empty network file."
    },
    "dom": {
      "term": "DOM snapshots",
      "text": "Only browser contexts receive a DOM snapshotter."
    },
    "screen": {
      "term": "screenshot frames",
      "text": "The screencast option starts screenshot capture."
    },
    "mode": {
      "term": "record before result",
      "text": "Retain-on-failure enables recording."
    },
    "steps": {
      "term": "steps · assertions",
      "text": "Non-internal test steps feed test tracing."
    },
    "status": {
      "term": "keep or discard",
      "text": "Retention compares actual and expected status."
    },
    "retry": {
      "term": "retry index 1",
      "text": "On-first-retry captures retry index one."
    },
    "browser-state-0": {
      "term": "Example state",
      "text": "tracing.start() · snapshots: true · screenshots: true\nChunk A: recording · Call listeners attached\nCapture enabled · DOM snapshots · screenshot frames\nNetwork recording · Resources shared across chunks\nManual browser tracing · Assertions are not included"
    },
    "browser-state-1": {
      "term": "Example state",
      "text": "tracing.start() · snapshots: true · screenshots: true\nChunk A: recording · Call listeners attached\nCalls start and finish · DOM snapshots · screenshot frames\nNetwork recording · Resources shared across chunks\nManual browser tracing · Assertions are not included"
    },
    "browser-state-2": {
      "term": "Example state",
      "text": "tracing.start() · snapshots: true · screenshots: true\nlogin.zip saved ✓ · Tracing is still on\nCapture enabled · DOM snapshots · screenshot frames\nNetwork recording · Resources shared across chunks\nManual browser tracing · Assertions are not included"
    },
    "browser-state-3": {
      "term": "Example state",
      "text": "tracing.start() · snapshots: true · screenshots: true\nlogin.zip saved ✓ · B recording · Call listeners attached\nCapture enabled · DOM snapshots · screenshot frames\nNetwork recording · Resources shared across chunks\nManual browser tracing · Assertions are not included"
    },
    "browser-state-4": {
      "term": "Example state",
      "text": "tracing.start() · snapshots: true · screenshots: true\nlogin.zip ✓ · checkout.zip ✓ · Tracing is still on\nCapture enabled · DOM snapshots · screenshot frames\nNetwork recording · Resources shared across chunks\nManual browser tracing · Assertions are not included"
    },
    "api-context-state-0": {
      "term": "Example state",
      "text": "Runner tracing enabled · API context created → trace starts\nAPI chunk: recording · API calls are recorded\nAPI request → request finished · Request and response are saved\nNetwork resources · This chunk's requests\nAPI context · No browser DOM snapshots"
    },
    "api-context-state-1": {
      "term": "Example state",
      "text": "Runner tracing enabled · API context created → trace starts\nAPI chunk: recording · API calls are recorded\nAPI request → request finished · Request and response are saved\nNetwork resources · This chunk's requests\nAPI context · No browser DOM snapshots"
    },
    "api-context-state-2": {
      "term": "Example state",
      "text": "Runner tracing enabled · API context created → trace starts\nAPI chunk: recording · API calls are recorded\nAPI request → request finished · Request and response are saved\nNetwork resources · This chunk's requests\nAPI context · No browser DOM snapshots"
    },
    "api-context-state-3": {
      "term": "Example state",
      "text": "Runner tracing enabled · API context created → trace starts\nNext API chunk: recording · A fresh recording window\nAPI request → request finished · Request and response are saved\nNetwork resources reset · No previous chunk's requests\nAPI context · No browser DOM snapshots"
    },
    "retention-state-0": {
      "term": "Example state",
      "text": "trace: 'retain-on-failure' · Recording before the result exists\nBrowser actions · Calls and selected snapshots\nRunner test steps · Assertions included\nResult not known yet · Keep or discard after the test\nTrace recording · In progress"
    },
    "retention-state-1": {
      "term": "Example state",
      "text": "trace: 'retain-on-failure' · Recording before the result exists\nBrowser actions · Calls and selected snapshots\nRunner test steps · Assertions included\nResult not known yet · Keep or discard after the test\nTrace recording · In progress"
    },
    "retention-state-2": {
      "term": "Example state",
      "text": "trace: 'retain-on-failure' · Recording before the result exists\nBrowser actions · Calls and selected snapshots\nRunner test steps · Assertions included\nActual status = expected status · Trace discarded\nActual status ≠ expected status · Trace kept ✓"
    },
    "retention-state-3": {
      "term": "Example state",
      "text": "trace: 'on-first-retry' · What is kept depends on the retry\nBrowser actions · Calls and selected snapshots\nRunner test steps · Assertions included\nFirst attempt: no recording · First retry (index 1): recording ✓\nLater retries: no recording · Only the first retry is recorded"
    },
    "apiReset": {
      "term": "Next API chunk",
      "text": "A new API chunk starts with an empty network file."
    }
  },
  "code": {
    "save": {
      "title": "In your test · save each chunk",
      "lines": [
        "// ✗ No path discards this chunk",
        "await context.tracing.stopChunk();",
        "// ✓ Save before starting another chunk",
        "await context.tracing.stopChunk({",
        "  path: 'login.zip',",
        "});",
        "await context.tracing.startChunk();"
      ]
    },
    "network": {
      "title": "Inside Playwright · tracing.ts",
      "source": {
        "label": "tracing.ts:208-208",
        "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208"
      },
      "lines": [
        "// - Browser context network trace is shared across chunks as it contains resources",
        "// used to serve page snapshots, so make a copy with the new name.",
        "// - APIRequestContext network traces are chunk-specific, always start from scratch.",
        "const preserveNetworkResources = this._context instanceof BrowserContext;"
      ]
    },
    "runner": {
      "title": "In your test · include assertions",
      "lines": [
        "// ✗ Browser tracing alone for assertions",
        "await context.tracing.start();",
        "// ✓ Runner configuration includes them",
        "export default defineConfig({",
        "  use: { trace: 'retain-on-failure' },",
        "});"
      ]
    }
  },
  "conceptScenario": "how",
  "concepts": [
    {
      "label": "Client · tracing API",
      "layer": "client",
      "items": [
        {
          "definition": "start",
          "short": "Starts the session and its first chunk.",
          "nodes": [
            "start"
          ],
          "step": {
            "step": "start-a-session-and-chunk"
          },
          "source": {
            "label": "tracing.ts:46-60",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L46-L60"
          }
        },
        {
          "definition": "save",
          "short": "A path saves the chunk.",
          "nodes": [
            "save"
          ],
          "step": {
            "step": "save-each-chunk"
          },
          "source": {
            "label": "tracing.ts:206-224",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/client/tracing.ts#L206-L224"
          }
        }
      ]
    },
    {
      "label": "Server · recorder and HAR",
      "layer": "server",
      "items": [
        {
          "definition": "chunk",
          "short": "Registers an instrumentation listener.",
          "nodes": [
            "chunk"
          ],
          "step": {
            "step": "start-a-session-and-chunk"
          },
          "source": {
            "label": "tracing.ts:230-243",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
          }
        },
        {
          "definition": "calls",
          "short": "Calls append before events.",
          "nodes": [
            "calls"
          ],
          "step": {
            "step": "calls-add-trace-events"
          },
          "source": {
            "label": "tracing.ts:577-586",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L577-L586"
          }
        },
        {
          "definition": "network",
          "short": "Browser network resources are shared across chunks.",
          "nodes": [
            "network"
          ],
          "step": {
            "step": "network-resources-differ"
          },
          "source": {
            "label": "tracing.ts:208-219",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
          }
        },
        {
          "definition": "api",
          "short": "Each API chunk starts with an empty network file.",
          "nodes": [
            "api"
          ],
          "step": {
            "step": "network-resources-differ"
          },
          "source": {
            "label": "tracing.ts:208-219",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
          }
        },
        {
          "definition": "apiReset",
          "short": "A new API chunk starts with an empty network file.",
          "nodes": [
            "apiReset"
          ],
          "step": {
            "step": "network-resources-differ"
          },
          "source": {
            "label": "tracing.ts:208-219",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L208-L219"
          }
        }
      ]
    },
    {
      "label": "Page · selected capture",
      "layer": "page",
      "items": [
        {
          "definition": "dom",
          "short": "Only browser contexts receive a DOM snapshotter.",
          "nodes": [
            "dom"
          ],
          "step": {
            "step": "select-browser-capture"
          },
          "source": {
            "label": "tracing.ts:131-138",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L131-L138"
          }
        },
        {
          "definition": "screen",
          "short": "The screencast option starts screenshot capture.",
          "nodes": [
            "screen"
          ],
          "step": {
            "step": "select-browser-capture"
          },
          "source": {
            "label": "tracing.ts:230-243",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright-core/src/server/trace/recorder/tracing.ts#L230-L243"
          }
        }
      ]
    },
    {
      "label": "Runner · test tracing",
      "layer": "runner",
      "items": [
        {
          "definition": "mode",
          "short": "Retain-on-failure enables recording.",
          "nodes": [
            "mode"
          ],
          "step": {
            "step": "record-first-retain-later"
          },
          "source": {
            "label": "testTracing.ts:73-81",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
          }
        },
        {
          "definition": "steps",
          "short": "Non-internal test steps feed test tracing.",
          "nodes": [
            "steps"
          ],
          "step": {
            "step": "runner-tracing-includes-assertio"
          },
          "source": {
            "label": "testInfo.ts:391-402",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testInfo.ts#L391-L402"
          }
        },
        {
          "definition": "status",
          "short": "Retention compares actual and expected status.",
          "nodes": [
            "status"
          ],
          "step": {
            "step": "record-first-retain-later"
          },
          "source": {
            "label": "testTracing.ts:164-170",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L164-L170"
          }
        },
        {
          "definition": "retry",
          "short": "On-first-retry captures retry index one.",
          "nodes": [
            "retry"
          ],
          "step": {
            "step": "record-first-retain-later"
          },
          "source": {
            "label": "testTracing.ts:73-81",
            "url": "https://github.com/microsoft/playwright/blob/v1.65.0/packages/playwright/src/worker/testTracing.ts#L73-L81"
          }
        }
      ]
    }
  ],
  "callouts": {
    "1": [
      "start",
      "chunk",
      "save"
    ],
    "2": [
      "calls",
      "dom",
      "screen"
    ],
    "3": [
      "network",
      "api"
    ],
    "4": [
      "mode",
      "steps",
      "status",
      "retry"
    ]
  },
  "deeper": [
    {
      "title": "3.3 An API response lives only as long as its context",
      "href": "/3-network/3-3-api-requests/",
      "why": "API contexts and request resources."
    },
    {
      "title": "5.1 Each wait repeats a different piece of work",
      "href": "/5-expect/5-1-three-ways-to-wait/",
      "why": "Runner assertions and their waits."
    },
    {
      "title": "5.2 Merge replays saved events and ignores failed tests",
      "href": "/5-expect/5-2-reporters-and-merge/",
      "why": "Saved runner events and reporter replay."
    }
  ]
}
