跳到正文
cccskills
免费在 GitHub 公开

local-testing

Verify the local lobe-ui component library and documentation site in a browser using agent-browser. Check documented routes, standalone demos, interactions, light and dark themes, responsive layouts, screenshots, and browser or server errors.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Local browser verification for the lobe-ui component library and documentation site. Uses agent-browser against the React Router and Vite development server, including component pages, manifest-backed standalone demos, theme states, and responsive layouts. Trigger on local test, UI test, verify component, test in browser, visual check, or screenshot demo.

lobehub/lobe-ui星标 2,246(GitHub 2,246 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • Checking a component change in the local documentation site
  • Testing a standalone demo’s interactions and appearance
  • Verifying responsive layouts and capturing screenshot evidence

包含的文件(1)

  • SKILL.md8.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Local UI Automation Testing

Use agent-browser to verify the local documentation site visually and programmatically.

LayerCommand or toolAuthority
Development serverpnpm run docs:devReact Router and Vite
Documentation routessite/content/compatibility.jsonFrozen path authority
Navigation and document registryCompiled content manifestRuntime result
Standalone demo routessite/content/compatibility.jsonFrozen compatibility inventory
Browser automationagent-browserChromium through CDP

Do not assume a fixed port or derive standalone IDs from filenames. The server selects the first available port, while the compatibility manifest is the route authority.

Start or reuse the development server

Prefer the server already associated with the current task. Otherwise start one in the background and retain its log for port discovery and error inspection:

LOG=/tmp/lobe-ui-docs-dev.log
nohup pnpm run docs:dev > "$LOG" 2>&1 &
disown

Wait for the actual URL emitted by Vite. The log contains a value matching http://localhost:[0-9]+; never substitute a hard-coded default.

LOG=/tmp/lobe-ui-docs-dev.log
for i in $(seq 1 60); do
  URL=$(grep -Eo 'http://localhost:[0-9]+' "$LOG" | head -1)
  [ -n "$URL" ] && curl -fsS -o /dev/null "$URL" && break
  sleep 1
done
test -n "$URL"
printf '%s\n' "$URL"

If no URL appears, inspect the complete log before retrying. Do not start multiple servers merely because an expected port is occupied.

Select a route from repository manifests

Documentation pathnames are frozen in site/content/compatibility.json; this is the path authority. The content manifest is the compiled runtime result. For a known document source, query its canonical public path before opening it:

SOURCE='src/Button/index.mdx'
DOC_PATH=$(jq -r --arg source "$SOURCE" \
  '.documents[] | select(.source == $source) | .pathname' \
  site/content/compatibility.json)
test -n "$DOC_PATH"
agent-browser open "$URL$DOC_PATH"

Standalone demo IDs come from site/content/compatibility.json. Query the manifest by source path:

SOURCE='src/Button/demos/index.tsx'
jq -r --arg source "$SOURCE" \
  '.demoReferences[] | select(.source == $source) | "/~demos/" + .legacyId' \
  site/content/compatibility.json

Open the returned route directly. This preserves legacy IDs such as /~demos/docs-demo-docs and avoids reimplementing the canonical-ID algorithm in shell code.

agent-browser open "$URL/~demos/docs-demo-docs"
agent-browser wait --load networkidle
agent-browser snapshot -i

Use the full documentation page when verifying navigation, API tables, search, table of contents, or the relationship between several demos. Use the standalone route for isolated component interaction and rendering checks.

Stable selectors

Prefer accessible names and repository-owned state attributes over generated class names.

SurfaceStable selector
Active documentation link[aria-current="page"]
Standalone demo root[data-standalone-demo]
Demo appearance[data-demo-appearance="light"] or [data-demo-appearance="dark"]
Demo editability[data-demo-editable="true"] or [data-demo-editable="false"]
Demo layout[data-demo-layout]
Live preview state[data-live-state="active"]
Documentation navigation[aria-label="Component documentation"]
Search dialog[aria-label="Search documentation"]
Source editor[aria-label="Demo source editor"]

Use role and accessible-name queries for desktop controls:

agent-browser click 'button[aria-label="Search documentation"]'
agent-browser fill 'input[aria-label="Search documentation"]' 'Button'
agent-browser click 'button[aria-label="Use dark demo theme"]'
agent-browser eval 'document.querySelector("[aria-current=page]")?.textContent'

After switching to a mobile viewport, use button[aria-label="Open search"] from the header.

Re-run agent-browser snapshot -i after every navigation or hot update because element references may have been invalidated.

Capture runtime failures

Install an interceptor before interaction when the scenario can trigger asynchronous rendering:

agent-browser eval --stdin << 'EVALEOF'
(function () {
  window.__CAPTURED_ERRORS = [];
  var originalError = console.error;
  console.error = function () {
    var message = Array.from(arguments).map(function (value) {
      if (value instanceof Error) return value.stack || value.message;
      return typeof value === 'object' ? JSON.stringify(value) : String(value);
    }).join(' ');
    window.__CAPTURED_ERRORS.push(message);
    originalError.apply(console, arguments);
  };
  window.addEventListener('error', function (event) {
    window.__CAPTURED_ERRORS.push('window.onerror: ' + (event.error?.stack || event.message));
  });
  window.addEventListener('unhandledrejection', function (event) {
    window.__CAPTURED_ERRORS.push('unhandledrejection: ' + (event.reason?.stack || event.reason));
  });
  return 'installed';
})()
EVALEOF

After interaction, collect browser and server evidence:

agent-browser eval 'JSON.stringify(window.__CAPTURED_ERRORS || [])'
tail -n 100 /tmp/lobe-ui-docs-dev.log | rg -i 'error|warn|failed'

Treat hydration warnings, uncaught exceptions, unhandled rejections, and failed module loads as test failures. A screenshot without these checks is insufficient.

Required verification flow

For a component change, exercise the smallest complete flow:

  1. Open the canonical documentation path and confirm the expected title.
  2. Confirm the current sidebar entry through [aria-current="page"].
  3. Open the manifest-backed standalone route and confirm [data-standalone-demo] exists.
  4. Exercise every changed interaction using accessible control names.
  5. Verify relevant light and dark appearance states through [data-demo-appearance].
  6. Verify desktop and mobile viewport behavior when layout is affected.
  7. Capture a screenshot for visual evidence and inspect semantic state with eval.
  8. Drain captured browser errors and inspect the development-server log.

Example semantic inspection:

agent-browser eval --stdin << 'EVALEOF'
JSON.stringify({
  activeLink: document.querySelector('[aria-current="page"]')?.textContent?.trim(),
  appearance: document.querySelector('[data-demo-appearance]')?.getAttribute('data-demo-appearance'),
  editable: document.querySelector('[data-demo-editable]')?.getAttribute('data-demo-editable'),
  standalone: Boolean(document.querySelector('[data-standalone-demo]')),
})
EVALEOF

Cleanup

Keep the server alive across related iterations. When explicit cleanup is required, derive its port from the same log and stop only that listener:

PORT=$(grep -Eo 'http://localhost:[0-9]+' /tmp/lobe-ui-docs-dev.log | head -1 | sed 's/.*://')
PIDS=$(lsof -nP -iTCP:"$PORT" -sTCP:LISTEN -t)
[ -n "$PIDS" ] && kill $PIDS

Do not close all browser sessions or terminate unrelated development servers.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Build a product or documentation landing page by arranging @lobehub/ui/awesome components for the hero, live examples, feature sections, and install call to action. Wire links and theming, then review the page for responsive layout and accessibility preferences.

中文简介正在准备中。当前显示英语简介。

  • Create a product landing page from existing components
  • Build a home page for a lobedocs documentation site
  • Add live component examples and feature sections
lobehub/lobe-ui22462026年10月26日 更新

Use this skill to migrate an app from @lobehub/ui 5.x to 6.x. It helps remove obsolete dependencies, update theme setup and imports, address changed component props, and verify the migration with codemod reports and project checks.

中文简介正在准备中。当前显示英语简介。

  • Upgrade an app from @lobehub/ui 5.x to 6.x
  • Replace ThemeProvider and update theme setup
  • Review codemod findings and fix changed component props
lobehub/lobe-ui22462026年10月26日 更新

Use this skill to tune lobe-ui color tokens for brand palettes, status colors, and light or dark themes. It audits contrast and color values, generates scales from new inputs, and prepares a visual review board so people can assess the results.

中文简介正在准备中。当前显示英语简介。

  • Adjust status colors that look pink, gray, muddy, or too dark
  • Create a brand palette for lobe-ui
  • Review contrast in light and dark themes
lobehub/lobe-ui22462026年10月26日 更新

Use this skill to set up and write a static documentation site with @lobehub/docs-kit. It covers site configuration, component pages, interactive demos, API tables, guides, and changelogs, along with the validations that catch documentation issues during a build.

中文简介正在准备中。当前显示英语简介。

  • Set up a documentation site with @lobehub/docs-kit
  • Write component pages with demos and API tables
  • Migrate documentation pages from dumi
lobehub/lobe-ui22462026年10月26日 更新

查看 lobehub 的全部技能

报告此技能的问题