Skip to content

Commit

Permalink
Revert "feat(tracing): add .pwtrace to trace file extension" (#32648)
Browse files Browse the repository at this point in the history
Reverts #32581
Relates
#32226 (comment)
  • Loading branch information
Skn0tt authored Sep 17, 2024
1 parent b23edf5 commit f6219e6
Show file tree
Hide file tree
Showing 21 changed files with 180 additions and 180 deletions.
40 changes: 20 additions & 20 deletions docs/src/api/class-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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');
await context.tracing.stop({ path: 'trace.pwtrace.zip' });
await context.tracing.stop({ path: 'trace.zip' });
```

```java
Expand All @@ -23,7 +23,7 @@ context.tracing().start(new Tracing.StartOptions()
Page page = context.newPage();
page.navigate("https://playwright.dev");
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.pwtrace.zip")));
.setPath(Paths.get("trace.zip")));
```

```python async
Expand All @@ -32,7 +32,7 @@ context = await browser.new_context()
await context.tracing.start(screenshots=True, snapshots=True)
page = await context.new_page()
await page.goto("https://playwright.dev")
await context.tracing.stop(path = "trace.pwtrace.zip")
await context.tracing.stop(path = "trace.zip")
```

```python sync
Expand All @@ -41,7 +41,7 @@ context = browser.new_context()
context.tracing.start(screenshots=True, snapshots=True)
page = context.new_page()
page.goto("https://playwright.dev")
context.tracing.stop(path = "trace.pwtrace.zip")
context.tracing.stop(path = "trace.zip")
```

```csharp
Expand All @@ -57,7 +57,7 @@ var page = await context.NewPageAsync();
await page.GotoAsync("https://playwright.dev");
await context.Tracing.StopAsync(new()
{
Path = "trace.pwtrace.zip"
Path = "trace.zip"
});
```

Expand All @@ -72,7 +72,7 @@ Start tracing.
await context.tracing.start({ screenshots: true, snapshots: true });
const page = await context.newPage();
await page.goto('https://playwright.dev');
await context.tracing.stop({ path: 'trace.pwtrace.zip' });
await context.tracing.stop({ path: 'trace.zip' });
```

```java
Expand All @@ -82,21 +82,21 @@ context.tracing().start(new Tracing.StartOptions()
Page page = context.newPage();
page.navigate("https://playwright.dev");
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.pwtrace.zip")));
.setPath(Paths.get("trace.zip")));
```

```python async
await context.tracing.start(screenshots=True, snapshots=True)
page = await context.new_page()
await page.goto("https://playwright.dev")
await context.tracing.stop(path = "trace.pwtrace.zip")
await context.tracing.stop(path = "trace.zip")
```

```python sync
context.tracing.start(screenshots=True, snapshots=True)
page = context.new_page()
page.goto("https://playwright.dev")
context.tracing.stop(path = "trace.pwtrace.zip")
context.tracing.stop(path = "trace.zip")
```

```csharp
Expand All @@ -112,7 +112,7 @@ var page = await context.NewPageAsync();
await page.GotoAsync("https://playwright.dev");
await context.Tracing.StopAsync(new()
{
Path = "trace.pwtrace.zip"
Path = "trace.zip"
});
```

Expand Down Expand Up @@ -177,12 +177,12 @@ await page.goto('https://playwright.dev');
await context.tracing.startChunk();
await page.getByText('Get Started').click();
// Everything between startChunk and stopChunk will be recorded in the trace.
await context.tracing.stopChunk({ path: 'trace1.pwtrace.zip' });
await context.tracing.stopChunk({ path: 'trace1.zip' });

await context.tracing.startChunk();
await page.goto('http://example.com');
// Save a second trace file with different actions.
await context.tracing.stopChunk({ path: 'trace2.pwtrace.zip' });
await context.tracing.stopChunk({ path: 'trace2.zip' });
```

```java
Expand All @@ -196,13 +196,13 @@ context.tracing().startChunk();
page.getByText("Get Started").click();
// Everything between startChunk and stopChunk will be recorded in the trace.
context.tracing().stopChunk(new Tracing.StopChunkOptions()
.setPath(Paths.get("trace1.pwtrace.zip")));
.setPath(Paths.get("trace1.zip")));

context.tracing().startChunk();
page.navigate("http://example.com");
// Save a second trace file with different actions.
context.tracing().stopChunk(new Tracing.StopChunkOptions()
.setPath(Paths.get("trace2.pwtrace.zip")));
.setPath(Paths.get("trace2.zip")));
```

```python async
Expand All @@ -213,12 +213,12 @@ await page.goto("https://playwright.dev")
await context.tracing.start_chunk()
await page.get_by_text("Get Started").click()
# Everything between start_chunk and stop_chunk will be recorded in the trace.
await context.tracing.stop_chunk(path = "trace1.pwtrace.zip")
await context.tracing.stop_chunk(path = "trace1.zip")

