playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: trace stop_chunk. the network in chunk includes the network data from the previous chunk

Open bingosam opened this issue 1 year ago • 1 comments
trafficstars

Version

1.43.0

Steps to reproduce

with sync_playwright() as playwright:
    browser = playwright.chromium.launch(channel="chrome")
    context = browser.new_context()
    context.tracing.start(name='trace')

    context.tracing.start_chunk(name='trace', title='case1')
    page = context.new_page()
    page.goto('url of case 1')
    context.tracing.stop_chunk(path='case1.zip')

    context.tracing.start_chunk(name='trace', title='case2')
    page = context.new_page()
    page.goto('url of case 2')
    context.tracing.stop_chunk(path='case2.zip')

Expected behavior

The network data in case2.zip should not include the network data from case1.zip

Actual behavior

The network data in case2.zip include the network data from case1.zip.

Additional context

No response

Environment

- Operating System: [Windows 11]
- Browser: [Chrome]
- Python Version: [3.9.16]

bingosam avatar Apr 28 '24 06:04 bingosam

Was able to reproduce it with

import { chromium } from '@playwright/test';

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  await context.tracing.start({ name: 'trace', snapshots: true });

  await context.tracing.startChunk();
  let page = await context.newPage();
  await page.goto('https://www.microsoft.com/pt-pt/');
  await context.tracing.stopChunk({ path: 'case1.zip' });

  await context.tracing.startChunk();
  page = await context.newPage();
  await page.goto('https://example.com');
  await context.tracing.stopChunk({ path: 'case2.zip' });

  await browser.close();
})();

Looks like this is working as intended: https://github.com/microsoft/playwright/blob/3b7c4fac22b60a58e410ec823e48b7b469c84d7a/packages/playwright-core/src/server/trace/recorder/tracing.ts#L287

Moving upstream.

mxschmitt avatar Apr 29 '24 10:04 mxschmitt

Why was this issue closed?

Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.

Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.

pavelfeldman avatar Aug 16 '24 00:08 pavelfeldman