Skip to content

[Bug]: custom location of tracing.group API is not included in zip output #39302

@hi-ogawa

Description

@hi-ogawa

Version

1.58.2

Steps to reproduce

Reproduction is found in https://github.com/hi-ogawa/reproductions/tree/main/vitest-9652-playwright-trace-sources

  • repro.js
import { join } from "node:path";
import { chromium } from "playwright";

async function main() {
  console.log("Starting the browser...");
  const browser = await chromium.launch({});
  const context = await browser.newContext({});

  console.log("Starting tracing...");
  await context.tracing.start({ screenshots: true, snapshots: true, sources: true });

  console.log("Navigating to the page...");
  const page = await context.newPage();
  await page.goto("https://playwright.dev");

  await context.tracing.group("Test group", {
    location: {
      file: join(import.meta.dirname, "repro-dummy.js"),
      line: 1,
      column: 1,
    },
  });
  await page.getByText("Get Started").click();
  await context.tracing.groupEnd();

  console.log("Stopping tracing and saving to trace.zip...");
  await context.tracing.stop({ path: "trace.zip" });

  console.log("Closing the browser...");
  await browser.close();
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
  • repro-dummy.js
"dummy";
"file";
`content`;
  • Run repro.js to generate trace.zip
node repro.js
  • local show-trace shows repro-dummy.js source for tracing.group API
pnpm playwright show-trace trace.zip
Image Image

Expected behavior

Viewing trace.zip on https://trace.playwright.dev/ should display repro-dummy.js source.

Actual behavior

Viewing trace.zip on https://trace.playwright.dev/ doesn't display repro-dummy.js source.

Additional context

I'm planning to use tracing.group(... { location }) to improve trace view of Vitest playwright integration in vitest-dev/vitest#9652. I noticed the source is working only through playwright show-trace cli.

Environment

System:
    OS: Linux 6.18 Arch Linux
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
    Memory: 12.68 GB / 31.05 GB
    Container: Yes
  Binaries:
    Node: 25.6.0 - /home/hiroshi/.vite-plus/js_runtime/node/25.6.0/bin/node
    Yarn: 1.22.22 - /home/hiroshi/.vite-plus/bin/yarn
    npm: 11.8.0 - /home/hiroshi/.vite-plus/js_runtime/node/25.6.0/bin/npm
    pnpm: 10.29.3 - /home/hiroshi/.vite-plus/bin/pnpm
    bun: 1.3.9 - /home/hiroshi/.bun/bin/bun
    Deno: 2.6.6 - /home/hiroshi/.local/bin/deno
  IDEs:
    VSCode: 1.108.2 - /usr/bin/code
    Claude Code: 2.1.44 - /home/hiroshi/.local/bin/claude
    opencode: 1.2.6 - /home/hiroshi/.opencode/bin/opencode
  Languages:
    Bash: 5.3.9 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.58.2 => 1.58.2 
    playwright: ^1.58.2 => 1.58.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions