# pwc-p (orchestration)

`pwc-p` is a command-line executable that implements Currents Orchestration for Playwright. See [Orchestration Setup](/guides/ci-optimization/playwright-orchestration.md) and [Playwright Parallelization](/guides/ci-optimization/playwright-parallelization.md) for detailed guides.

{% hint style="info" %}
**Orchestration** is a two-step process: first run `pwc-p discover` to build a test list, then run `pwc-p run` to execute tests in parallel with load balancing.
{% endhint %}

## Subcommands

* [**`pwc-p discover`**](/resources/reporters/currents-playwright/pwc-p/pwc-p-discover.md) — Runs Playwright test discovery and writes the test list to a file. Accepts Playwright filter flags (`--grep`, `--last-failed`, `--project`, spec paths, and similar).
* [**`pwc-p run`**](/resources/reporters/currents-playwright/pwc-p/pwc-p-run.md) — Starts orchestration and executes tests with load balancing. Accepts [Configuration](/resources/reporters/currents-playwright/configuration.md) options and supported Playwright runtime flags (`-j`, `--timeout`, and similar).

Both commands accept Currents configuration via CLI flags or `currents.config.ts`. See [Configuration](/resources/reporters/currents-playwright/configuration.md#configuration-sources) for recommended setup.

## Basic Workflow

**Full suite (no filters):**

```bash
npx pwc-p run --key <record-key> --project-id <project-id> --ci-build-id <ci-build-id>
```

**Filtered tests (with discovery):**

```bash
# Step 1: Discover tests with optional filters
npx pwc-p discover --pwc-discovery-file tests.txt --grep @smoke

# Step 2: Run orchestrated execution using the discovery file
npx pwc-p run \
  --key <record-key> \
  --project-id <project-id> \
  --ci-build-id <ci-build-id> \
  --pwc-discovery-file tests.txt
```

Or use environment variables to avoid repeating the discovery file path:

```bash
export CURRENTS_DISCOVERY_FILE=tests.txt
npx pwc-p discover --grep @smoke
npx pwc-p run --key <record-key> --project-id <project-id> --ci-build-id <ci-build-id>
```

**Reference:**

* [pwc-p discover](/resources/reporters/currents-playwright/pwc-p/pwc-p-discover.md) — test discovery and filtering options
* [pwc-p run](/resources/reporters/currents-playwright/pwc-p/pwc-p-run.md) — orchestration execution and runtime options


---

# Agent Instructions: 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/resources/reporters/currents-playwright/pwc-p.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.
