Skip to content

Commit 89e0bd7

Browse files
docs: update documentation URL and add BDD usage section
1 parent 4d38989 commit 89e0bd7

File tree

3 files changed

+112
-10
lines changed

3 files changed

+112
-10
lines changed

README.md

Lines changed: 108 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,52 @@
22

33
**Auto Browse** is the easiest way to connect your AI agents with the browser using natural language.
44

5-
65
## Quick start
76

8-
An AI-powered browser automation enginer for automating browser tasks and Playwright tests that enables natural language interactions with web pages.
7+
An AI-powered browser automation agent for automating browser tasks and Write Playwright tests that enables natural language interactions with web pages.
98

109
## Installation
1110

1211
```bash
13-
npm install auto-browse
12+
npm install @auto-browse/auto-browse
13+
```
14+
15+
## ⚠️ Important: Playwright Version Requirements
16+
17+
> **Note:** Auto Browse currently requires specific versions of Playwright. This requirement will be relaxed in future versions.
18+
19+
### Required Versions
20+
21+
```bash
22+
"@playwright/test": "1.52.0-alpha-1743011787000"
23+
"playwright": "1.52.0-alpha-1743011787000"
1424
```
1525

26+
### Version Conflicts
27+
28+
If you're using Auto Browse alongside an existing Playwright setup, you must upgrade to these specific versions. Here's how to handle common issues:
29+
30+
1. **Installation Conflicts**
31+
32+
```bash
33+
npm install --legacy-peer-deps
34+
```
35+
36+
This flag helps resolve peer dependency conflicts during installation.
37+
38+
2. **Multiple Playwright Versions**
39+
40+
- Remove existing Playwright installations
41+
- Clear npm cache if needed: `npm cache clean --force`
42+
- Reinstall with the required versions
43+
44+
3. **Project Compatibility**
45+
- Update your project's Playwright configuration
46+
- Ensure your existing tests are compatible with the alpha version
47+
- Consider using a separate test environment if needed
48+
49+
> 🔄 Future releases will support a wider range of Playwright versions. Subscribe to our GitHub repository for updates.
50+
1651
## Configuration
1752

1853
Auto Browse requires environment variables for the LLM (Language Model) configuration. Create a `.env` file in your project root:
@@ -51,7 +86,7 @@ Coming soon:
5186
Auto Browse can also be used outside of Playwright test context. Here's a complete form automation example:
5287

5388
```typescript
54-
import { auto } from "auto-browse";
89+
import { auto } from "@auto-browse/auto-browse";
5590

5691
async function main() {
5792
try {
@@ -97,7 +132,7 @@ npx ts-node your-script.ts
97132

98133
```typescript
99134
import { test, expect } from "@playwright/test";
100-
import { auto } from "auto-browse";
135+
import { auto } from "@auto-browse/auto-browse";
101136

102137
test("example test", async ({ page }) => {
103138
await page.goto("https://example.com");
@@ -119,7 +154,7 @@ The package automatically detects the current page context, so you can skip pass
119154

120155
```typescript
121156
import { test, expect } from "@playwright/test";
122-
import { auto } from "auto-browse";
157+
import { auto } from "@auto-browse/auto-browse";
123158

124159
test("simplified example", async ({ page }) => {
125160
await page.goto("https://example.com");
@@ -131,6 +166,73 @@ test("simplified example", async ({ page }) => {
131166
});
132167
```
133168

169+
### BDD Mode with Playwright-BDD
170+
171+
Auto Browse seamlessly integrates with [playwright-bdd](https://github.com/vitalets/playwright-bdd) for behavior-driven development. This allows you to write expressive feature files and implement steps using natural language commands.
172+
173+
#### Example Feature File
174+
175+
```gherkin
176+
# features/homepage.feature
177+
Feature: Playwright Home Page
178+
179+
Scenario: Check title
180+
Given navigate to https://playwright.dev
181+
When click link "Get started"
182+
Then assert title "Installation"
183+
```
184+
185+
#### Step Definitions
186+
187+
```typescript
188+
import { auto } from "@auto-browse/auto-browse";
189+
import { Given, When, Then } from "./fixtures";
190+
191+
// Generic step that handles any natural language action
192+
When(/^(.*)$/, async ({ page }, action: string) => {
193+
await auto(action, { page });
194+
});
195+
196+
// You can also create specific steps for better readability
197+
Given("navigate to {string}", async ({ page }, url: string) => {
198+
await auto(`navigate to ${url}`, { page });
199+
});
200+
201+
Then("assert title {string}", async ({ page }, title: string) => {
202+
await auto(`assert title is "${title}"`, { page });
203+
});
204+
```
205+
206+
#### Setup Requirements
207+
208+
1. Install dependencies:
209+
210+
```bash
211+
npm install --save-dev @playwright/test @cucumber/cucumber playwright-bdd
212+
```
213+
214+
2. Configure `playwright.config.ts`:
215+
216+
```typescript
217+
import { PlaywrightTestConfig } from "@playwright/test";
218+
219+
const config: PlaywrightTestConfig = {
220+
testDir: "./features",
221+
use: {
222+
baseURL: "https://playwright.dev"
223+
}
224+
};
225+
226+
export default config;
227+
```
228+
229+
This integration enables:
230+
231+
- Natural language test scenarios
232+
- Reusable step definitions
233+
- Cucumber reporter integration
234+
- Built-in Playwright context management
235+
134236
### Supported Actions
135237

136238
1. **Clicking Elements**

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "auto-browse",
2+
"name": "@auto-browse/auto-browse",
33
"version": "0.1.0",
44
"description": "AI-powered browser automation",
55
"author": "auto-browse",
@@ -11,7 +11,7 @@
1111
"bugs": {
1212
"url": "https://github.com/auto-browse/auto-browse-ts/issues"
1313
},
14-
"documentation": "https://github.com/auto-browse/auto-browse-ts/blob/main/README.md",
14+
"documentation": "https://typescript.docs.auto-browse.com/introduction",
1515
"main": "dist/index.js",
1616
"types": "dist/index.d.ts",
1717
"scripts": {

0 commit comments

Comments
 (0)