Skip to content

Commit 04099a6

Browse files
rajbosCopilot
andauthored
feat: add local view regression test command (#569)
Adds a debug-only command 'copilot-token-tracker.runLocalViewRegression' that opens each webview panel in sequence, injects a DOM probe script, waits for real content to appear, and prints a pass/fail summary to the Output channel. Key implementation details: - viewRegression.ts: pure helper module (probe config, evaluator, formatter) - Probe script calls acquireVsCodeApi() first then patches window.acquireVsCodeApi to return the cached instance, so the main bundle can call it safely without throwing 'An instance has already been acquired' - Probe script is injected before the main bundle <script> so it begins watching the DOM immediately - onDidReceiveMessage is registered before webview.html is assigned so no messages are missed - Real local session data is used by default; bundled fixtures are the fallback if no session files exist on disk - 4 unit tests for helper logic (all passing) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ff1ff98 commit 04099a6

File tree

7 files changed

+760
-33
lines changed

7 files changed

+760
-33
lines changed

vscode-extension/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Search for **"AI Engineering Fluency"** in the VS Code Extensions panel, or inst
2020
- **Social Media Sharing**: Share your Fluency Score achievements on LinkedIn, Bluesky, and Mastodon with #CopilotFluencyScore
2121
- **Usage Analysis Dashboard**: Comprehensive analytics on how you use Copilot (modes, tool calls, context references, MCP tools)
2222
- **Fluency Level Viewer**: Debug-only tool to explore all scoring rules and thresholds (requires active debugger)
23+
- **Local View Regression**: Debug-only check that opens the main views with bundled sample data and reports whether each webview rendered non-empty output
2324
- **Automatic Updates**: Refreshes every 5 minutes to show the latest usage
2425
- **Click to Refresh**: Click the status bar item to manually refresh the token count
2526
- **Smart Estimation**: Uses character-based analysis with model-specific ratios for token estimation
@@ -107,6 +108,16 @@ A debug-only tool that displays all fluency score rules, thresholds, and tips fo
107108

108109
For detailed scoring rules, see [Fluency Levels Documentation](https://github.com/rajbos/github-copilot-token-usage/blob/main/docs/FLUENCY-LEVELS.md).
109110

111+
**Local View Regression (Debug Mode)**
112+
113+
A debug-only regression helper that opens the main local views in the Extension Development Host and reports whether each webview rendered non-empty content.
114+
115+
- **Access**: Run `AI Engineering Fluency: Run Local View Regression (Debug Only)` from the Command Palette while debugging the extension
116+
- **Data Source**: Uses your real local session data first; if none is found, it falls back to the bundled sample session fixtures under `vscode-extension/test/fixtures/sample-session-data/chatSessions`
117+
- **Coverage**: Details, Chart, Usage Analysis, Fluency Score, Environmental Impact, Diagnostics, and Fluency Level Viewer
118+
- **Output**: Shows a pass/fail summary in the extension output channel and leaves the opened views visible for quick manual inspection
119+
- **Note**: Team Dashboard is intentionally skipped because it requires a configured backend
120+
110121
---
111122

112123
## Usage Analysis Dashboard

vscode-extension/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
"title": "Show Fluency Level Viewer (Debug Only)",
6161
"category": "AI Engineering Fluency"
6262
},
63+
{
64+
"command": "copilot-token-tracker.runLocalViewRegression",
65+
"title": "Run Local View Regression (Debug Only)",
66+
"category": "AI Engineering Fluency"
67+
},
6368
{
6469
"command": "copilot-token-tracker.configureBackend",
6570
"title": "Configure Backend",

0 commit comments

Comments
 (0)