await context.tracing.start_chunk()
await page.goto("http://example.com")
# Save a second trace file with different actions.
await context.tracing.stop_chunk(path = "trace2.pwtrace.zip")
await context.tracing.stop_chunk(path = "trace2.zip")
```

```python sync
Expand All @@ -229,12 +229,12 @@ page.goto("https://playwright.dev")
context.tracing.start_chunk()
page.get_by_text("Get Started").click()
# Everything between start_chunk and stop_chunk will be recorded in the trace.
context.tracing.stop_chunk(path = "trace1.pwtrace.zip")
context.tracing.stop_chunk(path = "trace1.zip")

context.tracing.start_chunk()
page.goto("http://example.com")
# Save a second trace file with different actions.
context.tracing.stop_chunk(path = "trace2.pwtrace.zip")
context.tracing.stop_chunk(path = "trace2.zip")
```

```csharp
Expand All @@ -254,15 +254,15 @@ await page.GetByText("Get Started").ClickAsync();
// Everything between StartChunkAsync and StopChunkAsync will be recorded in the trace.
await context.Tracing.StopChunkAsync(new()
{
Path = "trace1.pwtrace.zip"
Path = "trace1.zip"
});

await context.Tracing.StartChunkAsync();
await page.GotoAsync("http://example.com");
// Save a second trace file with different actions.
await context.Tracing.StopChunkAsync(new()
{
Path = "trace2.pwtrace.zip"
Path = "trace2.zip"
});
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/test-global-setup-teardown-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ async function globalSetup(config: FullConfig) {
await page.getByText('Sign in').click();
await context.storageState({ path: storageState as string });
await context.tracing.stop({
path: './test-results/setup-trace.pwtrace.zip',
path: './test-results/setup-trace.zip',
});
await browser.close();
} catch (error) {
await context.tracing.stop({
path: './test-results/failed-setup-trace.pwtrace.zip',
path: './test-results/failed-setup-trace.zip',
});
await browser.close();
throw error;
Expand Down
14 changes: 7 additions & 7 deletions docs/src/trace-viewer-intro-java-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Options for tracing are:
- `off`: Do not record trace. (default)
- `retain-on-failure`: Record trace for each test, but remove all traces from successful test runs.

This will record the trace and place it into the file named `trace.pwtrace.zip` in your `test-results` directory.
This will record the trace and place it into the file named `trace.zip` in your `test-results` directory.

<details>
<summary>If you are not using Pytest, click here to learn how to record traces.</summary>
Expand All @@ -41,7 +41,7 @@ page = await context.new_page()
await page.goto("https://playwright.dev")

# Stop tracing and export it into a zip archive.
await context.tracing.stop(path = "trace.pwtrace.zip")
await context.tracing.stop(path = "trace.zip")
```

```python sync
Expand All @@ -55,7 +55,7 @@ page = context.new_page()
page.goto("https://playwright.dev")

# Stop tracing and export it into a zip archive.
context.tracing.stop(path = "trace.pwtrace.zip")
context.tracing.stop(path = "trace.zip")
```

</details>
Expand All @@ -80,22 +80,22 @@ page.navigate("https://playwright.dev");

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.pwtrace.zip")));
.setPath(Paths.get("trace.zip")));
```


This will record the trace and place it into the file named `trace.pwtrace.zip`.
This will record the trace and place it into the file named `trace.zip`.

## Opening the trace

You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your trace's zip file is located. Once opened you can click on each action or use the timeline to see the state of the page before and after each action. You can also inspect the log, source and network during each step of the test. The trace viewer creates a DOM snapshot so you can fully interact with it, open devtools etc.

```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.pwtrace.zip"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
```

```bash python
playwright show-trace trace.pwtrace.zip
playwright show-trace trace.zip
```

######
Expand Down
2 changes: 1 addition & 1 deletion docs/src/trace-viewer-intro-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Playwright Trace Viewer is a GUI tool that lets you explore recorded Playwright

## Recording a Trace

By default the [playwright.config](./trace-viewer.md#recording-a-trace-on-ci) file will contain the configuration needed to create a `trace.pwtrace.zip` file for each test. Traces are setup to run `on-first-retry` meaning they will be run on the first retry of a failed test. Also `retries` are set to 2 when running on CI and 0 locally. This means the traces will be recorded on the first retry of a failed test but not on the first run and not on the second retry.
By default the [playwright.config](./trace-viewer.md#recording-a-trace-on-ci) file will contain the configuration needed to create a `trace.zip` file for each test. Traces are setup to run `on-first-retry` meaning they will be run on the first retry of a failed test. Also `retries` are set to 2 when running on CI and 0 locally. This means the traces will be recorded on the first retry of a failed test but not on the first run and not on the second retry.

```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';
Expand Down
32 changes: 16 additions & 16 deletions docs/src/trace-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ npx playwright show-report
* langs: js

Traces should be run on continuous integration on the first retry of a failed test
by setting the `trace: 'on-first-retry'` option in the test configuration file. This will produce a `trace.pwtrace.zip` file for each test that was retried.
by setting the `trace: 'on-first-retry'` option in the test configuration file. This will produce a `trace.zip` file for each test that was retried.

```js tab=js-test title="playwright.config.ts"
import { defineConfig } from '@playwright/test';
Expand All @@ -155,7 +155,7 @@ const page = await context.newPage();
await page.goto('https://playwright.dev');

// Stop tracing and export it into a zip archive.
await context.tracing.stop({ path: 'trace.pwtrace.zip' });
await context.tracing.stop({ path: 'trace.zip' });
```

Available options to record a trace:
Expand Down Expand Up @@ -185,7 +185,7 @@ Options for tracing are:
- `off`: Do not record trace. (default)
- `retain-on-failure`: Record trace for each test, but remove all traces from successful test runs.

This will record the trace and place it into the file named `trace.pwtrace.zip` in your `test-results` directory.
This will record the trace and place it into the file named `trace.zip` in your `test-results` directory.

<details>
<summary>If you are not using Pytest, click here to learn how to record traces.</summary>
Expand All @@ -201,7 +201,7 @@ page = await context.new_page()
await page.goto("https://playwright.dev")

# Stop tracing and export it into a zip archive.
await context.tracing.stop(path = "trace.pwtrace.zip")
await context.tracing.stop(path = "trace.zip")
```

```python sync
Expand All @@ -215,7 +215,7 @@ page = context.new_page()
page.goto("https://playwright.dev")

# Stop tracing and export it into a zip archive.
context.tracing.stop(path = "trace.pwtrace.zip")
context.tracing.stop(path = "trace.zip")
```

</details>
Expand All @@ -240,10 +240,10 @@ page.navigate("https://playwright.dev");

// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.pwtracezip")));
.setPath(Paths.get("trace.zip")));
```

This will record the trace and place it into the file named `trace.pwtrace.zip`.
This will record the trace and place it into the file named `trace.zip`.

## Recording a trace
* langs: csharp
Expand Down Expand Up @@ -466,22 +466,22 @@ public class ExampleTest : PageTest

## Opening the trace

You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.pwtrace.zip` file is located.
You can open the saved trace using the Playwright CLI or in your browser on [`trace.playwright.dev`](https://trace.playwright.dev). Make sure to add the full path to where your `trace.zip` file is located.

```bash js
npx playwright show-trace path/to/trace.pwtrace.zip
npx playwright show-trace path/to/trace.zip
```

```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.pwtrace.zip"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
```

```bash python
playwright show-trace trace.pwtrace.zip
playwright show-trace trace.zip
```

```bash csharp
pwsh bin/Debug/netX/playwright.ps1 show-trace trace.pwtrace.zip
pwsh bin/Debug/netX/playwright.ps1 show-trace trace.zip
```

## Using [trace.playwright.dev](https://trace.playwright.dev)
Expand All @@ -496,19 +496,19 @@ pwsh bin/Debug/netX/playwright.ps1 show-trace trace.pwtrace.zip
You can open remote traces using its URL. They could be generated on a CI run which makes it easy to view the remote trace without having to manually download the file.

```bash js
npx playwright show-trace https://example.com/trace.pwtrace.zip
npx playwright show-trace https://example.com/trace.zip
```

```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace https://example.com/trace.pwtrace.zip"
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace https://example.com/trace.zip"
```

```bash python
playwright show-trace https://example.com/trace.pwtrace.zip
playwright show-trace https://example.com/trace.zip
```

```bash csharp
pwsh bin/Debug/netX/playwright.ps1 show-trace https://example.com/trace.pwtrace.zip
pwsh bin/Debug/netX/playwright.ps1 show-trace https://example.com/trace.zip
```


Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/cli/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ program
}).addHelpText('afterAll', `
Examples:
$ show-trace https://example.com/trace.pwtrace.zip`);
$ show-trace https://example.com/trace.zip`);

type Options = {
browser: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps

this._fs.copyFile(this._state.networkFile, newNetworkFile);

const zipFileName = this._state.traceFile + '.pwtrace.zip';
const zipFileName = this._state.traceFile + '.zip';
if (params.mode === 'archive')
this._fs.zip(entries, zipFileName);

Expand Down
Loading

0 comments on commit f6219e6

Please sign in to comment.