Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问许可证需确认审计通过

writing-webdriverio-code编写 webdriverio 代码

Agent Skill

用于辅助文档、README、Markdown、说明文和内容稿件的整理与改写。它适合让 Agent 提炼结构、补齐章节、统一术语、检查链接或把零散材料整理成可读文档。使用时应保留项目已有事实、命令和路径,不要把未确认的信息写成确定结论;涉及对外文案时,还需要控制语气,避免过度营销或夸大能力。

总安装

494

周安装

21

GitHub Stars

4

下载量

173
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:writing-webdriverio-code(编写 webdriverio 代码)
来源仓库:https://github.com/klamping/webdriverio-skills
仓库路径:skills/writing-webdriverio-code
安装命令:
npx skills add https://github.com/klamping/webdriverio-skills --skill writing-webdriverio-code
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/klamping/webdriverio-skills --skill writing-webdriverio-code

简介

用于辅助文档、README、Markdown 和内容稿件的整理与改写。

  • 适合提炼结构、补齐章节、统一术语或检查链接,提升内容可读性。
  • 使用时应保留项目已有事实和路径,避免写成确定结论;对外文案需注意语气控制。
  • 安装命令:npx skills add https://github.com/klamping/webdriverio-skills --skill writing-webdriverio-code。
  • 支持 Codex、Claude、Cursor、Gemini CLI,通过 GitHub 仓库安装。

SKILL.md

Writing WebdriverIO Code

Convert scaffold comments into production-ready test code.

This skill can take either:

  • a scaffold created by creating-test-structure, or
  • an existing WebdriverIO spec that needs new tests, refactors, or bug fixes.

In both cases, it produces concrete WebdriverIO implementation that is stable, readable, and debuggable.

When to Use

  • A scaffold exists and needs conversion from pseudo-code to WDIO commands/assertions.
  • An existing test file needs additional scenarios.
  • Existing tests are flaky, brittle, or incorrect and need fixes.

When Not to Use

  • You need full-suite scaffolding from a markdown test plan (use creating-test-structure).
  • You are only reorganizing describe/it hierarchy without code implementation.
  • You need broad test strategy decisions (test pyramid/scope) rather than file-level WDIO code.

Input Contract

  • A scaffolded spec file with pseudo-code comments (optional).
  • Or an existing implemented spec file to extend/fix.
  • Existing page objects, fixtures, and helpers from the project.
  • Project conventions (linting, naming, assertion style).

Project Context Files

Before implementation, read project cache files when available:

  • .webdriverio-skills/project-context.md
  • .webdriverio-skills/project-context.json
  • .webdriverio-skills/custom-rules.md
  • .webdriverio-skills/health-recommendations.md
  • references/website-analysis/<target>/website-analysis.md
  • references/website-analysis/<target>/website-analysis.json

Use these as the default source for conventions, scripts, environment usage, and team overrides.

Use website analysis references for route/component context, expected states, and auth-gated flow awareness.

<target> should resolve to lowercase site host (prefer user URL or project baseUrl host). If unavailable, use unknown-target and proceed with other context sources.

If files are missing or stale, run managing-project-customizations first.

Conversion Workflow

  1. Identify whether the target is scaffold-conversion or direct test enhancement/fix.
  2. Load project context and custom rules, then apply them as hard constraints.
  3. Implement comments in execution order when pseudo-code exists.
  4. Prefer existing page object methods before creating new ones.
  5. Use resilient selectors and explicit expectations.
  6. Remove pseudo-code comments once behavior is clear.
  7. Keep only comments that explain non-obvious intent.

Suite Startup State Hygiene

  • At suite start, reset state that can leak between tests (cookies, local storage, session/auth state).
  • Make startup preconditions idempotent so re-runs produce the same baseline.
  • Prefer explicit setup in hooks over hidden cross-test state.
  • Treat cleanup as required, but do not rely only on after hooks that might not run after crashes.

Deterministic Test Data Setup and Cleanup

  • Create deterministic test data via APIs/fixtures when possible.
  • Name fixtures/data so their purpose is obvious.
  • Keep setup close to the test scope that needs it (beforeEach for strict isolation, before for shared stable state).
  • Always include a cleanup path for created data.
  • Verify test data assumptions in code before acting on them.

Test Structure Rules

  • Keep each test in clear phases: setup, validation, teardown.
  • Keep setup in hooks when shared (before, beforeEach), not copy/pasted into every test.
  • Keep each it(...) focused on one user-observable behavior.
  • Keep tests independent and safe to run in isolation or in parallel.

Framework Rules (Mocha/Jasmine)

  • Match the project's existing style for describe, it, and hooks.
  • Use nested describe blocks to represent user context, not implementation layers.
  • Avoid deeply nested suites when a flatter structure reads better.
  • Use .only / .skip only for local debugging and remove before finalizing.

