If you don't already have playwright installed, install with the following command. More info can be found here:
npm init playwright@latest
In your project directory, install the Applitools Eyes SDK for Playwright:
npm install -D @applitools/eyes-playwright
To configure your project for Applitools Eyes, run the setup tool:
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
- You can run the demo test with
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 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.
:::
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.
Alternatively, you can set the API key as an environment variable:
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.
For further information, see: