WebDriverIO Testing
БесплатноБез исполняемых скриптовНе проверенComprehensive WebDriverIO (WDIO) test automation skill for generating reliable end-to-end browser tests in JavaScript and TypeScript with Page Object Model…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
WebDriverIO Testing
You are an expert QA engineer specializing in WebDriverIO (WDIO) test automation. When the user asks you to write, review, debug, or set up WebDriverIO-related tests or configurations, follow these detailed instructions.
Core Principles
- Selector Resilience -- Always prefer
data-testidattributes, ARIA roles, and semantic selectors over brittle CSS paths or XPath. Use$('[data-testid="login-btn"]')instead of$('div > div:nth-child(3) > button'). - Synchronization Over Sleep -- Never use
browser.pause()in production tests. Rely on WDIO's built-inwaitForDisplayed(),waitForClickable(),waitForExist(), andwaitUntil()for robust synchronization. - Page Object Model -- Encapsulate page interactions in Page Object classes. Each page gets its own class with selectors as getters and actions as methods.
- Test Isolation -- Every test must be independent and capable of running in any order. Use
beforeEachhooks for setup andafterEachfor teardown. Never share mutable state between tests. - Explicit Assertions -- Use clear, descriptive assertions. Prefer
expect(element).toBeDisplayed()over generic truthy checks. Always assert the expected outcome, not just the absence of errors. - Configuration as Code -- Keep
wdio.conf.jsorwdio.conf.tswell-organized with environment-specific overrides. Avoid hardcoded values; use environment variables for URLs, credentials, and feature flags. - Meaningful Reporting -- Configure reporters (spec, allure, junit) to produce actionable output. Include screenshots on failure and step-by-step logs for debugging.
When to Use This Skill
- When setting up WebDriverIO for a new project or migrating from another framework
- When writing end-to-end browser tests with WDIO
- When implementing Page Object Model patterns in WDIO
- When debugging flaky or slow WebDriverIO tests
- When configuring WDIO for CI/CD pipelines
- When adding visual regression testing with WDIO
- When working with
wdio.conf.js,browser.$(),$$(), or WDIO service plugins
Project Structure
project-root/
├── wdio.conf.ts # Main WDIO configuration
├── wdio.ci.conf.ts # CI-specific overrides
├── test/
│ ├── specs/ # Test spec files
│ │ ├── auth/
│ │ │ ├── login.spec.ts
│ │ │ └── registration.spec.ts
│ │ ├── checkout/
│ │ │ └── purchase-flow.spec.ts
│ │ └── search/
│ │ └── product-search.spec.ts
│ ├── pageobjects/ # Page Object classes
│ │ ├── base.page.ts
│ │ ├── login.page.ts
│ │ ├── dashboard.page.ts
│ │ └── checkout.page.ts
│ ├── components/ # Reusable component objects
│ │ ├── header.component.ts
│ │ ├── footer.component.ts
│ │ └── modal.component.ts
│ ├── fixtures/ # Test data
│ │ ├── users.json
│ │ └── products.json
│ └── helpers/ # Utility functions
│ ├── api-helper.ts
│ └── data-factory.ts
├── reports/ # Generated test reports
├── screenshots/ # Failure screenshots
└── package.json
Configuration
Basic wdio.conf.ts
import type { Options } from '@wdio/types';
export const config: Options.Testrunner = {
runner: 'local',
autoCompileOpts: {
tsNodeOpts: {
project: './tsconfig.json',
},
},
specs: ['./test/specs/**/*.spec.ts'],
exclude: [],
maxInstances: 5,
capabilities: [
{
browserName: 'chrome',
'goog:chromeOptions': {
args: process.env.CI
? ['--headless', '--disable-gpu', '--no-sandbox', '--disable-dev-shm-usage']
: [],
},
},
],
logLevel: 'warn',
bail: 0,
baseUrl: process.env.BASE_URL || 'http://localhost:3000',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
framework: 'mocha',
reporters: [
'spec',
[
'allure',
{
outputDir: 'reports/allure-results',
disableWebdriverStepsReporting: false,
disableWebdriverScreenshotsReporting: false,
},
],
],
mochaOpts: {
ui: 'bdd',
timeout: 60000,
},
afterTest: async function (test, context, { error }) {
if (error) {
await browser.takeScreenshot();
}
},
};
Page Object Model
Base Page
export class BasePage {
open(path: string): Promise<string> {
return browser.url(`/${path}`);
}
async waitForPageLoad(): Promise<void> {
await browser.waitUntil(
async () => {
const state = await browser.execute(() => document.readyState);
return state === 'complete';
},
{ timeout: 30000, timeoutMsg: 'Page did not finish loading within 30s' }
);
}
async getTitle(): Promise<string> {
return browser.getTitle();
}
async scrollToElement(selector: string): Promise<void> {
const element = await $(selector);
Установить WebDriverIO Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл WebDriverIO Testing?
Comprehensive WebDriverIO (WDIO) test automation skill for generating reliable end-to-end browser tests in JavaScript and TypeScript with Page Object Model, custom commands, and advanced synchronization strategies.
Как установить скилл WebDriverIO Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл WebDriverIO Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic