Skip to content

andytyler/playwright-ai

Repository files navigation

tests-ai

Use Anthropic's Computer use API inside playwright tests.

License: MIT

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

alt text

npm install --save-dev tests-ai

You'll need to set your Anthropic API key as an environment variable:

export ANTHROPIC_API_KEY=your-api-key

Or add it to your .env file:

ANTHROPIC_API_KEY=your-api-key

Usage

The ai function accepts two parameters:

  1. A string describing the test action to perform in natural language.
  2. An options object with:
    • page: Playwright Page object
    • test: Playwright Test object

Inspiration

Inspired by Zerostep.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors