
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
playwright-ai-bot
Advanced tools
PlayBot is an AI-powered CLI tool designed to accelerate the development and maintenance of Playwright test automation.
PlayBot is an AI-powered CLI tool designed to accelerate the development and maintenance of Playwright test automation.
For first experiments, we created a demo project with a basic setup.
npm install --save-dev playwright-ai-bot
npx playwright-ai-bot <command> [options]
Command | Description | Options |
---|---|---|
crawl <url> | Crawl the web app and collect data | -f, --folder <folder> : Specify folder to save crawled data (default: playbot-data )-l, --limit <limit> : Set the limit of pages to crawl (default: 10 )-t, --temperature <temperature> : Set creativity level for AI generation (0 to 1, default: 0.7 )-c, --clean : Remove crawled data |
stories | Generate user stories | -f, --folder <folder> : Specify folder to save stories (default: playbot-data )-t, --temperature <temperature> : Set creativity level for story generation (0 to 1, default: 0.7 ) |
tests | Generate test cases from stories | -f, --folder <folder> : Specify folder to save tests (default: playbot-data )-t, --temperature <temperature> : Set creativity level for test generation (0 to 1, default: 0.7 ) |
code | Generate executable code from tests | No options available yet |
Usage: playwright-ai-bot [options] [command]
PlayBot: AI-powered CLI tool that speeds up the development and maintenance of Playwright test automation.
Options:
-V, --version Output the version number
-h, --help Display help for command
Commands:
crawl [options] [url] Crawl the web app to collect data for generating user stories, test cases, and code
stories [options] Generate user stories from crawled data
tests [options] Generate test cases from user stories
code Generate or update executable code based on test cases
help [command] Display help for a specific command
npx playwright-ai-bot crawl https://example.com -f my-data-folder -l 50 -t 0.5
This command crawls https://example.com
, saves the data to my-data-folder
, limits crawling to 50 pages, and sets creativity to 0.5 for AI generation.
npx playwright-ai-bot stories -f my-data-folder -t 0.7
This generates user stories from the data in my-data-folder
with creativity set to 0.7.
npx playwright-ai-bot tests -f my-data-folder -t 0.9
This generates test cases from user stories in my-data-folder
with creativity set to 0.9.
npx playwright-ai-bot code
This generates executable code based on the generated test cases.
Create a playbot.config.js
file in your project root:
const config = {
baseUrl: 'https://example.com',
aiModel: 'gpt-4o-mini',
apiKey: process.env.OPENAI_API_KEY || '',
frameworkPath: 'docs',
framework: 'playwright',
frameworkPath: 'tests',
};
module.exports = config; // CommonJS
// export default config; // ES Module
Set your .env
file with your OpenAI API key:
OPENAI_API_KEY=your-secret-key
Configure .env
for Azure:
AI_PROVIDER=azure
AI_MODEL=gpt-4o
AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
AZURE_DEPLOYMENT_NAME=gpt-4o
AZURE_API_VERSION=2024-08-01-preview
AZURE_OPENAI_API_KEY=your-secret-key
Update your playbot.config.js
accordingly:
const config = {
...
aiProvider: process.env.AI_PROVIDER || 'openai',
aiModel: process.env.AI_MODEL || 'gpt-4o-mini',
azureEndpoint: process.env.AZURE_OPENAI_ENDPOINT || '',
azureDeploymentName: process.env.AZURE_DEPLOYMENT_NAME || '',
...
};
export default config;
Use these commands for debugging during development:
npm run dev -- crawl https://dronjo.wopee.io
# Remove crawled data
npm run dev -- crawl --clean
npm run dev -- stories -t 0.7
npm run dev -- tests -t 0.9
npm run dev -- code
To modify behavior, use a requirements.md
file to instruct how outputs should be generated. Example:
# important requirements
- Use emojis to generate names of scenarios and user stories
- Use priority A, B, C for business prioritization where A is most important
- Generate all tests into one file
npx playwright codegen --save-storage=auth.json
auth.json
is created with storage content.Example auth.json
:
{
"cookies": [
{
"name": "session-username",
"value": "standard_user",
"domain": "www.saucedemo.com",
"path": "/",
"expires": 1729532645,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
}
],
"origins": [
{
"origin": "https://www.saucedemo.com",
"localStorage": [
{
"name": "backtrace-guid",
"value": "d3575904-a4dc-4139-a1a0-01f25a69e5c4"
},
{
"name": "backtrace-last-active",
"value": "1729532012509"
}
]
}
]
}
crawlerStorageState: 'auth.json'
to your config file.Troubleshooting: Test auth.json
by running:
npx playwright codegen --load-storage=auth.json [your-web-app]
You should be logged in.
We welcome contributions! Please follow these steps:
git checkout -b feature/your-feature-name
.git commit -m 'Add some feature'
.git push origin feature/your-feature-name
.For major changes, please open an issue first to discuss your proposal.
This project is licensed under a Proprietary License. For more details, refer to the LICENSE file.
FAQs
PlayBot is an AI-powered CLI tool designed to accelerate the development and maintenance of Playwright test automation.
The npm package playwright-ai-bot receives a total of 7 weekly downloads. As such, playwright-ai-bot popularity was classified as not popular.
We found that playwright-ai-bot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.