# Installation & Setup

## Install Donobu and configure Playwright to start writing AI-powered tests.

## Prerequisites

- **Node.js** 20 or later
- **@playwright/test** ^1.50 (installed alongside Donobu as a peer dependency)

## Install

```bash
npm install --save-dev donobu @playwright/test
```

Then download Playwright's browser binaries:

```bash
npx playwright install
```

note

Donobu uses Chromium by default. If you only need Chromium, you can save disk space with `npx playwright install chromium`.

## Configure `playwright.config.ts`

A minimal configuration that works well with Donobu:

```ts
import { defineConfig, devices } from 'donobu';

export default defineConfig({
  testDir: './tests',
  projects: [\
    {\
      name: 'chromium',\
      use: { ...devices['Desktop Chromium'] },\
    },\
  ],
  timeout: 180_000, // AI-driven flows can take time — 3 minutes is a safe default
  use: {
    baseURL: 'http://localhost:3000',
    screenshot: 'on', // Capture screenshots for every test (used in reports and self-healing)
    video: 'on', // Capture video for every test
  },
  reporter: [\
    ['list', { printSteps: true }],\
    ['json', { outputFile: 'test-results/playwright-report.json' }],\
  ],
});
```

### Why 180 seconds?

A single `page.ai()` call may invoke many browser actions (clicks, inputs, navigation, scrolls) in sequence. Setting the timeout too low causes tests to time out during legitimate first runs before the result is cached.

## Module systems

Donobu ships both ESM and CommonJS builds. Use whichever your project requires — no extra configuration is needed.

**ESM (`package.json` with "type": "module"):**

```ts
import { expect, test } from 'donobu';
```

**CommonJS:**

```js
const { test, expect } = require('donobu');
```

## Verify the installation

Create a file `tests/smoke.test.ts`:

```ts
import { expect, test } from 'donobu';

test('donobu is installed', async ({ page }) => {
  expect(page.ai).toBeDefined();
});
```

Run it:

```bash
npx donobu test tests/smoke.test.ts
```

A passing test confirms the installation is working. See [Quick Start](/content/docs/playwright/quick-start/index.html) for a first real test.
