QA WebdriverIO Writer
Purpose
Write WebdriverIO E2E and mobile web tests from test case specifications. Transform structured test cases into executable TypeScript test files using the W3C WebDriver protocol, multi-browser support, Appium for mobile web, and the Page Object pattern.
Trigger Phrases
- "Write WebdriverIO tests for [feature/flow]"
- "Generate WebdriverIO E2E tests from test cases"
- "Create WebdriverIO tests with Page Objects"
- "Add WebdriverIO mobile web tests"
- "WebdriverIO tests for [URL/flow]"
- "Multi-browser WebdriverIO tests"
- "Appium + WebdriverIO tests for mobile web"
- "WDIO tests with custom commands"
Workflow
- Read test cases — From qa-testcase-from-docs, qa-manual-test-designer, qa-browser-data-collector
- Analyze target — Page structure, selectors, mobile vs desktop
- Generate test files — Create
*.spec.ts in test/specs/ or project convention
- Add Page Objects — Encapsulate selectors and actions in
pageobjects/
- Configure wdio.conf.ts — Capabilities, services, reporters
Key Features
- W3C WebDriver protocol — Standard browser automation
- Multi-browser — Chrome, Firefox, Safari, Edge via capabilities
- Appium integration — Mobile web testing (iOS Safari, Android Chrome)
- Page Object pattern — Encapsulate page logic, reusable selectors
- Built-in wait strategies —
waitForDisplayed, waitForClickable, waitForExist
- WDIO test runner — Parallel execution, retries, reporters
Test Types
| Type |
Scope |
Approach |
| E2E |
Full user flows, page navigation |
browser.url, $(), $$(), click, setValue, getText |
| Mobile Web |
Mobile browser testing |
Appium service, mobile capabilities, viewport |
E2E Testing
- Navigation:
browser.url(), browser.back(), browser.refresh()
- Selectors:
$('selector') single element, $$('selector') element array
- Actions:
.click(), .setValue(), .addValue(), .clearValue(), .selectByVisibleText()
- Getters:
.getText(), .getAttribute(), .getValue(), .isDisplayed()
- Waits:
.waitForDisplayed(), .waitForClickable(), .waitForExist(), browser.waitUntil()
See references/patterns.md for selectors, waits, Page Objects, custom commands, file upload, multiremote.
Page Object Pattern
- Base page: Shared selectors, navigation helpers, common actions
- Page-specific: Extend base; encapsulate page-specific locators and methods
- WDIO Page Object — Use
get getters for lazy element resolution
See references/best-practices.md for Page Object structure.
Key Patterns
- Structure:
describe / it, before / after, beforeEach / afterEach
- Selectors: CSS, XPath, accessibility (aria), data attributes
- Assertions:
expect() (Chai/Expect), browser.assert (if using expect-webdriverio)
- Custom commands:
browser.addCommand() for reusable actions
- Multiremote: Run same test across multiple browsers in parallel
Services
| Service |
Purpose |
@wdio/local-runner |
Local test execution |
@wdio/mocha-framework |
Mocha describe/it (or Jasmine, Cucumber) |
wdio-chromedriver-service |
ChromeDriver for Chrome |
@wdio/appium-service |
Appium for mobile web |
@wdio/selenium-standalone-service |
Selenium Grid / standalone |
Configuration
- wdio.conf.ts — Capabilities, services, framework, reporters, specs
- Multi-capability — Run same tests on multiple browsers
- Environment-specific — baseUrl, timeouts via config
See references/config.md for full configuration guide.
Context7 MCP
Uses Context7 MCP to fetch WebdriverIO documentation when needed. Query for WebdriverIO API, selectors, or configuration when patterns are unclear.
Scope
Can do (autonomous):
- Generate WebdriverIO E2E and mobile web tests from test cases
- Apply Page Object pattern with getters and methods
- Add custom commands via
browser.addCommand()
- Configure wdio.conf.ts (capabilities, services, reporters)
- Use multiremote for parallel browser testing
- Use Context7 MCP for WebdriverIO docs
Cannot do (requires confirmation):
- Change production code structure
- Add dependencies not in package.json
- Override project WDIO config without approval
- Modify Appium server configuration
Will not do (out of scope):
- Execute tests (user runs
npx wdio run wdio.conf.ts)
- Write Jest/Vitest unit tests (use qa-jest-writer)
- Modify CI/CD pipelines
- Native mobile app testing (Appium native, not mobile web)
References
references/patterns.md — Selectors, waits, Page Objects, custom commands, file upload, multiremote
references/config.md — wdio.conf.ts, capabilities, services, reporters
references/best-practices.md — Stable selectors, wait strategies, Page Objects, parallel execution
Quality Checklist
Troubleshooting
| Symptom |
Likely Cause |
Fix |
| Element not found |
Selector too specific, timing |
Use data-testid; add waitForDisplayed before action |
| Stale element |
DOM changed after query |
Re-query element; use getters in Page Objects |
| Timeout on wait |
Element never meets condition |
Verify selector; check overlays, iframes |
| Multiremote fails |
Capability mismatch |
Ensure all browsers support same commands |
| Appium not starting |
Service/config issue |
Check @wdio/appium-service; verify Appium installed |
| ChromeDriver version mismatch |
Chrome updated |
Update wdio-chromedriver-service or chromedriver |
| Flaky tests |
Race conditions |
Use waitForDisplayed/waitForClickable; avoid fixed delays |
1---2name: qa-webdriverio-writer3description: Generate WebdriverIO E2E and mobile web tests for TypeScript using W3C WebDriver protocol with multi-browser support, Appium integration, and Page Object pattern.4---56# QA WebdriverIO Writer78## Purpose910Write WebdriverIO E2E and mobile web tests from test case specifications. Transform structured test cases into executable TypeScript test files using the W3C WebDriver protocol, multi-browser support, Appium for mobile web, and the Page Object pattern.1112## Trigger Phrases1314- "Write WebdriverIO tests for [feature/flow]"15- "Generate WebdriverIO E2E tests from test cases"16- "Create WebdriverIO tests with Page Objects"17- "Add WebdriverIO mobile web tests"18- "WebdriverIO tests for [URL/flow]"19- "Multi-browser WebdriverIO tests"20- "Appium + WebdriverIO tests for mobile web"21- "WDIO tests with custom commands"2223## Workflow24251. **Read test cases** — From qa-testcase-from-docs, qa-manual-test-designer, qa-browser-data-collector262. **Analyze target** — Page structure, selectors, mobile vs desktop273. **Generate test files** — Create `*.spec.ts` in `test/specs/` or project convention284. **Add Page Objects** — Encapsulate selectors and actions in `pageobjects/`295. **Configure wdio.conf.ts** — Capabilities, services, reporters3031## Key Features3233- **W3C WebDriver protocol** — Standard browser automation34- **Multi-browser** — Chrome, Firefox, Safari, Edge via capabilities35- **Appium integration** — Mobile web testing (iOS Safari, Android Chrome)36- **Page Object pattern** — Encapsulate page logic, reusable selectors37- **Built-in wait strategies** — `waitForDisplayed`, `waitForClickable`, `waitForExist`38- **WDIO test runner** — Parallel execution, retries, reporters3940## Test Types4142| Type | Scope | Approach |43|------|-------|----------|44| **E2E** | Full user flows, page navigation | browser.url, $(), $$(), click, setValue, getText |45| **Mobile Web** | Mobile browser testing | Appium service, mobile capabilities, viewport |4647## E2E Testing4849- **Navigation:** `browser.url()`, `browser.back()`, `browser.refresh()`50- **Selectors:** `$('selector')` single element, `$$('selector')` element array51- **Actions:** `.click()`, `.setValue()`, `.addValue()`, `.clearValue()`, `.selectByVisibleText()`52- **Getters:** `.getText()`, `.getAttribute()`, `.getValue()`, `.isDisplayed()`53- **Waits:** `.waitForDisplayed()`, `.waitForClickable()`, `.waitForExist()`, `browser.waitUntil()`5455See `references/patterns.md` for selectors, waits, Page Objects, custom commands, file upload, multiremote.5657## Page Object Pattern5859- **Base page:** Shared selectors, navigation helpers, common actions60- **Page-specific:** Extend base; encapsulate page-specific locators and methods61- **WDIO Page Object** — Use `get` getters for lazy element resolution6263See `references/best-practices.md` for Page Object structure.6465## Key Patterns6667- **Structure:** `describe` / `it`, `before` / `after`, `beforeEach` / `afterEach`68- **Selectors:** CSS, XPath, accessibility (aria), data attributes69- **Assertions:** `expect()` (Chai/Expect), `browser.assert` (if using expect-webdriverio)70- **Custom commands:** `browser.addCommand()` for reusable actions71- **Multiremote:** Run same test across multiple browsers in parallel7273## Services7475| Service | Purpose |76|---------|---------|77| `@wdio/local-runner` | Local test execution |78| `@wdio/mocha-framework` | Mocha describe/it (or Jasmine, Cucumber) |79| `wdio-chromedriver-service` | ChromeDriver for Chrome |80| `@wdio/appium-service` | Appium for mobile web |81| `@wdio/selenium-standalone-service` | Selenium Grid / standalone |8283## Configuration8485- **wdio.conf.ts** — Capabilities, services, framework, reporters, specs86- **Multi-capability** — Run same tests on multiple browsers87- **Environment-specific** — baseUrl, timeouts via config8889See `references/config.md` for full configuration guide.9091## Context7 MCP9293Uses Context7 MCP to fetch WebdriverIO documentation when needed. Query for WebdriverIO API, selectors, or configuration when patterns are unclear.9495## Scope9697**Can do (autonomous):**98- Generate WebdriverIO E2E and mobile web tests from test cases99- Apply Page Object pattern with getters and methods100- Add custom commands via `browser.addCommand()`101- Configure wdio.conf.ts (capabilities, services, reporters)102- Use multiremote for parallel browser testing103- Use Context7 MCP for WebdriverIO docs104105**Cannot do (requires confirmation):**106- Change production code structure107- Add dependencies not in package.json108- Override project WDIO config without approval109- Modify Appium server configuration110111**Will not do (out of scope):**112- Execute tests (user runs `npx wdio run wdio.conf.ts`)113- Write Jest/Vitest unit tests (use qa-jest-writer)114- Modify CI/CD pipelines115- Native mobile app testing (Appium native, not mobile web)116117## References118119- `references/patterns.md` — Selectors, waits, Page Objects, custom commands, file upload, multiremote120- `references/config.md` — wdio.conf.ts, capabilities, services, reporters121- `references/best-practices.md` — Stable selectors, wait strategies, Page Objects, parallel execution122123## Quality Checklist124125- [ ] Explicit waits used; avoid `browser.pause()` in committed code126- [ ] Page Object pattern applied for page-specific logic127- [ ] Stable selectors (data-testid, aria, semantic over brittle CSS)128- [ ] Tests independent (no shared state, order-independent)129- [ ] Proper teardown (afterEach, cleanup)130- [ ] Traceability to test case IDs where applicable131- [ ] No hardcoded secrets (use env vars)132- [ ] Capabilities match target browsers133134## Troubleshooting135136| Symptom | Likely Cause | Fix |137|---------|--------------|-----|138| Element not found | Selector too specific, timing | Use data-testid; add waitForDisplayed before action |139| Stale element | DOM changed after query | Re-query element; use getters in Page Objects |140| Timeout on wait | Element never meets condition | Verify selector; check overlays, iframes |141| Multiremote fails | Capability mismatch | Ensure all browsers support same commands |142| Appium not starting | Service/config issue | Check @wdio/appium-service; verify Appium installed |143| ChromeDriver version mismatch | Chrome updated | Update wdio-chromedriver-service or chromedriver |144| Flaky tests | Race conditions | Use waitForDisplayed/waitForClickable; avoid fixed delays |