How to Run Playwright Tests With Agent Skills on TestMu AI
If you use an AI coding assistant, you can skip the manual Playwright project setup and let Agent Skills generate the test automation for you. Agent Skills give the assistant the project structure, dependency versions, and cloud execution patterns it needs to write working Playwright tests on the first pass. You install the skill into your tool's skills directory, set your credentials, then describe the tests you want in natural language.
The Playwright Agent Skill is part of the TestMu AI Agent Skills collection, a set of structured packages that teach AI coding assistants how to write test automation code.
About Agent Skills
Agent Skills are self-contained packages of instructions, code patterns, debugging guides, and CI/CD configurations for specific testing frameworks. Once installed, your AI assistant works like a senior QA automation architect with knowledge of:
- Proper project structure for each framework
- Correct dependency versions and configurations
- Both local and TestMu AI cloud execution patterns
- Common pitfalls and debugging approaches
- CI/CD integration with GitHub Actions
Prerequisites
Make sure you have an account, your credentials, and a supported assistant before installing the skill.
- A TestMu AI account. If you don't have one, sign up for free.
- Your TestMu AI Username and Access Key from the Automation Dashboard.
- An AI coding assistant: Claude Code, GitHub Copilot, Cursor, Gemini CLI, or any compatible tool.
Installing the Playwright Agent Skill
Clone the Agent Skills repository, then copy the Playwright skill into your AI tool's skills directory.
Verifiedgit clone https://github.com/LambdaTest/agent-skills.git
# For Claude Code
cp -r agent-skills/playwright-skill .claude/skills/
# For Cursor
cp -r agent-skills/playwright-skill .cursor/skills/
# For GitHub Copilot
cp -r agent-skills/playwright-skill .github/skills/
# For Gemini CLI
cp -r agent-skills/playwright-skill .gemini/skills/
If you prefer installing all available framework skills, clone the repository directly into your tool's skills directory (e.g., .claude/skills/, .cursor/skills/).
Set Up Your Authentication
Configure your TestMu AI credentials as environment variables so the skill can connect to the grid.
Verifiedexport LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
export LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"
Running Your First Test Using Agent Skills
Once the skill is installed, describe the tests you want in natural language and let the assistant generate and run them. Any of the prompts below is enough to get started.
Verified"Write Playwright tests for the login page and run them on TestMu AI cloud using Chrome and Firefox"
"Set up a Playwright TypeScript project with Page Object Model and run tests on TestMu AI"
"Run Playwright tests on real mobile devices on TestMu AI cloud"
The Agent Skill automatically handles:
- Project setup - Creates the right folder structure, dependencies, and config files
- Language detection - Maps your request to the correct language (TypeScript, JavaScript, Python, Java, or C#)
- Execution target - Configures local or TestMu AI cloud execution via CDP WebSocket
- Best practices - Uses web-first assertions, accessible locators (
getByRole,getByLabel), and Page Object Model
What's Included in the Playwright Skill
The skill ships as a small set of Markdown files that the assistant reads to build your project. The tree below shows the layout, and the table maps each area of coverage.
Verifiedplaywright-skill/
├── SKILL.md
└── reference/
├── playbook.md
└── advanced-patterns.md
| Section | Details |
|---|---|
| Project Setup | Dependencies, versions, configuration files, project structure |
| Core Patterns | Complete, runnable code examples with web-first assertions |
| Cloud Integration | TestMu AI CDP WebSocket connection and capabilities configuration |
| CI/CD Integration | GitHub Actions workflows with reporting and parallel execution |
| Debugging Guide | Common issues mapped to solutions |
| Best Practices | Actionable recommendations for production code |
Supported Languages and Frameworks
The Playwright Agent Skill supports five languages. Several framework docs also reference their own dedicated Agent Skills, listed in the second table below.
Languages
Pick your language to see which skill applies and where its dedicated doc lives.
| Language | Agent Skill | Documentation |
|---|---|---|
| TypeScript (default) | playwright-skill | TypeScript with Playwright |
| JavaScript | playwright-skill | JavaScript with Playwright |
| Java | playwright-skill | Java with Playwright |
| Python | playwright-skill | Python with Playwright |
| C# | playwright-skill | C# with Playwright |
Frameworks With Dedicated Agent Skills
These test runners ship their own Agent Skills that build on the Playwright skill.
| Framework | Agent Skill | Documentation |
|---|---|---|
| Jest | jest-skill | Jest with Playwright |
| JUnit 5 | junit-5-skill | JUnit with Playwright |
| CucumberJS | cucumber-skill | CucumberJS with Playwright |
Supported AI Tools
The skill installs into any of the AI coding tools below. Copy it into the installation path that matches your tool.
| Tool | Type | Installation Path |
|---|---|---|
| Claude Code | CLI | .claude/skills/ |
| GitHub Copilot | Extension | .github/skills/ |
| Cursor | IDE | .cursor/skills/ |
| Gemini CLI | CLI | .gemini/skills/ |
| Codex CLI | CLI | .codex/skills/ |
| OpenCode | CLI | .opencode/skills/ |
| Claude.ai | Web | Settings > Features > Skills |
Related Playwright Guides
Continue with the guides below to run, scale, and configure Playwright tests on TestMu AI.
- Run your first Playwright test on the cloud grid walks through connecting Playwright to TestMu AI from scratch.
- Run Playwright tests with the TestMu AI SDK runs your existing suite with no code changes.
- Configure Playwright capabilities sets browser, OS, and cloud options for your runs.
