> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/guides/ci-optimization/playwright-orchestration/playwright-orchestration-migration-guide.md).

# Migration Guide

{% hint style="info" %}
This guide is for migrating Currents Orchestration from `v1` to `v2` . If you are not using Currents Orchestration see [Compatibility Guide](/resources/reporters/currents-playwright/compatibility.md)&#x20;
{% endhint %}

## What Has Changed?

`v2` of Currents Orchestration requires running two separate commands:

* `pwc-p discover` — runs Playwright in discovery mode and writes the list of tests to be orchestrated to a file.
* `pwc-p run` — initiates the orchestrated execution based on the previous step, using the list of tests as an input.

That's different from `v1` that was using a single command for discovery and execution.&#x20;

The migration involves:

* Adding `pwc-p discover`  step
* Using `pwc-p run` command

## Migration Steps

{% stepper %}
{% step %}

### Update `@currents/playwright` to 2.0.0+

{% code overflow="wrap" lineNumbers="true" %}

```
npm i @currents/playwright@^2
```

{% endcode %}
{% endstep %}

{% step %}

### Use `pwc-p discover` command

* Run  `pwc-p discover` to create a discovery file with tests selected for orchestration, you can apply the same filters and CLI arguments as for `playwright` command.
* Run `pwc-p run` with `--pwc-discovery-file` to execute the orchestration. Run `pwc-p run --help`  to see the available flags or refer to [@currents/playwright](/resources/reporters/currents-playwright.md).

{% code overflow="wrap" lineNumbers="true" %}

```bash
npx pwc-p discover --pwc-discovery-file discovery-path [...filters]
npx pwc-p run --pwc-discovery-file discovery-path --key currents-record-key --project-id currents-project-id --ci-build-id ci-build-id
```

{% endcode %}
{% endstep %}

{% step %}

### Replace `pwc-p` with `pwc-p run`

Update your CI configuration to use `pwc-p run` instead of `pwc-p`

{% code overflow="wrap" %}

```bash
# Before
npx pwc-p --key record-key --project-id project-id --ci-build-id ci-build-id

# After
npx pwc-p run --pwc-discovery-file discovery-path --key record-key --project-id project-id --ci-build-id ci-build-id
```

{% endcode %}
{% endstep %}
{% endstepper %}

## When to use `discover`

`pwc-p discover` is required when you want to explicitly select tests for orchestration — for example:

* Filtering tests by tag:  `--grep / -g @smoke`
* Filtering tests by last run outcome:  `--last-failed`  (see [#re-running-only-failed-tests](#re-running-only-failed-tests "mention"))
* Filtering tests by Playwright project: `--project chromium`
* Explicit spec file location: `playwright test <spec-file-path>`

Apply the desired arguments and parameters as if you are running `playwright` command, for example:

{% code overflow="wrap" lineNumbers="true" %}

```sh
# Create discovery file with filters applied
npx pwc-p discover --pwc-discovery-file ./test-list --grep @smoke --project chromium

# Use the discovery file as an input for orchestration
npx pwc-p run --pwc-discovery-file ./test-list --key currents-record-key --project-id currents-project-id --ci-build-id ci-build-id
```

{% endcode %}

Omitting discovery stage selects **all** tests for orchestration.

| Scenario                           | Commands                                        |
| ---------------------------------- | ----------------------------------------------- |
| Run the full suite (no filters)    | `pwc-p run ...`                                 |
| Filter tests with Playwright flags | first `pwc-p discover ...` then `pwc-p run ...` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.currents.dev/guides/ci-optimization/playwright-orchestration/playwright-orchestration-migration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
