tests-ai
v1.0.10
Published
Write tests in natural language. No more brittle selectors.
Readme
tests-ai
Use Anthropic's Computer use API inside playwright tests.
import { test } from "@playwright/test";
import { ai } from "tests-ai";
test("click on counter button", async ({ page }) => {
await page.goto("/");
await ai("click on the counter button and verify that the count goes up", {
page,
test,
});
});Installation

npm install --save-dev tests-aiYou'll need to set your Anthropic API key as an environment variable:
export ANTHROPIC_API_KEY=your-api-keyOr add it to your .env file:
ANTHROPIC_API_KEY=your-api-keyUsage
The ai function accepts two parameters:
- A string describing the test action to perform in natural language.
- An options object with:
page: Playwright Page objecttest: Playwright Test object
