Use when migrating Chromium layout tests to DevTools unit tests or API tests.
78%
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
Fix and improve this skill with Tessl
tessl review fix ./.agents/skills/migrate-chromium-test/SKILL.md.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.
http/tests/devtools/ test exercises only Blink or V8 CDP backend commands (TestRunner.*Agent.invoke_*) without testing front_end/ logic, migrate it in chromium/src to third_party/blink/web_tests/inspector-protocol/ (or third_party/blink/web_tests/http/tests/inspector-protocol/ when OOPIFs or an HTTP server are needed), starting any new Blink HTML test resource with <!DOCTYPE html>.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).describeWithEnvironment and describeWithMockConnection are banned in all new and migrated unit tests; both foundation and UI/widget tests use plain describe (from 'mocha') with TestUniverse and modular setup hooks (setupLocaleHooks(), setupSettingsHooks(), setupRuntimeHooks()).
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. When adding a brand-newunittests,foundation_unittests, orapi_teststarget in a subdirectoryBUILD.gn, also wire it into the matching rootgroup(...)infront_end/BUILD.gn(seedevtools-testing-guidance).
Use the devtools-verification skill to build and verify your changes.
Follow the devtools-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=4d51e9cab50efd0f8029c45a486e199a1d519fd1Bug: <issue number> on the devtools-frontend CL when a follow-up chromium/src CL still needs to delete the legacy web test, and Fixed: <issue number> only on the final CL that completes the migration (such as the chromium/src deletion CL or a single-CL inspector-protocol/ migration, where you may also pair the issue's active parent tracker in Bug:; never reference closed bug 407751692).Ai-Assisted: true in the footer block for AI-assisted CLs.KEY=VALUE tags (such as TAG=agy or CONV=...); use Git trailers only (PRESUBMIT.py rejects Piper tags).chromium/src expectations on deletion: When deleting the legacy .js and -expected.txt files in chromium/src, remove any matching entries from TestExpectations, MSANExpectations, ASANExpectations, LeakExpectations, FlagExpectations/*, SlowTests, and NeverFixTests under third_party/blink/web_tests/.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
Bug: <issue number>
Ai-Assisted: trueDataGrid.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 {assert} from 'chai';
import {describe, it} from 'mocha';
import {renderElementIntoDOM} from '../../../../testing/DOMHelpers.js';
import {setupLocaleHooks} from '../../../../testing/LocaleHelpers.js';
import * as DataGrid from './data_grid.js';
describe('DataGrid', () => {
setupLocaleHooks();
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.
ChromeDevTools/devtools-frontend
9d90722
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.