> ## 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.

# Testing Electron apps

> Test a desktop app built with Electron from a QA Wolf flow.

<Info>
  Electron flows use `@qawolf/flows/web`. The callback receives the first window as `page`, giving you the full Playwright API for interacting with the app.
</Info>

## Examples

**Launch and interact with an Electron app**

```typescript theme={null}
import { flow } from "@qawolf/flows/web";

export default flow(
  "Sign in to desktop app",
  {
    target: "Electron",
    launch: { executablePath: "/Applications/MyApp.app/Contents/MacOS/MyApp" },
  },
  async ({ page, test }) => {
    await test("sign in", async () => {
      await page.getByRole("button", { name: "Sign in" }).click();
    });
  },
);
```

**Choose the executable path at runtime**

Use explicit launch when the path depends on runtime logic — for example, switching between a stable and canary build.

```typescript theme={null}
import { flow, launch } from "@qawolf/flows/web";

export default flow("Sign in to desktop app", "Web - Chrome", async () => {
  const useCanary = process.env.USE_CANARY_APP === "true";

  const { firstWindowPage } = await launch({
    kind: "electron",
    executablePath: useCanary
      ? "/Applications/MyApp Canary.app/Contents/MacOS/MyApp"
      : "/Applications/MyApp.app/Contents/MacOS/MyApp",
  });

  await firstWindowPage.getByRole("button", { name: "Sign in" }).click();
});
```

## When to use

* Your app is a desktop application built with Electron.
* You need to test app startup, window behavior, or native OS integrations.
* Your flow needs to interact with the first Electron window before any navigation.
* You want to switch between builds — stable vs canary — at runtime.

## Notes

**Declarative vs explicit launch**

For most Electron flows, use the declarative style with `target: "Electron"` and `launch.executablePath`. The callback receives the first window as `page` automatically.

Use explicit `launch({ kind: "electron", executablePath })` only when the executable path depends on runtime logic. In this case, the first window is returned as `firstWindowPage` rather than injected as `page`.

For the full Electron launch shape, see the [Web API Reference](/qawolf/libraries/flows/api-reference/web).
