chrome-devtools-frontend 1.0.1652307 → 1.0.1656291
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/fixing-skipped-tests/SKILL.md +32 -0
- package/.agents/skills/migrate-chromium-test/SKILL.md +144 -0
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +116 -0
- package/.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md +82 -0
- package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +123 -0
- package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +125 -0
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +75 -0
- package/AUTHORS +1 -0
- package/config/owner/COMMON_OWNERS +0 -4
- package/docs/get_the_code.md +1 -2
- package/docs/playbook.md +1 -1
- package/docs/ui_engineering.md +3 -1
- package/eslint.config.mjs +0 -5
- package/front_end/Tests.js +1 -0
- package/front_end/core/common/Settings.ts +47 -30
- package/front_end/core/sdk/CPUThrottlingManager.ts +23 -167
- package/front_end/core/sdk/CSSMetadata.ts +23 -0
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +8 -4
- package/front_end/core/sdk/ConsoleModel.ts +13 -11
- package/front_end/core/sdk/DOMDebuggerModel.ts +11 -5
- package/front_end/core/sdk/DOMModel.ts +4 -0
- package/front_end/core/sdk/EmulationModel.ts +4 -0
- package/front_end/core/sdk/EventBreakpointsModel.ts +9 -5
- package/front_end/core/sdk/IsolateManager.ts +6 -6
- package/front_end/core/sdk/ResourceTreeModel.ts +8 -5
- package/front_end/core/sdk/TargetManager.ts +17 -0
- package/front_end/entrypoints/devtools_app/devtools_app.ts +0 -1
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +459 -74
- package/front_end/entrypoints/main/MainImpl.ts +12 -42
- package/front_end/foundation/Universe.ts +116 -3
- package/front_end/generated/InspectorBackendCommands.ts +11 -6
- package/front_end/generated/SupportedCSSProperties.js +124 -34
- package/front_end/generated/protocol-mapping.d.ts +8 -0
- package/front_end/generated/protocol-proxy-api.d.ts +15 -0
- package/front_end/generated/protocol.ts +94 -1
- package/front_end/models/ai_assistance/AiConversation.ts +2 -7
- package/front_end/models/ai_assistance/README.md +4 -3
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +13 -320
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -358
- package/front_end/models/ai_assistance/ai_assistance.ts +6 -8
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +295 -0
- package/front_end/models/ai_assistance/contexts/RequestContext.snapshot.txt +0 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +0 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +10 -10
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +12 -11
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +6 -6
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -14
- package/front_end/models/ai_assistance/skills/accessibility.md +4 -2
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +142 -0
- package/front_end/models/ai_assistance/tools/GetStyles.ts +1 -1
- package/front_end/models/ai_assistance/tools/README.md +21 -1
- package/front_end/models/ai_assistance/tools/{ResolveLighthousePath.ts → ResolveDevtoolsNodePath.ts} +18 -17
- package/front_end/models/ai_assistance/tools/Tool.ts +6 -1
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +4 -2
- package/front_end/models/autofill_manager/AutofillManager.ts +6 -15
- package/front_end/models/bindings/NetworkProject.ts +4 -8
- package/front_end/models/breakpoints/BreakpointManager.ts +9 -9
- package/front_end/models/emulation/DeviceModeModel.ts +24 -0
- package/front_end/models/emulation/EmulatedDevices.ts +108 -0
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +36 -0
- package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +8 -0
- package/front_end/models/issues_manager/IssuesManager.ts +10 -6
- package/front_end/models/javascript_metadata/JavaScriptMetadata.ts +4 -5
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/live-metrics/LiveMetrics.ts +6 -6
- package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +5 -5
- package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +3 -3
- package/front_end/models/logs/LogManager.ts +25 -10
- package/front_end/models/logs/NetworkLog.ts +24 -19
- package/front_end/models/persistence/AutomaticFileSystemManager.ts +14 -13
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +26 -14
- package/front_end/models/persistence/IsolatedFileSystem.ts +9 -11
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +22 -11
- package/front_end/models/persistence/NetworkPersistenceManager.ts +73 -44
- package/front_end/models/persistence/PersistenceImpl.ts +4 -5
- package/front_end/models/project_settings/ProjectSettingsModel.ts +12 -11
- package/front_end/models/trace/EntityMapper.ts +1 -1
- package/front_end/models/trace/handlers/ScreenshotsHandler.ts +14 -59
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +12 -38
- package/front_end/panels/ai_assistance/ExportConversation.ts +4 -1
- package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
- package/front_end/panels/application/DeviceBoundSessionsView.ts +15 -3
- package/front_end/panels/application/FrameDetailsView.ts +2 -1
- package/front_end/panels/application/IndexedDBViews.ts +38 -36
- package/front_end/panels/application/ServiceWorkersView.ts +23 -16
- package/front_end/panels/application/components/AdsView.ts +4 -0
- package/front_end/panels/autofill/AutofillView.ts +1 -1
- package/front_end/panels/autofill/autofill-meta.ts +3 -2
- package/front_end/panels/common/CPUThrottlingOption.ts +142 -0
- package/front_end/panels/common/ThrottlingUtils.ts +9 -4
- package/front_end/panels/common/common.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +45 -0
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +26 -15
- package/front_end/panels/elements/AccessibilityTreeView.ts +12 -9
- package/front_end/panels/elements/ElementsPanel.ts +0 -74
- package/front_end/panels/elements/ElementsTreeOutline.ts +5 -4
- package/front_end/panels/emulation/DeviceModeToolbar.ts +46 -45
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +118 -68
- package/front_end/panels/layer_viewer/Layers3DView.ts +1 -1
- package/front_end/panels/layer_viewer/layerTreeOutline.css +20 -13
- package/front_end/panels/layers/LayersPanel.ts +1 -1
- package/front_end/panels/mobile_throttling/CalibrationController.ts +6 -5
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +1 -1
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +40 -13
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +13 -17
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +79 -30
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +5 -0
- package/front_end/panels/network/LinkPreloadGenerator.ts +101 -0
- package/front_end/panels/network/NetworkLogView.ts +28 -9
- package/front_end/panels/network/NetworkPanel.ts +1 -63
- package/front_end/panels/network/RequestInitiatorView.ts +29 -4
- package/front_end/panels/network/components/HeaderSectionRow.css +9 -7
- package/front_end/panels/network/components/HeaderSectionRow.ts +20 -1
- package/front_end/panels/network/components/RequestHeaderSection.css +5 -3
- package/front_end/panels/network/components/RequestHeaderSection.ts +1 -2
- package/front_end/panels/network/components/RequestHeadersView.css +1 -1
- package/front_end/panels/network/network.ts +2 -0
- package/front_end/panels/profiler/HeapSnapshotView.ts +121 -33
- package/front_end/panels/profiler/ModuleUIStrings.ts +4 -0
- package/front_end/panels/security/SecurityPanel.ts +36 -23
- package/front_end/panels/settings/SettingsScreen.ts +18 -103
- package/front_end/panels/settings/settings-meta.ts +0 -24
- package/front_end/panels/timeline/TimelineController.ts +3 -2
- package/front_end/panels/timeline/TimelineHistoryManager.ts +38 -37
- package/front_end/panels/timeline/TimelinePanel.ts +52 -11
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +20 -18
- package/front_end/panels/timeline/components/LiveMetricsView.ts +38 -38
- package/front_end/panels/timeline/components/MetricCard.ts +18 -18
- package/front_end/panels/timeline/components/liveMetricsView.css +6 -6
- package/front_end/panels/timeline/components/metricCard.css +4 -4
- package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -0
- package/front_end/panels/utils/utils.ts +25 -24
- package/front_end/panels/whats_new/ReleaseNoteText.ts +3 -3
- package/front_end/panels/whats_new/resources/WNDT.md +1 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +34 -55
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +96 -83
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +10 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +3 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +23 -13
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Input.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts +3 -41
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +34 -55
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -3
- package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +3 -2
- package/front_end/third_party/puppeteer/package/src/api/Realm.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/api/Target.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/Realm.ts +1 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +13 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +24 -13
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/LifecycleWatcher.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +7 -76
- package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +5 -0
- package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/util/httpUtils.ts +5 -5
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +3 -0
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -7
- package/front_end/ui/helpers/OpenInNewTab.ts +15 -7
- package/front_end/ui/legacy/InspectorDrawerView.ts +7 -5
- package/front_end/ui/legacy/ListWidget.ts +12 -0
- package/front_end/ui/legacy/SplitWidget.ts +12 -11
- package/front_end/ui/legacy/TabbedPane.ts +1 -108
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +9 -0
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +192 -139
- package/front_end/ui/legacy/components/data_grid/DataGridExporter.ts +89 -0
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +10 -0
- package/front_end/ui/legacy/components/data_grid/data_grid.ts +3 -1
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +8 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +110 -17
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +89 -40
- package/front_end/ui/legacy/treeoutline.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/package.json +4 -3
- package/front_end/Images/navigationControls.png +0 -0
- package/front_end/Images/navigationControls_2x.png +0 -0
- package/front_end/Images/popoverArrows.png +0 -0
- package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -746
- package/front_end/entrypoints/greendev_floaty/floaty.css +0 -301
- package/front_end/entrypoints/greendev_floaty/floaty.html +0 -38
- package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -415
- package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +0 -834
- package/front_end/models/ai_assistance/agents/GreenDevAgentAntigravityCliSocketClient.ts +0 -53
- package/front_end/models/ai_assistance/agents/GreenDevAgentGeminiCliSocketClient.ts +0 -117
- package/front_end/models/annotations/AnnotationRepository.ts +0 -238
- package/front_end/models/annotations/AnnotationType.ts +0 -10
- package/front_end/models/annotations/README.md +0 -7
- package/front_end/models/annotations/annotations.ts +0 -6
- package/front_end/models/greendev/Prototypes.ts +0 -68
- package/front_end/models/greendev/README.md +0 -5
- package/front_end/models/greendev/greendev.ts +0 -5
- package/front_end/panels/common/Annotation.ts +0 -184
- package/front_end/panels/common/AnnotationManager.ts +0 -208
- package/front_end/panels/common/annotation.css +0 -40
- package/front_end/panels/greendev/GreenDevPanel.css +0 -282
- package/front_end/panels/greendev/GreenDevPanel.ts +0 -364
- package/front_end/panels/greendev/GreenDevShared.ts +0 -13
- package/front_end/panels/greendev/greendev-meta.ts +0 -52
- package/front_end/panels/greendev/greendev.ts +0 -9
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fixing-skipped-tests
|
|
3
|
+
description: Use this skill when unskipping a test that was previously skipped.
|
|
4
|
+
---
|
|
5
|
+
# Fixing Skipped Tests
|
|
6
|
+
|
|
7
|
+
This skill outlines the workflow for fixing skipped tests in the DevTools codebase, typically given a Chromium bug link (e.g., `crbug.com/1234567`).
|
|
8
|
+
|
|
9
|
+
## Workflow
|
|
10
|
+
|
|
11
|
+
1. **Extract the Bug ID**
|
|
12
|
+
- The input is typically a bug link like `crbug.com/<bugid>`. Extract the `<bugid>` from the link.
|
|
13
|
+
|
|
14
|
+
2. **Create a Branch**
|
|
15
|
+
- Create a new branch named `fixed-<bugid>`.
|
|
16
|
+
- Ensure you use the instructions from the `devtools-version-control` skill to create and switch branches appropriately.
|
|
17
|
+
|
|
18
|
+
3. **Search for the Skipped Tests**
|
|
19
|
+
- Search the codebase for the `<bugid>` to find skipped tests.
|
|
20
|
+
- You should look for occurrences like `it.skip('[crbug.com/<bugid>] ...', ...)` or skipped describes that mention the bug ID.
|
|
21
|
+
|
|
22
|
+
4. **Iterative Fix Process**
|
|
23
|
+
- **Step 1:** Change `it.skip` or `describe.skip` to `it.only` or `describe.only` for *one* of the tests associated with the bug, so that only that specific test runs.
|
|
24
|
+
- **Step 2:** Re-run the tests (e.g., `npm run test -- <path_to_test_file>`) using the guidelines from the `devtools-verification` skill. If you are dealing with flaky tests, you can use the `--repeat=x` flag (e.g. `npm run test -- <path_to_test_file> --repeat=20`) to run the test multiple times to reproduce the flakiness.
|
|
25
|
+
- **Step 3:** Analyze the test failure and make the necessary fixes to the code or the test itself.
|
|
26
|
+
- **Step 4:** Re-run the test to ensure the fix is correct. Remove `.only`.
|
|
27
|
+
- **Step 5:** Remove the `[crbug.com/<bugid>]` prefix from the test name string if it is present.
|
|
28
|
+
- **Step 6:** Remove any comments directly above the test that explain the reason why the test was skipped (e.g., `// TODO(crbug...): Flaky`).
|
|
29
|
+
- **Step 7:** Apply the fix to the remaining tests, un-skipping them one by one or in batches, and verifying until all are passing.
|
|
30
|
+
|
|
31
|
+
5. **Verify Full Build**
|
|
32
|
+
- Before finishing, run the full verification process (TypeScript checks, linters, full test run) as required by the repository best practices.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devtools-migrate-chromium-test
|
|
3
|
+
description: Use when migrating chromium `third_party/blink/web_tests/http/tests/devtools/` tests to modern unit tests in `third_party/devtools-frontend/src/front_end/`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrating Legacy DevTools Tests
|
|
7
|
+
|
|
8
|
+
The skill should be used from within a Chromium check out. The agent should make a devtools CL for the changes in `third_party/devtools-frontend`.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. **Identify the Test to Move**:
|
|
13
|
+
|
|
14
|
+
- Locate the legacy test file (usually `.js`) and its expectation file (`-expected.txt`) in `third_party/blink/web_tests/http/tests/devtools/`.
|
|
15
|
+
- Example: `unit/datagrid-editable-longtext.js`
|
|
16
|
+
|
|
17
|
+
2. **Identify the Target Location**:
|
|
18
|
+
|
|
19
|
+
- Find the file being tested in `third_party/devtools-frontend/src/front_end/`.
|
|
20
|
+
- Place the new test file next to the file being tested, following the naming convention `[FileName].test.ts`.
|
|
21
|
+
- Example: If testing `ui/legacy/components/data_grid/DataGrid.ts`, the test should be `ui/legacy/components/data_grid/DataGrid.test.ts`.
|
|
22
|
+
|
|
23
|
+
3. **Convert the Test Content**:
|
|
24
|
+
|
|
25
|
+
- Rewrite the test from the legacy `TestRunner` style to the modern Mocha/Chai style used in DevTools.
|
|
26
|
+
- Use `describeWithEnvironment` or `describe` as appropriate.
|
|
27
|
+
- Replace `TestRunner.addResult` and expectation comparisons with standard assertions (`assert.strictEqual`, `assert.isTrue`, etc.).
|
|
28
|
+
- If the test requires rendering, use `renderElementIntoDOM` to attach elements to a test container.
|
|
29
|
+
- If testing legacy components that require internal tokens or have private methods, try to use public APIs or events instead. If impossible, consider using structural typing workarounds or updating the component to be more testable.
|
|
30
|
+
- If tests require a repetitive setup extract it into a test helper function at the top of the file.
|
|
31
|
+
|
|
32
|
+
4. **Update BUILD.gn**:
|
|
33
|
+
|
|
34
|
+
- Add the new test file to the `sources` list of the `devtools_ui_module("unittests")` or `devtools_foundation_module("foundation_unittests")` target in the corresponding `BUILD.gn` file.
|
|
35
|
+
|
|
36
|
+
5. **Verify the Changes**:
|
|
37
|
+
|
|
38
|
+
- Build the unittests target: `autoninja -C out/Default <target_path>:unittests`
|
|
39
|
+
- Run the test using the DevTools test runner: `npm run test -- <relative_path_to_test>`
|
|
40
|
+
- Ensure the test passes.
|
|
41
|
+
|
|
42
|
+
6. **Clean Up**:
|
|
43
|
+
|
|
44
|
+
- Delete the original legacy test file and its expectation file from `third_party/blink/web_tests/...`.
|
|
45
|
+
- _(Optional)_ If instructed by the user, you may leave the files or handle them differently.
|
|
46
|
+
|
|
47
|
+
## Example Conversion
|
|
48
|
+
|
|
49
|
+
### Legacy Test (`datagrid-editable-longtext.js`)
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import { TestRunner } from 'test_runner';
|
|
53
|
+
import * as DataGrid from 'devtools/ui/legacy/components/data_grid/data_grid.js';
|
|
54
|
+
|
|
55
|
+
(async function () {
|
|
56
|
+
TestRunner.addResult('This tests long text in datagrid.');
|
|
57
|
+
// ... setup grid ...
|
|
58
|
+
TestRunner.addResult('Original lengths');
|
|
59
|
+
// ... dump results ...
|
|
60
|
+
TestRunner.completeTest();
|
|
61
|
+
})();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Converted Test (`DataGrid.test.ts`)
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import * as DataGrid from './data_grid.js';
|
|
68
|
+
import { renderElementIntoDOM } from '../../../../testing/DOMHelpers.js';
|
|
69
|
+
import { describeWithEnvironment } from '../../../../testing/EnvironmentHelpers.js';
|
|
70
|
+
|
|
71
|
+
describeWithEnvironment('DataGrid', () => {
|
|
72
|
+
it('tests long text in datagrid', () => {
|
|
73
|
+
// ... setup grid ...
|
|
74
|
+
// Use assertions instead of printing results
|
|
75
|
+
assert.strictEqual(keyElement.textContent.length, 1500);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Tips & Troubleshooting
|
|
81
|
+
|
|
82
|
+
- **TypeScript Type Mismatches**: Legacy tests often use plain strings for properties that now require specific branded types like `LocalizedString`. You can often bypass this in tests by casting the object array `as DataGrid.DataGrid.ColumnDescriptor[]` or similar, or by using `i18n.i18n.lockedString` if appropriate.
|
|
83
|
+
- **Accessing Private Methods**: Legacy tests frequently called private methods (e.g., `dataGrid.update()`). In TypeScript unit tests, you should avoid this. Look for public alternatives (e.g., `updateInstantly()`) or trigger the behavior by dispatching standard DOM events (e.g., `element.dispatchEvent(new Event('scroll'))` instead of calling `onScroll()`).
|
|
84
|
+
- **Recursive Expansion Limits**: Methods like `TreeElement.expandRecursively()` have a default depth limit (e.g., 3) to prevent infinite loops. If your test requires expanding deeper trees, remember to pass a higher max depth argument: `expandRecursively(10)`.
|
|
85
|
+
- **Mocking Objects**: When testing UI components that display objects (like `RemoteObject`), look for existing mock helpers in related test files (e.g., `createDeepRemoteObjectMock` in `ObjectPropertiesSection.test.ts`) instead of trying to create real SDK objects or complex mocks from scratch. Other helpers live inside `front_end/testing`.
|
|
86
|
+
- **Ignoring Environment Failures**: In some environments, `npm run test` may exit with code 1 due to memory leaks (e.g., `WebFrame LEAKED`) or infrastructure issues (e.g., `gpkg` or `Corp Airlock` logs), even if the tests themselves passed. Always check the end of the test log for `TOTAL: X SUCCESS` to confirm if the test logic was successful.
|
|
87
|
+
- **Rendering issue**: If you encounter an issue where checking values never gives correct information it may be due to async rendering. To resolve that you may trying using `raf()` from `front_end/testing/DOMHelpers.ts` to wait for the next rendering cycle.
|
|
88
|
+
|
|
89
|
+
## Creating a DevTools CL from a Chromium Checkout
|
|
90
|
+
|
|
91
|
+
To create a DevTools Change List (CL) from a Chromium checkout, you'll be working within the devtools-frontend repository, which is located inside your Chromium source tree. The depot_tools package (which includes git cl) must be in your PATH.
|
|
92
|
+
|
|
93
|
+
Here's the typical workflow:
|
|
94
|
+
|
|
95
|
+
1. **Navigate to the DevTools Frontend Directory**:
|
|
96
|
+
The DevTools frontend code resides in `third_party/devtools-frontend/src/` within your Chromium checkout (`chromium/src`).
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd path/to/chromium/src/third_party/devtools-frontend/src/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. **Create a New Branch**:
|
|
103
|
+
It's best practice to create a new branch for your changes:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git new-branch my-devtools-feature
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
(Or use `git checkout -b my-devtools-feature`)
|
|
110
|
+
|
|
111
|
+
3. **Make Your Code Changes**:
|
|
112
|
+
Edit the files as needed for your feature or bug fix.
|
|
113
|
+
|
|
114
|
+
4. **Commit Changes Locally**:
|
|
115
|
+
Stage and commit your changes using standard Git commands:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git add .
|
|
119
|
+
git commit -m "My DevTools feature description"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
_See the Chromium guide on commit messages for best practices on formatting descriptions, including the use of tags like Bug:. _
|
|
123
|
+
|
|
124
|
+
5. **Upload the CL for Review**:
|
|
125
|
+
Use `git cl upload` to send your changes to the Chromium Gerrit code review system:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
git cl upload
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This command will create a CL on `https://chromium-review.googlesource.com`. Follow the prompts to add a description, reviewers, etc. You can also add reviewers and trigger builds through the Gerrit web UI.
|
|
132
|
+
|
|
133
|
+
6. **Code Review Process**:
|
|
134
|
+
Your CL will be reviewed by DevTools owners. You may need to address feedback by amending your commit and uploading new patch sets using `git cl upload` again. Once approved, you can land the change via the Commit Queue (CQ).
|
|
135
|
+
|
|
136
|
+
### Working on Changes Across DevTools and Chromium Core
|
|
137
|
+
|
|
138
|
+
- DevTools frontend (`third_party/devtools-frontend/src/`) and the main Chromium codebase (`chromium/src`) are distinct Git repositories.
|
|
139
|
+
- If your work involves changes in both areas, you generally need to create separate CLs: one within the devtools-frontend repo and one within the main `chromium/src` repo.
|
|
140
|
+
- The "Juggling the git submodules" section of the DevTools documentation provides guidance on managing these cross-repository changes.
|
|
141
|
+
|
|
142
|
+
## After finishing the migration
|
|
143
|
+
|
|
144
|
+
Identify any helping tips that you discovered during the migration and add them to this skill.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-eng-vision-local-lit-renderer
|
|
3
|
+
description: Migrates legacy imperative DOM construction to local declarative Lit-html templates rendered inside existing containers.
|
|
4
|
+
allowed-tools: code_search open_urls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Subskill: Local Lit-HTML Renderer (Pass 2)
|
|
8
|
+
|
|
9
|
+
This subskill converts consolidated imperative DOM construction helper methods
|
|
10
|
+
into reactive, declarative Lit-html templates, rendering them locally inside the
|
|
11
|
+
existing element containers.
|
|
12
|
+
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
## 1. Declarative Technology Migration
|
|
16
|
+
|
|
17
|
+
1. **Conserve Abstraction Topology**:
|
|
18
|
+
|
|
19
|
+
* Maintain the existing class hierarchy, helper class boundaries, and
|
|
20
|
+
logical groups.
|
|
21
|
+
* Do not aggressively "flatten" classes or collapse helper abstractions
|
|
22
|
+
into the main view just to coerce a single master template. Pass 2
|
|
23
|
+
should only change the *implementation details* of rendering (imperative
|
|
24
|
+
-> declarative) within existing compartments, not the public API or
|
|
25
|
+
responsibilities of objects.
|
|
26
|
+
|
|
27
|
+
2. **Determine Render Lifecycle per Layer**:
|
|
28
|
+
|
|
29
|
+
* **For UI.Widget classes**: Define or update `performUpdate()` to execute
|
|
30
|
+
the main lit `render` call, and use `this.requestUpdate()` to queue
|
|
31
|
+
updates.
|
|
32
|
+
* **For Delegate/Helper classes**: Identify the custom update hook (e.g.,
|
|
33
|
+
`update()` or `scheduleUpdate()`) and invoke `render()` directly inside
|
|
34
|
+
that method. **Do not** introduce Widget lifecycle methods
|
|
35
|
+
(`performUpdate`) on classes that do not inherit them.
|
|
36
|
+
|
|
37
|
+
3. **Import Modern Templating**:
|
|
38
|
+
|
|
39
|
+
* Import the `Lit` rendering system inside the view module:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import {html, render, nothing} from '../../ui/lit/lit.js';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
4. **Modern Component Mapping**:
|
|
46
|
+
|
|
47
|
+
* Refer to [ui_engineering.md](../../../docs/ui_engineering.md) for
|
|
48
|
+
specific migration examples.
|
|
49
|
+
* If unsure, also consult the [automatic migration code](../../../scripts/eslint_rules/lib/no-imperative-dom-api.ts)
|
|
50
|
+
|
|
51
|
+
5. **Local Modular Renders**:
|
|
52
|
+
|
|
53
|
+
* If the class contains multiple separate legacy container fields (e.g.,
|
|
54
|
+
fields generated by `appendField` or `createChild` on a parent layout),
|
|
55
|
+
prefer **local modular renders** (rendering templates individually into
|
|
56
|
+
each container) to preserve the legacy layout framework. Do not force a
|
|
57
|
+
monolithic template if doing so violates the existing topology.
|
|
58
|
+
|
|
59
|
+
6. **Resolve TypeScript Type Friction**:
|
|
60
|
+
|
|
61
|
+
* Legacy DevTools elements may be typed as `Element`. Lit's `render()`
|
|
62
|
+
function expects `HTMLElement | DocumentFragment`.
|
|
63
|
+
* When rendering into legacy containers, cast the container using `as
|
|
64
|
+
HTMLElement` or update its class property type definition from `Element`
|
|
65
|
+
to `HTMLElement` to satisfy the TypeScript compiler.
|
|
66
|
+
* Example: `render(this.template(), this.containerField as HTMLElement);`
|
|
67
|
+
|
|
68
|
+
7. **Delegate to Unmigrated Rendering Engines**:
|
|
69
|
+
|
|
70
|
+
* Do not attempt to rewrite complex historical subsystems (like Linkifiers
|
|
71
|
+
or specialized UI utilities) to be "pure Lit" during this pass.
|
|
72
|
+
* Capitalize on Lit's ability to interpolate standard `HTMLElement` or `Element` instances directly. Treat unmigrated utilities as "black boxes" that generate DOM, and embed their output in standard template expressions: `html`<div>${this.legacyElement}</div>``.
|
|
73
|
+
|
|
74
|
+
8. **Handle Asynchronous DOM Updates**:
|
|
75
|
+
|
|
76
|
+
* For asynchronous callback-driven updates (e.g., elements updated in a
|
|
77
|
+
`.then()` callback), render the parent container or a placeholder
|
|
78
|
+
template first. Once the data is retrieved, execute a local `render()`
|
|
79
|
+
inside the callback targeting the specific sub-container.
|
|
80
|
+
|
|
81
|
+
9. **Template Factorization Strategies**:
|
|
82
|
+
|
|
83
|
+
* **Prefer `nothing`**: Use Lit's `nothing` sentinel instead of empty
|
|
84
|
+
strings `''` or empty templates for conditional rendering.
|
|
85
|
+
* **Parameterized Fragment Factories**: For repeated UI patterns or
|
|
86
|
+
intermediate layout branches, extract them into parameterized helper
|
|
87
|
+
functions inside the class scope returning `LitTemplate`. This avoids
|
|
88
|
+
monoliths, preserves readability, and reuses template cache strategies.
|
|
89
|
+
|
|
90
|
+
10. **Visual Parity and Accessibility**:
|
|
91
|
+
|
|
92
|
+
* **Zero-Tolerance Regression**: Screenshot tests are the ground truth for this phase. Any visual diff (above 0%) in the generated screenshots is unacceptable and must be resolved before proceeding.
|
|
93
|
+
* **Strict Tag/Class Parity**: Do not change tag types (e.g., `span` to
|
|
94
|
+
`div`) or drop class names during template translation, as CSS may
|
|
95
|
+
depend on them.
|
|
96
|
+
* **Explicit Component Variants**: Modern Custom Element (e.g.
|
|
97
|
+
`<devtools-button>`) defaults may not match legacy appearance.
|
|
98
|
+
Explicitly bind `.data=${{variant: Buttons.Button.Variant.OUTLINED}}`
|
|
99
|
+
(or appropriate variant) rather than relying on defaults.
|
|
100
|
+
* **Accessibility Preservation**: Convert custom accessibility
|
|
101
|
+
instrumentation (like `ARIAUtils.markAsAlert()`) to native ARIA
|
|
102
|
+
attributes in the template (e.g., `role="alert"`, `aria-live="polite"`).
|
|
103
|
+
|
|
104
|
+
11. **Render Templates Syntax & Code Movement**:
|
|
105
|
+
|
|
106
|
+
* Surround the expressions containing lit template literals with `//
|
|
107
|
+
clang-format off` and `// clang-format on` to prevent clang-format from
|
|
108
|
+
corrupting template indentation.
|
|
109
|
+
* **Minimize Code Movement**: Avoid moving existing code to a different location in the file. Put the function signature around the existing code to minimize the diff.
|
|
110
|
+
* The Gerrit Code Review UI cannot identify moved blocks of unchanged code.
|
|
111
|
+
* If blocks of code need to be reordered, create a "prefactoring" change that first extracts the code that needs to be reordered into a named helper functions and pause the migration, waiting user confirmation.
|
|
112
|
+
|
|
113
|
+
12. **Wait for confirmation**:
|
|
114
|
+
|
|
115
|
+
* Wait for an explicit confirmation from the user before proceeding to the
|
|
116
|
+
next step.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-eng-vision-logic-consolidator
|
|
3
|
+
description: Consolidates manual DOM creation, updates, and constructors into private helper methods and structured state interfaces.
|
|
4
|
+
allowed-tools: code_search open_urls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Subskill: Logic Consolidator (Pass 1)
|
|
8
|
+
|
|
9
|
+
This subskill extracts manual layout building, attribute modifications, and
|
|
10
|
+
rendering loops out of the constructor and scattered event handlers,
|
|
11
|
+
consolidating them into private helper methods with explicit data contracts.
|
|
12
|
+
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
## 1. Logic Consolidation Rules
|
|
16
|
+
|
|
17
|
+
1. **Identify UI updates Creation**:
|
|
18
|
+
|
|
19
|
+
* Scan the class constructor and search for manual DOM operations (e.g.,
|
|
20
|
+
`element.createChild('div')`, `document.createElement`,
|
|
21
|
+
`element.appendChild`).
|
|
22
|
+
* Also look for any UI updates which call lit-html `render`.
|
|
23
|
+
|
|
24
|
+
2. **Isolate Update and Draw Operations**:
|
|
25
|
+
|
|
26
|
+
* Group the imperative creation/update lines into dedicated private helper
|
|
27
|
+
methods (e.g., `#updateSummaryBar(...)` or `#createEditorToolbar(...)`).
|
|
28
|
+
* Group event-handling updates (e.g., state variables like `pageSize`,
|
|
29
|
+
modified during buttons clicks) into centralized functions like
|
|
30
|
+
`onPageSizeChanged`.
|
|
31
|
+
|
|
32
|
+
3. **Define the State Interface**:
|
|
33
|
+
|
|
34
|
+
* Identify the class state and ensure it is captured in the private member
|
|
35
|
+
variables, e.g.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
#entries: Entry[];
|
|
39
|
+
#canGoBack: boolean;
|
|
40
|
+
#canGoForward: boolean;
|
|
41
|
+
#staleWarningVisible: boolean;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
* Replace direct mutations of UI with updates to these member variables,
|
|
45
|
+
followed by a call to the public `performUpdate()` method that is
|
|
46
|
+
calling previously extracted update helpers. Use this specific
|
|
47
|
+
identifier.
|
|
48
|
+
|
|
49
|
+
* If there's only one or two update helpers, consider inlining them into the
|
|
50
|
+
`performUpdate`.
|
|
51
|
+
|
|
52
|
+
4. **Extract/Consolidate Rendering Operations**:
|
|
53
|
+
|
|
54
|
+
* If Logic First (imperative DOM remains), make sure all updates to the UI
|
|
55
|
+
go through the performUpdate method
|
|
56
|
+
* If Lit First (Lit template already exists), make sure there's a single
|
|
57
|
+
master call to Lit render inside performUpdate. The master template
|
|
58
|
+
might include calls to the helper functions e.g.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
render(html`
|
|
62
|
+
<div class="specific-view">
|
|
63
|
+
<span>View Title</span>
|
|
64
|
+
${this.renderOverviewSection()}
|
|
65
|
+
</div>
|
|
66
|
+
`, this.contentElement);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
5. **Minimize Diffs (Safety Rule)**:
|
|
70
|
+
|
|
71
|
+
* Avoid moving existing code to a different location in the file. Put the
|
|
72
|
+
function signature around the existing code to minimize the diff.
|
|
73
|
+
* The Gerrit Code Review UI cannot identify moved blocks of unchanged
|
|
74
|
+
code.
|
|
75
|
+
* If blocks of code need to be reordered, create a "prefactoring" change
|
|
76
|
+
that first extracts the code that needs to be reordered into named
|
|
77
|
+
helper functions and pause the migration, waiting for user confirmation.
|
|
78
|
+
|
|
79
|
+
6. **Wait for confirmation**:
|
|
80
|
+
|
|
81
|
+
* Wait for an explicit confirmation from the user before proceeding to the
|
|
82
|
+
next step.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-eng-vision-orchestrator
|
|
3
|
+
description: High-level orchestrator for managing multi-pass migration of Chrome DevTools legacy components to the modern UI engineering vision (UI.Widget & Lit-html).
|
|
4
|
+
allowed-tools: code_search open_urls search_changelists data_analysis import_skill close_skill
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# UI Engineering Vision Orchestrator: Meta-Skill Instructions
|
|
8
|
+
|
|
9
|
+
This meta-skill acts as the central coordinator for modernizing legacy Chrome
|
|
10
|
+
DevTools views into declarative `UI.Widget` components based on lit-html,
|
|
11
|
+
managing a multi-pass sequential CL pipeline to ensure each code modification is
|
|
12
|
+
small, testable, and highly reviewable.
|
|
13
|
+
|
|
14
|
+
Refer to [ui_engineering.md](../../../docs/ui_engineering.md) for general principles.
|
|
15
|
+
|
|
16
|
+
--------------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
## 1. Migration Philosophy & Plan-Validate-Execute Pattern
|
|
19
|
+
|
|
20
|
+
1. **The Plan-Validate-Execute Principle**: For each target file, the
|
|
21
|
+
orchestrator must first generate a structured `migration_plan.md` listing
|
|
22
|
+
the exact transformations, file targets, and subskills allocated for each
|
|
23
|
+
pass.
|
|
24
|
+
2. **User Acceptance Gate**: The orchestrator must halt execution and present
|
|
25
|
+
the migration plan to the user. No code modification, subskill loading, or
|
|
26
|
+
CL staging can occur until the user explicitly accepts the plan.
|
|
27
|
+
3. **No Assumptions on Inheritance**: Do not assume the class hierarchy in a
|
|
28
|
+
file matches older patterns or generic examples. Always perform a structure
|
|
29
|
+
analysis of the active file first and adapt the plan to the actual, current
|
|
30
|
+
code.
|
|
31
|
+
4. **Hybrid Files**: Files may contain multiple classes in different states of
|
|
32
|
+
modernization (e.g., one partially migrated class and one fully legacy
|
|
33
|
+
class). Propose modifications only for classes with actual violations.
|
|
34
|
+
5. **Coupling Analysis**: Always check the integration files (e.g., sidebar
|
|
35
|
+
files, parent panel files) where the target class is instantiated to see if
|
|
36
|
+
there are any direct `.element` or `.contentElement` couplings. If found,
|
|
37
|
+
include the decoupling of these references in the plan.
|
|
38
|
+
6. **Neighboring Component Reference**: Inspect neighboring modernized files of
|
|
39
|
+
the same archetype (e.g., `DOMStorageItemsView.ts` or
|
|
40
|
+
`KeyValueStorageItemsView.ts` for storage-like components) to find proven
|
|
41
|
+
patterns for toolbar and data-grid configurations.
|
|
42
|
+
7. **The Narrow Bridge Principle**: Keep code modifications tightly scoped to a
|
|
43
|
+
single responsibility per CL. Do not combine technology migrations (e.g.,
|
|
44
|
+
converting imperative DOM to Lit-html) with base class refactoring in the
|
|
45
|
+
same diff.
|
|
46
|
+
8. **Never Break Compilation**: Run a compiler build and execute the DevTools
|
|
47
|
+
test suite between every pass.
|
|
48
|
+
9. **Establish Comprehensive Guardrails First**: Ensure both **logic tests**
|
|
49
|
+
(verifying presenter interactions and state updates) and **screenshot tests**
|
|
50
|
+
(verifying layout/styling) exist before rewriting code. If coverage is
|
|
51
|
+
missing, scaffold it first.
|
|
52
|
+
|
|
53
|
+
--------------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
## 2. Multi-Pass Execution Lifecycle
|
|
56
|
+
|
|
57
|
+
### Plan Generation (Gated)
|
|
58
|
+
|
|
59
|
+
* **Actions**:
|
|
60
|
+
1. Scan the target file to determine size, complexity, legacy elements
|
|
61
|
+
(e.g., `ReportView`, `ToolbarButton`, `DataGrid`, `TreeOutline`), and
|
|
62
|
+
actual class inheritance. Deconstruct the file mentally (or in the plan)
|
|
63
|
+
into **Business Logic** (state, event handlers) and **Rendering Logic**
|
|
64
|
+
(DOM creation, CSS classes). Reference code elements by **Name** (not
|
|
65
|
+
line numbers) to ensure the plan remains valid as the codebase evolves.
|
|
66
|
+
Check if the class dependencies have been migrated to the ui eng vision or not.
|
|
67
|
+
2. Check the files depending on this file, to understand how the code in
|
|
68
|
+
this file is being used.
|
|
69
|
+
3. **Dynamic Ordering Decision**: Determine whether to run
|
|
70
|
+
Logic Consolidation first or Local lit-html rendering first:
|
|
71
|
+
* **Option A (Logic First)**: Choose this if the component has a
|
|
72
|
+
complex, nested state model or highly coupled event-handlers.
|
|
73
|
+
Consolidating the state variables and defining the `ViewInput`
|
|
74
|
+
interface first provides a clean data contract, making the
|
|
75
|
+
subsequent template conversion highly deterministic.
|
|
76
|
+
* **Option B (Technology First)**: Choose this if the component has a
|
|
77
|
+
relatively simple state flow but massive, deeply nested imperative
|
|
78
|
+
DOM construction. Converting the layout to declarative Lit templates
|
|
79
|
+
first (using temporary inline or local state) makes it much easier
|
|
80
|
+
to isolate and group the remaining state updates afterward.
|
|
81
|
+
4. Generate a `migration_plan.md` reflecting this ordering and outlining
|
|
82
|
+
the target steps.
|
|
83
|
+
5. Halt execution and print the formatted plan in Markdown to the chat.
|
|
84
|
+
Wait for user approval.
|
|
85
|
+
|
|
86
|
+
### Baseline & Safety Scaffolding
|
|
87
|
+
|
|
88
|
+
* **Trigger Condition**: User explicitly says "I accept the plan" or
|
|
89
|
+
equivalent.
|
|
90
|
+
* **Subskill to Import**: `ui-eng-vision-test-scaffolder`
|
|
91
|
+
* **Actions**:
|
|
92
|
+
1. Verify existing test coverage. Propose and add missing **logic tests**
|
|
93
|
+
for interactions and **screenshot tests** for visual validation to avoid regressions.
|
|
94
|
+
2. Pay extra attention not to skip this step.
|
|
95
|
+
|
|
96
|
+
### Logic Consolidation
|
|
97
|
+
|
|
98
|
+
* **Trigger Condition**: Baseline tests green (or respective previous pass
|
|
99
|
+
staged).
|
|
100
|
+
* **Subskill to Import**: `ui-eng-vision-logic-consolidator`
|
|
101
|
+
* **Actions**:
|
|
102
|
+
1. Extract manual elements, constructor DOM configurations, and imperative
|
|
103
|
+
updates into private update helper methods with structured
|
|
104
|
+
state-passing.
|
|
105
|
+
|
|
106
|
+
### Local Lit-HTML Rendering (Technology Migration)
|
|
107
|
+
|
|
108
|
+
* **Trigger Condition**: Previous pass staged.
|
|
109
|
+
* **Subskill to Import**: `ui-eng-vision-local-lit-renderer`
|
|
110
|
+
* **Actions**:
|
|
111
|
+
1. Migrate imperative elements to declarative templates (using component
|
|
112
|
+
mapping rules defined inside the subskill) and render them locally
|
|
113
|
+
within the existing view.
|
|
114
|
+
|
|
115
|
+
### Widget Promotion (Architectural Bridge)
|
|
116
|
+
|
|
117
|
+
* **Trigger Condition**: Both local template rendering and logic consolidation
|
|
118
|
+
staged.
|
|
119
|
+
* **Subskill to Import**: `ui-eng-vision-widget-promoter`
|
|
120
|
+
* **Actions**:
|
|
121
|
+
1. Promote view classes to modern `UI.Widget` classes, hook up
|
|
122
|
+
`performUpdate()` delegates, export the default view layout, and clean
|
|
123
|
+
up legacy wrappers.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-eng-vision-test-scaffolder
|
|
3
|
+
description: Scaffolds unit tests and screenshot tests to establish visual and functional rendering baselines for views before refactoring.
|
|
4
|
+
allowed-tools: code_search open_urls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Subskill: Test Scaffolder
|
|
8
|
+
|
|
9
|
+
This subskill establishes the safety net of existing and new visual/functional
|
|
10
|
+
tests before any codebase modifications occur, ensuring that no rendering or
|
|
11
|
+
logical regressions are introduced during modernization.
|
|
12
|
+
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
## 1. Test Verification Lifecycle
|
|
16
|
+
|
|
17
|
+
1. **Verify Existing Tests**:
|
|
18
|
+
|
|
19
|
+
* Inspect the corresponding unit test file (e.g., `IndexedDBViews.test.ts`
|
|
20
|
+
for `IndexedDBViews.ts`) under the target folder or `test/unittests/`.
|
|
21
|
+
* Check for **logic tests** (verifying presenter interactions and view function callbacks).
|
|
22
|
+
* Check for screenshot or interaction tests (under `test/interactions/` or
|
|
23
|
+
`test/goldens/`) matching the visual component to verify layout and styling.
|
|
24
|
+
|
|
25
|
+
2. **Detect Sub-component Testing Gaps (Hybrid Files)**:
|
|
26
|
+
|
|
27
|
+
* Identify if the existing test suite only covers one class of a hybrid
|
|
28
|
+
file while missing another class being migrated (e.g., tests exist for
|
|
29
|
+
`IDBDatabaseView` but are scarce/missing for `IDBDataView`).
|
|
30
|
+
|
|
31
|
+
3. **Scaffold Missing Tests**:
|
|
32
|
+
|
|
33
|
+
* If **logic tests** are missing, draft tests verifying that callbacks trigger the expected state updates or model interactions.
|
|
34
|
+
* If **rendering/screenshot tests** are missing or inadequate for the legacy class being
|
|
35
|
+
migrated, draft a basic Mocha/Chai rendering test.
|
|
36
|
+
* Verify that the component compiles and mounts successfully inside a
|
|
37
|
+
synthetic DOM helper or unit-test container.
|
|
38
|
+
* **Screenshot Tests**: Create screenshot tests to establish visual baselines before refactoring. Follow the pattern seen in `CategorizedBreakpointsSidebarPane.test.ts`:
|
|
39
|
+
* First run the test having `renderElementIntoDOM` with `{includeCommonStyles: true}` to ensure styles are applied.
|
|
40
|
+
* The first run will generate the screenshot.
|
|
41
|
+
* Now try removing `{includeCommonStyles: true}` to see if class is
|
|
42
|
+
adding the styles itself. If the test pass, keep the version without
|
|
43
|
+
`{includeCommonStyles: true}`. Otherwise, bring it back.
|
|
44
|
+
* 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).
|
|
45
|
+
* When testing view-separated components, prefer testing the View function (e.g., `DEFAULT_VIEW`) directly by passing mock state and callbacks.
|
|
46
|
+
* Use `assertScreenshot` to capture and verify the visual output.
|
|
47
|
+
* Example structure:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
it('renders the view', async () => {
|
|
51
|
+
const target = document.createElement('div');
|
|
52
|
+
renderElementIntoDOM(target, {includeCommonStyles: true});
|
|
53
|
+
MyComponent.DEFAULT_VIEW(mockViewInput, undefined, target);
|
|
54
|
+
await assertScreenshot('my_component/base.png');
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
4. **Wait for confirmation**:
|
|
59
|
+
|
|
60
|
+
* Wait for an explicit confirmation from the user before proceeding to the next step.
|
|
61
|
+
|
|
62
|
+
--------------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
## 2. Environment Detection & Test Execution Guide
|
|
65
|
+
|
|
66
|
+
Always detect the execution environment first to run tests successfully:
|
|
67
|
+
|
|
68
|
+
### Scenario A: Google-Internal Cog/Cider Workspaces (PRIMARY PATH for Google Workspaces)
|
|
69
|
+
|
|
70
|
+
* **Detection**: Triggered if the workspace path starts with `/google/cog/` or
|
|
71
|
+
`/google/src/`.
|
|
72
|
+
* **Why it is required**: Raw commands like `npm run test` or `autoninja` fail
|
|
73
|
+
because they lack Google cloudtop/virtualization wrapper configurations.
|
|
74
|
+
* **Resolution Steps**:
|
|
75
|
+
|
|
76
|
+
1. Do not run `npm run test` or standard `autoninja` directly.
|
|
77
|
+
2. Leverage the Google-specific Cider testing script to compile and run
|
|
78
|
+
tests in the cloud workspace:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python3 internal/infra/scripts/cider/init_workspace.py test /google/cog/cloud/username/workspace_name --test_filter=front_end/panels/application/IndexedDBViews.test.ts
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Scenario B: Standard Chromium Environment (Fallback)
|
|
85
|
+
|
|
86
|
+
* **Detection**: Triggered if in an open-source or local standard Chromium
|
|
87
|
+
checkout without Cog paths.
|
|
88
|
+
* **Troubleshooting vpython3 / depot_tools errors**:
|
|
89
|
+
|
|
90
|
+
* **Symptom**: Command fails with `vpython3: command not found` or
|
|
91
|
+
`python3_bin_reldir.txt not found`.
|
|
92
|
+
* **Resolution Steps**:
|
|
93
|
+
|
|
94
|
+
1. Export `depot_tools` path:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
export PATH=$PATH:/path/to/depot_tools
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
2. Initialize the depot_tools binaries by running update/gclient help
|
|
101
|
+
once from the checkout root:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
update_depot_tools
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. Execute the tests:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm run test -- front_end/panels/application/IndexedDBViews.test.ts
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Scenario C: ESLint TS Module Resolution Failure (ERR_UNKNOWN_FILE_EXTENSION)
|
|
114
|
+
|
|
115
|
+
* **Symptom**: Running lint checks fails with: `TypeError
|
|
116
|
+
[ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for
|
|
117
|
+
scripts/eslint_rules/...`
|
|
118
|
+
* **Resolution Steps**:
|
|
119
|
+
|
|
120
|
+
1. Compile the custom eslint rules and build assets first so that Node can
|
|
121
|
+
parse the rules:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm run build
|
|
125
|
+
```
|