用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ChromeDevTools/devtools-frontend --skill migrate-chromium-test命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Interacts with the public Gerrit Code Review platform using depot_tools' gerrit_client.py. Use this skill when asked to query public CLs, retrieve published review comments, inspect formatted patches or complete file revisions, add patchset comments, vote on review labels, submit changes, or abandon/restore public CLs. Do not use this skill for Google-internal attention set updates or internal AI-assisted code reviews (CRUAS), which are unsupported by the public API.
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.
Use this skill when unskipping a test that was previously skipped.
基于 SOC 职业分类
正在显示 SKILL.md
| name | migrate-chromium-test |
| description | Use when migrating Chromium layout tests to DevTools unit tests or API tests. |
.js) and its expectation file (-expected.txt) in your initial prompt.Investigate what files are being tested, start location should be front_end/.Consult the devtools-testing-guidance skill to select the appropriate test suite.
TestRunner calls into modern Mocha (describe, it) and Chai assertions (assert.strictEqual, assert.isTrue, assert.deepEqual, assert.isNotNull, assert.instanceOf).devtools-imports skill:
import * as Module from '../module/module.js').import * as for cross-module imports..js file extensions (e.g., ./data_grid.js).foundation-test-migration skill. Use TestUniverse and setup hooks (setupLocaleHooks(), setupSettingsHooks(), setupRuntimeHooks()) instead of DOM-heavy singletons or describeWithEnvironment. Use universe.createTarget() and MockCDPConnection for CDP mocking.devtools-ui-widgets skill. Use renderElementIntoDOM from front_end/testing/DOMHelpers.js for mounting elements, or createViewFunctionStub and view.nextInput from front_end/testing/ViewFunctionHelpers.js for testing MVP widgets.// Replaces web test: http/tests/devtools/.... Since migrated web tests are deleted, these references become stale.Every newly created test file must be added to the appropriate target in its folder's BUILD.gn:
[!IMPORTANT] If you omit the test file from
BUILD.gn, the test target will not be compiled by Ninja and will be skipped by test runners.
Use the devtools-verification skill to build and verify your changes.
Follow the version-control skill when uploading CLs.
Follow the following format and constraints:
[test-migration] Migrate <short test name> test to unit testThis CL migrates the legacy layout test <long test name> to a unit test in <new test name>. <optional additional explanation>https://crsrc.org/c/third_party/blink/web_tests/<long test name>;drc=4d51e9cab50efd0f8029c45a486e199a1d519fd1Fixed: <issue number>Example commit message:
[test-migration] Migrate console-eval-global test to unit test
This CL migrates the legacy layout test
http/tests/devtools/console/console-eval-global.js to a unit test in
ConsolePrompt.test.ts. It verifies that the evaluation in ConsolePrompt
is performed in the correct execution context (the active one) and with
the correct expression.
https://crsrc.org/c/third_party/blink/web_tests/http/tests/devtools/console/console-eval-global.js;drc=4d51e9cab50efd0f8029c45a486e199a1d519fd1
Fixed: <issue number>
DataGrid.test.ts)datagrid-editable-longtext.js)import {TestRunner} from 'test_runner';
import * as DataGrid from 'devtools/ui/legacy/components/data_grid/data_grid.js';
(async function () {
TestRunner.addResult('This tests long text in datagrid.');
// ... setup grid ...
TestRunner.addResult('Original lengths');
// ... dump results ...
TestRunner.completeTest();
})();
DataGrid.test.ts)import {renderElementIntoDOM} from '../../../../testing/DOMHelpers.js';
import {describeWithEnvironment} from '../../../../testing/EnvironmentHelpers.js';
import * as DataGrid from './data_grid.js';
describeWithEnvironment('DataGrid', () => {
it('tests long text in datagrid', () => {
// ... setup grid ...
const grid = new DataGrid.DataGrid.DataGridImpl({...});
renderElementIntoDOM(grid.element);
// Use Chai assertions instead of printing results.
assert.strictEqual(keyElement.textContent.length, 1500);
});
});
LocalizedString. You can bypass this in tests by casting (as DataGrid.DataGrid.ColumnDescriptor[]) or by using i18n.i18n.lockedString where appropriate.dataGrid.update()). Look for public alternatives (e.g., updateInstantly()) or trigger the behavior by dispatching standard DOM/SDK events (e.g., element.dispatchEvent(new Event('scroll'))).front_end/testing/: Check existing helper utilities before writing custom boilerplate:
DOMHelpers.ts: renderElementIntoDOM, dispatchAndAwait.ViewFunctionHelpers.ts: createViewFunctionStub, view.nextInput (for MVP widget tests).MockCDPConnection.ts: Scoped protocol mocking.SourceMapHelpers.ts, TraceHelpers.ts, ConsoleHelpers.ts, SettingsHelpers.ts etc.raf() from front_end/testing/DOMHelpers.js.TreeElement.expandRecursively() have default depth limits (e.g. 3). Pass a higher max depth argument if your test requires deeper tree expansion: expandRecursively(10).createDeepRemoteObjectMock in ObjectPropertiesSection.test.ts) instead of instantiating real objects from scratch.WebFrame LEAKED) or Corp Airlock warnings. Always inspect the summary line at the end of the test log for TOTAL: X SUCCESS to confirm if test logic passed.If you encountered any novel issues, workarounds, or helpful tips during the migration that are not already documented, please inform the user so the skill documentation can be further updated.