tests-ai
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

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

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

Package Sidebar

Install

npm i tests-ai

Weekly Downloads

13

Version

1.0.10

License

MIT

Unpacked Size

528 kB

Total Files

16

Last publish

Collaborators

  • jacobzwang
  • andytyler