Scaffolds unit tests and screenshot tests to establish visual and functional rendering baselines for views before refactoring.
81%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
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/.
Execution Guide: Follow devtools-verification.
Resolution Steps:
Ensure depot_tools is at the front of your PATH:
export PATH="/path/to/depot_tools:$PATH"Execute tests using ./dt test directly from chromium/third_party/devtools-frontend/src:
./dt test front_end/panels/application/IndexedDBViews.test.tsDetection: 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_toolsInitialize the depot_tools binaries by running update/gclient help once from the checkout root:
update_depot_toolsExecute the tests:
./dt test front_end/panels/application/IndexedDBViews.test.tsSymptom: 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:
./dt builddiv -> span).{includeCommonStyles: true}.describe vs describeWithEnvironment)Prefer describe with lightweight hooks (setupLocaleHooks(), setupSettingsHooks()) when full describeWithEnvironment is unnecessary.
Always reset singleton registries in afterEach:
When registering actions, shortcuts, or context menus in tests, singleton registries MUST be reset in afterEach:
afterEach(() => {
UI.ActionRegistration.reset();
UI.ActionRegistry.ActionRegistry.reset();
UI.ShortcutRegistry.ShortcutRegistry.removeInstance();
});Without these resets, repeated runs (such as --repeat=10 or CQ flake detection) will fail on iteration 2+ with Duplicate action ID: '...'.
GlassPane Container Setup:
If testing UI that opens a GlassPane or long-press option menu (e.g. bindToAction with long-press buttons) in a test suite using describe without describeWithEnvironment, call:
beforeEach(() => {
UI.GlassPane.GlassPane.setContainer(document.body);
});Otherwise, menu rendering will fail because GlassPane lacks an attached container element.
Before reporting back or committing, re-read the instructions and verify:
ChromeDevTools/devtools-frontend
82e99f9
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.