一键导入
ui-eng-vision-test-scaffolder
Scaffolds unit tests and screenshot tests to establish visual and functional rendering baselines for views before refactoring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffolds unit tests and screenshot tests to establish visual and functional rendering baselines for views before refactoring.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when migrating Chromium layout tests to DevTools unit tests
Use when starting a new task, creating a branch, switching branches, managing branches, creating and uploading CLs, handling stacked changes, or checking release and roll status in the DevTools Gerrit-based workflow. ALWAYS use this instead of running standard git checkout/switch commands for branch creation.
Reproduce and investigate flakiness in a test.
Refactor user-facing UIStrings and localization comments in a DevTools module folder according to UX writing guidelines (child task of b/40799900). Use when simplifying wording, checking sentence case, or improving L10n comments in UIStrings for a specific folder or issue. Don’t use for general code changes or non-UIStrings files.
Migrates legacy imperative DOM construction to local declarative Lit-html templates rendered inside existing containers.
Consolidates manual DOM creation, updates, and constructors into private helper methods and structured state interfaces.
| name | ui-eng-vision-test-scaffolder |
| description | Scaffolds unit tests and screenshot tests to establish visual and functional rendering baselines for views before refactoring. |
| allowed-tools | code_search open_urls |
This subskill establishes the safety net of existing and new visual/functional tests before any codebase modifications occur, ensuring that no rendering or logical regressions are introduced during modernization.
Verify Existing Tests:
IndexedDBViews.test.ts
for IndexedDBViews.ts) under the target folder or test/unittests/.test/interactions/ or
test/goldens/) matching the visual component to verify layout and styling.Detect Sub-component Testing Gaps (Hybrid Files):
IDBDatabaseView but are scarce/missing for IDBDataView).Scaffold Missing Tests:
CategorizedBreakpointsSidebarPane.test.ts:
First run the test having renderElementIntoDOM with {includeCommonStyles: true} to ensure styles are applied.
The first run will generate the screenshot.
Now try removing {includeCommonStyles: true} to see if class is
adding the styles itself. If the test pass, keep the version without
{includeCommonStyles: true}. Otherwise, bring it back.
Screenshot tests are unittests that render either the full widget (if not migrated to the MVP architecture) or its view function (if already in MVP shape).
When testing view-separated components, prefer testing the View function (e.g., DEFAULT_VIEW) directly by passing mock state and callbacks.
Use assertScreenshot to capture and verify the visual output.
Example structure:
it('renders the view', async () => {
const target = document.createElement('div');
renderElementIntoDOM(target, {includeCommonStyles: true});
MyComponent.DEFAULT_VIEW(mockViewInput, undefined, target);
await assertScreenshot('my_component/base.png');
});
Wait for confirmation:
Always detect the execution environment first to run tests successfully:
Detection: Triggered if the workspace path starts with /google/cog/ or
/google/src/.
Why it is required: Raw commands like npm run test or autoninja fail
because they lack Google cloudtop/virtualization wrapper configurations.
Resolution Steps:
Do not run npm run test or standard autoninja directly.
Leverage the Google-specific Cider testing script to compile and run tests in the cloud workspace:
python3 internal/infra/scripts/cider/init_workspace.py test /google/cog/cloud/username/workspace_name --test_filter=front_end/panels/application/IndexedDBViews.test.ts
Detection: Triggered if in an open-source or local standard Chromium checkout without Cog paths.
Troubleshooting vpython3 / depot_tools errors:
Symptom: Command fails with vpython3: command not found or
python3_bin_reldir.txt not found.
Resolution Steps:
Export depot_tools path:
export PATH=$PATH:/path/to/depot_tools
Initialize the depot_tools binaries by running update/gclient help once from the checkout root:
update_depot_tools
Execute the tests:
npm run test -- front_end/panels/application/IndexedDBViews.test.ts
Symptom: Running lint checks fails with: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for scripts/eslint_rules/...
Resolution Steps:
Compile the custom eslint rules and build assets first so that Node can parse the rules:
npm run build