diff --git a/dotnet/docs/api/class-tracing.mdx b/dotnet/docs/api/class-tracing.mdx index 851cd0886b6..da363d22ed2 100644 --- a/dotnet/docs/api/class-tracing.mdx +++ b/dotnet/docs/api/class-tracing.mdx @@ -9,6 +9,13 @@ import HTMLCard from '@site/src/components/HTMLCard'; API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.mdx) after Playwright script runs. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `context.tracing`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + Start recording a trace before performing actions. At the end, stop tracing and save it to a file. ```csharp @@ -100,6 +107,13 @@ await Tracing.GroupEndAsync(); Start tracing. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `Tracing.start`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + **Usage** ```csharp diff --git a/java/docs/api/class-tracing.mdx b/java/docs/api/class-tracing.mdx index e72078a3999..844c09f1ca9 100644 --- a/java/docs/api/class-tracing.mdx +++ b/java/docs/api/class-tracing.mdx @@ -9,6 +9,13 @@ import HTMLCard from '@site/src/components/HTMLCard'; API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.mdx) after Playwright script runs. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `context.tracing`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + Start recording a trace before performing actions. At the end, stop tracing and save it to a file. ```java @@ -95,6 +102,13 @@ Tracing.groupEnd(); Start tracing. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `Tracing.start`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + **Usage** ```java diff --git a/nodejs/docs/api/class-tracing.mdx b/nodejs/docs/api/class-tracing.mdx index 1e86a6162a0..45ace077818 100644 --- a/nodejs/docs/api/class-tracing.mdx +++ b/nodejs/docs/api/class-tracing.mdx @@ -9,6 +9,13 @@ import HTMLCard from '@site/src/components/HTMLCard'; API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.mdx) after Playwright script runs. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `context.tracing`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + Start recording a trace before performing actions. At the end, stop tracing and save it to a file. ```js @@ -17,6 +24,7 @@ const context = await browser.newContext(); await context.tracing.start({ screenshots: true, snapshots: true }); const page = await context.newPage(); await page.goto('https://playwright.dev'); +expect(page.url()).toBe('https://playwright.dev'); await context.tracing.stop({ path: 'trace.zip' }); ``` @@ -90,12 +98,20 @@ await tracing.groupEnd(); Start tracing. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `Tracing.start`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + **Usage** ```js await context.tracing.start({ screenshots: true, snapshots: true }); const page = await context.newPage(); await page.goto('https://playwright.dev'); +expect(page.url()).toBe('https://playwright.dev'); await context.tracing.stop({ path: 'trace.zip' }); ``` diff --git a/python/docs/api/class-tracing.mdx b/python/docs/api/class-tracing.mdx index 22cdaa9cbf8..e81235ccc09 100644 --- a/python/docs/api/class-tracing.mdx +++ b/python/docs/api/class-tracing.mdx @@ -9,6 +9,13 @@ import HTMLCard from '@site/src/components/HTMLCard'; API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.mdx) after Playwright script runs. +:::note + +You probably want to [enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead of using `context.tracing`. + +The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions (like `expect` calls). We recommend [enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace), which includes those assertions and provides a more complete trace for debugging test failures. +::: + Start recording a trace before performing actions. At the end, stop tracing and save it to a file.