# Local

Run Buddy Visual Tests from your local machine with the bdy CLI - environment setup, a Cypress example, and scriptless captures.

Sessions don't have to come from CI - you can create them from your machine while developing, using the same CLI and suite as your pipelines.

## Setup

1. Install the [`bdy` CLI](/docs/cli/getting-started.md) (requires Node.js v20+):

   ```bash
   npm i -g bdy
   ```

2. Set the suite token in your environment. Copy it from the [suite settings](/docs/tests/visual-tests/suite-settings.md):

   ```bash
   # Linux/macOS
   export BUDDY_VT_TOKEN=bud_vt_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

   # Windows
   setx BUDDY_VT_TOKEN bud_vt_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   ```

3. Install the discovery browser used to collect page resources after snapshots:

   ```bash
   bdy tests visual setup
   ```

## Example: running Cypress locally

With the [Cypress plugin configured](/docs/tests/visual-tests/e2e-frameworks/cypress.md) in your project, run your usual command through the CLI:

```bash
bdy tests visual session create "npx cypress run"
```

The command starts the plugin server, runs your tests, collects the snapshots taken with `cy.takeSnap()`, and creates a session in the suite. Open the suite in Buddy to review the results.

The same pattern works for every framework - only the wrapped command changes:

```bash
bdy tests visual session create "npx playwright test"   # Playwright
bdy tests visual session create "mvn test"              # Selenium (Java)
bdy tests visual session create "node test.js"          # Puppeteer / Selenium (JS)
```

## Scriptless captures from the CLI

You can also create sessions without any tests, straight from the terminal:

```bash
bdy tests capture --urls "https://example.com,https://example.com/about"
bdy tests capture --sitemap https://example.com/sitemap.xml --follow
```

See [Scriptless Testing](/docs/tests/visual-tests/scriptless-testing.md) for all capture options.


---
Original source: https://buddy.works/docs/tests/visual-tests/running-visual-tests/local