Installation

Get started with Chekov by following these simple installation steps.

Prerequisites

  • Node.js 16.x or later
  • npm, yarn, or pnpm package manager
  • Playwright Test installed in your project

Installing Chekov

You can install Chekov using your preferred package manager:

Using npm

1
npm install -D @chekov/core

Using yarn

1
yarn add -D @chekov/core

Using pnpm

1
pnpm add -D @chekov/core

Project Setup

After installing Chekov, you'll need to configure your Playwright test files to use it. Here's a basic setup:

1
// playwright.config.ts
2
import { defineConfig, devices } from '@playwright/test';
3
4
export default defineConfig({
5
testDir: './tests',
6
use: {
7
baseURL: 'http://localhost:3000',
8
},
9
projects: [
10
{
11
name: 'chromium',
12
use: { ...devices['Desktop Chrome'] },
13
},
14
],
15
});

Create your first test file:

1
// tests/example.spec.ts
2
import { test } from '@playwright/test';
3
import { ai } from '@chekov/core';
4
5
test('my first test', async ({ page }) => {
6
await page.goto('/');
7
await ai('Click the login button', { page });
8
await ai('Type "test@example.com" in the email field', { page });
9
});

Configuration Options

Chekov can be configured with various options to customize its behavior:

1
// chekov.config.ts
2
import { defineConfig } from '@chekov/core';
3
4
export default defineConfig({
5
// Maximum time to wait for an action to complete
6
timeout: 5000,
7
8
// Number of retry attempts for failed actions
9
retries: 3,
10
11
// Custom error messages
12
errorMessages: {
13
elementNotFound: 'Could not find the specified element',
14
actionFailed: 'The requested action could not be completed',
15
},
16
17
// Logging options
18
logging: {
19
level: 'info',
20
silent: false,
21
},
22
});

Environment Setup

For optimal performance, consider setting these environment variables:

1
# .env
2
CHEKOV_API_KEY=your_api_key_here
3
CHEKOV_TIMEOUT=5000
4
CHEKOV_RETRY_COUNT=3

Important Notes

  • Always keep your API key secure and never commit it to version control
  • Consider using different timeouts for development and CI environments
  • Adjust retry counts based on your application's stability

Next Steps