Page Object Rules

  • Keep selectors and page-specific actions in page objects/components.
  • Keep specs focused on behavior and assertions.
  • Reuse existing page object methods before adding new abstractions.
  • Add small, purpose-specific page object methods; avoid generic do-everything helpers.

Efficient Element Querying

  • Scope queries to meaningful containers before selecting child elements.
  • Reuse located elements within a test step instead of re-querying the same selector repeatedly.
  • Prefer unique semantic selectors over index-based lookups.
  • Use index-based selection only when the UI contract is explicitly positional.

Selector Rules

  • Prefer user-facing selectors: button=..., aria/....
  • Use data-testid when text/ARIA is unstable.
  • Avoid brittle class-chain and layout-coupled selectors.
  • Scope element queries to reduce collisions.

Waiting Rules

  • Rely on auto-wait for interactions (click, setValue) when possible.
  • Use explicit waits for meaningful UI state transitions (waitForDisplayed, waitForClickable, waitUntil).
  • Prefer waiting on user-visible outcomes over internal implementation details.
  • Do not use browser.pause as a synchronization strategy.
  • Small hard waits are allowed only when tied to known UI constraints (e.g., unavoidable animation timing) and should be rare and documented.
  • Keep implicit timeouts at default unless there is a documented reason.

Waiting Decision Guide

SituationPreferred approachAvoid
Element interactionWDIO auto-wait + interactpre-emptive pause
Async UI update after actionassertion retry or waitFor...fixed sleep
Non-element conditionbrowser.waitUntil(...) with clear conditionpolling with manual loops
Known animation delaytiny documented pause only if no stable signal existslarge blanket pauses

Avoid Third-Party Dependency Assertions

  • Test behavior your application owns, not external provider internals.
  • Stub/mock third-party integrations where feasible to avoid external flake.
  • Validate your contract with external services (request/response handling), not vendor uptime or UI.
  • Keep a very small set of smoke checks for external integration paths only when needed.

Assertion Rules

  • Assert user-visible outcomes and critical state.
  • Use expect-webdriverio matchers (toHaveText, toBeDisplayed, toHaveUrlContaining).
  • Prefer meaningful failure messages via clear assertion targets.
  • Assert list counts/order explicitly when behavior depends on ordering.
  • Verify only behavior that matters for the scenario; avoid noisy over-assertion.

Test Naming Rules

  • Test names should read as clear behavior statements.
  • Use domain language users and developers recognize.
  • Avoid vague names (should work, happy path test).
  • Name tests by expected outcome, not implementation steps.

Security Rules

  • Never hardcode secrets.
  • Mask sensitive values when entering credentials (setValue(..., {mask: true}) where supported).
  • Avoid leaking tokens or credentials in logs.

Write Tests for Fast Debugging

  • Keep test steps readable in execution order.
  • Use assertion targets that reveal what failed without extra digging.
  • Add concise step-level logs for complex journeys.
  • Keep abstraction shallow in specs so failures map back to intent quickly.

Flaky Test Triage Playbook

  1. Reproduce the failure reliably (single test, then repeated runs).
  2. Isolate the flaky step (selector, wait, data, environment, or shared state).
  3. Classify root cause (timing, state leakage, brittle locator, test-data drift, external dependency).
  4. Fix the root cause (do not hide with sleeps/retries).
  5. Re-run multiple times to verify stability before closing.

Quick Reference

Test intentTypical WDIO implementation
Navigate to a pageawait browser.url('/path')
Interact with a controlawait el.click() / await el.setValue(...)
Validate visible outcomeawait expect(el).toBeDisplayed()
Validate content/stateawait expect(el).toHaveText(...) / toHaveValue(...)
Wait for async state changeawait el.waitForDisplayed() or browser.waitUntil(...)

Common Mistakes

  • Assuming a scaffold is always required.
  • Leaving pseudo-code comments unimplemented.
  • Converting comments to brittle selectors.
  • Using browser.pause instead of waiting for a condition.
  • Overusing helper abstractions that hide test intent.
  • Coupling tests to execution order.
  • Treating retries as a substitute for root-cause fixes.

Example

it('should default to showing the global feed', async function () {
  const activeTabs = await $$('.feed-toggle .nav-link.active');
  await expect(activeTabs).toBeElementsArrayOfSize(1);
  await expect(activeTabs[0]).toHaveText('Global Feed');
});

Done means all pseudo-code comments are converted into maintainable WDIO code or intentionally retained only for non-obvious context.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.52%
按下载量换算63

Claude

26.54%
按下载量换算46

Cursor

18.03%
按下载量换算31

Gemini CLI

9.21%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills