Quickstart Guide
Get up and running with Chekov in minutes. This guide will walk you through creating your first AI-powered test.
Prerequisites
Before you begin, make sure you have:
- Node.js 16.x or later installed
- A package manager (npm, yarn, or pnpm)
- A Chekov API key
Installation
First, install the required dependencies:
1# Using npm2npm install -D @playwright/test @chekov/core34# Or using yarn5yarn add -D @playwright/test @chekov/core67# Or using pnpm8pnpm add -D @playwright/test @chekov/core
Project Setup
Create a new Playwright configuration file:
1// playwright.config.ts2import { defineConfig, devices } from '@playwright/test';34export default defineConfig({5testDir: './tests',6use: {7baseURL: 'http://localhost:3000',8},9projects: [10{11name: 'chromium',12use: { ...devices['Desktop Chrome'] },13},14],15});
Writing Your First Test
Create a new test file in the tests directory:
1// tests/login.spec.ts2import { test } from '@playwright/test';3import { ai } from '@chekov/core';45test('login flow', async ({ page }) => {6// Navigate to the login page7await page.goto('/login');89// Use AI to interact with the page10await ai([11'Type "test@example.com" in the email field',12'Type "password123" in the password field',13'Click the Login button'14], { page });1516// Verify successful login17await ai('Verify we are redirected to the dashboard', { page });18});
Running Tests
Run your tests using the Playwright CLI:
1# Run all tests2npx playwright test34# Run a specific test file5npx playwright test login.spec.ts67# Run tests in UI mode8npx playwright test --ui
Advanced Features
Parallel Actions
Optimize test execution by running independent actions in parallel:
1test('parallel actions', async ({ page }) => {2await page.goto('/dashboard');34// Run multiple verifications in parallel5await ai([6'Verify the user profile is loaded',7'Verify the sidebar menu is visible',8'Verify the notifications are present'9], {10page,11parallelism: 3 // Run all checks simultaneously12});13});
Custom Assertions
Combine AI actions with Playwright's built-in assertions:
1test('custom assertions', async ({ page }) => {2await page.goto('/profile');34// Use AI to interact with the page5await ai('Click the Edit Profile button', { page });67// Mix with Playwright assertions8await expect(page.locator('input[name="email"]')).toBeVisible();910// Continue with AI actions11await ai('Update the profile picture', { page });12});
Best Practices
- Use clear, descriptive instructions for AI actions
- Group related actions for better organization
- Leverage parallelism for independent actions
- Include explicit verification steps
