Hello HN community!
I'm excited to introduce *Auto Playwright*, an open-source tool that revolutionizes web testing by integrating AI with Playwright. Imagine writing your web app tests in plain, simple English and having AI turn those instructions into automated tests!
*Key Features:*
- *AI-Driven Test Writing:* Just write what you need in plain text, and let the AI do the rest.
- *Playwright Compatibility:* Works with all browsers compatible with Playwright.
- *Open-Source:* Dive into the code, contribute, and customize as you see fit.
*How It Works:*
1. *Install* `auto-playwright` via npm.
2. *Set up* your OpenAI API key.
3. *Write tests* using intuitive, plain-text prompts.
*Examples:* From testing a search function with a few lines of text to automating complex e-commerce cart tests – it's all made incredibly simple.
test("auto Playwright example", async ({ page }) => {
await page.goto("/");
// `auto` can query data
// In this case, the result is plain-text contents of the header
const headerText = await auto("get the header text", { page, test });
// `auto` can perform actions
// In this case, auto will find and fill in the search text input
await auto(`Type "${headerText}" in the search box`, { page, test });
// `auto` can assert the state of the website
// In this case, the result is a boolean outcome
const searchInputHasHeaderText = await auto(`Is the contents of the search box equal to "${headerText}"?` { page, test });
expect(searchInputHasHeaderText).toBe(true);
});
*Why It Matters:* This isn't just about automating the usual; it's about rethinking test automation. It's faster, more intuitive, and accessible, even for those less familiar with traditional coding.
*Get Involved:* I am building a community around Auto Playwright. Join us on [Discord](https://ray.run/discord), contribute to the [GitHub repo](https://github.com/lucgagan/auto-playwright), and stay updated with our [newsletter](https://ray.run/newsletter).
Looking forward to your thoughts, feedback, and seeing how you use Auto Playwright in your projects!
[Check out Auto Playwright on GitHub](https://github.com/lucgagan/auto-playwright)