@qa.gary.parker/aiwright
v0.1.0
Published
AI-powered test automation for Playwright using natural language
Maintainers
Readme
Aiwright (TypeScript)
AI-powered test automation for Playwright using natural language.
Installation
npm install aiwright
# or
yarn add aiwright
# or
pnpm add aiwrightQuick Start
import { test } from '@playwright/test';
import { ai } from 'aiwright';
test('login flow', async ({ page }) => {
await page.goto('https://example.com/login');
await ai(page, 'Enter "[email protected]" in the email field');
await ai(page, 'Enter "password123" in the password field');
await ai(page, 'Click the login button');
const welcomeText = await ai(page, 'Get the welcome message text');
console.log(welcomeText.value);
});AI-First Architecture
Aiwright uses intelligent execution with AI planning, analysis, and adaptive retry:
- AI Plans every action with primary + alternative strategies
- AI Analyzes failures and adjusts approach automatically
- No Hardcoded Fallbacks - AI adapts to any page structure
- Self-Healing Tests - Automatically recovers from failures
// Traditional (brittle)
await page.locator('button[data-testid="submit"]').click();
// Aiwright (adaptive)
await ai(page, 'Click the submit button');
// AI automatically plans, retries, and adaptsOverride Options
Guide AI or use explicit selectors when needed:
// Explicit selector (skip AI)
await ai(page, 'Click submit', {
selector: '#submit',
skipAi: true
});
// Hints to guide AI
await ai(page, 'Click save button', {
hints: {
location: 'in the toolbar',
context: 'next to cancel button'
}
});Configuration
Set your AI provider API key:
export AIWRIGHT_PROVIDER=openai
export OPENAI_API_KEY=sk-...Or programmatically:
import { configure } from 'aiwright';
configure({
provider: 'openai',
openai: {
apiKey: 'sk-...',
model: 'gpt-4-turbo-preview',
},
debug: true,
maxRetries: 3,
});Documentation
- Main Repository
- Getting Started
- AI-First Core Architecture
- Intelligent Caching
- Shadow DOM Support
- IFrame Support
- Override Options Guide
- Configuration Guide
- Examples
License
MIT
