> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qawolf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pass data between flows

> Share authentication tokens, user IDs, and other values across flows in a coordinated run.

<Info>
  Flows that pass data between each other are called **Hopper Flows** in QA Wolf — the pattern for multi-user, multi-device, and multi-platform test scenarios.
</Info>

## Examples

**Create a user, then log in as that user**

A common pattern: one flow creates a user and publishes credentials; a second flow logs in using those credentials.

```typescript theme={null}
// Flow 1: Create user (producer)
await page.goto("https://app.example.com/admin/users/new");
await page.fill('[name="email"]', "testuser@example.com");
await page.fill('[name="password"]', "hunter2");
await page.click('[type="submit"]');

setOutput("USER_EMAIL", "testuser@example.com", "USER_PASSWORD", "hunter2");
```

```typescript theme={null}
// Flow 2: Log in (consumer)
const email = inputs["USER_EMAIL"];
const password = inputs["USER_PASSWORD"];

await page.goto("https://app.example.com/login");
await page.fill('[name="email"]', email);
await page.fill('[name="password"]', password);
await page.click('[type="submit"]');
```

**Create a user, log in, then verify activity**

Extend the chain: a third flow consumes the session token published by the login flow to verify downstream activity.

```typescript theme={null}
// Flow 1: Create user (producer)
setOutput("USER_EMAIL", "testuser@example.com", "USER_PASSWORD", "hunter2");
```

```typescript theme={null}
// Flow 2: Log in (producer + consumer)
const email = inputs["USER_EMAIL"];
const password = inputs["USER_PASSWORD"];

// ... log in ...
const token = await page.evaluate(() => localStorage.getItem("auth_token"));
setOutput("AUTH_TOKEN", token);
```

```typescript theme={null}
// Flow 3: Verify activity (consumer)
const token = inputs["AUTH_TOKEN"];

await page.setExtraHTTPHeaders({ Authorization: `Bearer ${token}` });
await page.goto("https://app.example.com/activity");
// ... assert expected activity ...
```

## When to use

* Your app has multi-step workflows that span separate user sessions.
* Your test requires one user to create a resource another user acts on.
* Your scenario involves multiple devices or platforms in a single run.
* Your flow needs data that only exists after another flow has run.
* Your test validates coordination between concurrent users or roles.

## Notes

**Key naming** — Keys are uppercase by convention: `AUTH_TOKEN`, `USER_EMAIL`, `USER_PASSWORD`.

**Overwrites** — If the same flow calls `setOutput` multiple times, the last call wins for that key.

**Conflicts** — If two different flows publish the same key and a third flow depends on both, the run fails with `Workflow run failed due to conflicting dependency outputs`.

**Execution order** — A consumer will not run until its producer has published. Use [Run Rules](/qawolf/Ordering-flows-29c5b2a994fb80789f3fea32feae8f92-copied-1) to enforce producer-before-consumer ordering.

**Scheduling** — Producers and consumers must be included in the same scheduled run. Target all flows or use a shared tag. See [Scheduling flows](/qawolf/Scheduling-flows-29c5b2a994fb80789f3fea32feae8f92).
