## Applitools Eyes SDK for Playwright

## Installation

### Install playwright
If you don't already have playwright installed, install with the following command. More info can be [found here](https://playwright.dev/docs/intro):

```bash
npm init playwright@latest
```

### Install the Eyes SDK

In your project directory, install the Applitools Eyes SDK for Playwright:

```bash
npm install -D @applitools/eyes-playwright
```

### Run the interactive CLI setup

To configure your project for Applitools Eyes, run the setup tool:

```bash
npx eyes-setup
``` 

The CLI will:

- Configure your project for Applitools Eyes.
- Attempt to modify imports where possible.
- Add configuration settings to your `playwright.config.ts` file.
- Add a demo test to help you get started.
    - You can run the demo test with `npx eyes-setup run-example`

_Note: In cases where imports cannot be modified automatically (e.g., when importing the `test` object from another npm package), you may need to adjust them manually. More details are provided in the [Integration with Playwright](https://applitools.com/tutorials/playwright/integration-with-playwright) section._


:::info
You may be prompted to enter your Eyes Server URL. If you are using the Applitools public cloud, your server URL will be `https://eyes.applitools.com`. If you're using a private deployment, enter your account's server URL instead.
:::

### Set your Applitools API key

When prompted by the CLI, enter your Applitools API key. If you don't have one, you can sign up for a free account and obtain your API key [from the Applitools Dashboard](https://applitools.com/tutorials/playwright/applitools-dashboard#accessing-the-applitools-dashboard).

Alternatively, you can set the API key as an environment variable:

```bash
export APPLITOOLS_API_KEY='your_api_key_here'
```

It's advisable to set your API key as an environment variable `APPLITOOLS_API_KEY` instead of hardcoding it in your configuration file. This approach keeps your API key secure since configuration files are often checked into version control systems.


## Further information

For further information, see:

### Playwright with Fixtures

* [Quickstart](https://applitools.com/tutorials/playwright)
* [Overview](https://applitools.com/tutorials/playwright/api/overview)
* [Changelog](https://applitools.com/tutorials/playwright/api/changelog)

### Playwright Standard

* [Quickstart](https://applitools.com/tutorials/sdks/playwright-ts-standard/quickstart)
* [Overview](https://applitools.com/tutorials/sdks/playwright-ts-standard)
* [Changelog](https://applitools.com/tutorials/sdks/playwright-ts-standard/changelog)	