Skip to content

Commit e509c51

Browse files
committed
chore: update Testing.md
1 parent 2b19489 commit e509c51

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

TESTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,73 @@ We use **both** testing frameworks:
8080

8181
This gives us the best of both worlds: speed + comprehensive coverage.
8282

83+
### Current UI Coverage (ExTester)
84+
85+
UI tests live in `test/ui/suite/` and are run via `npm run test:ui`.
86+
87+
**Added UI tests**
88+
89+
Implemented in `test/ui/suite/commands.ui.test.ts`:
90+
- Create finding with a custom title (`weAudit: New Finding from Selection`)
91+
- Cancel finding creation (Escape in QuickInput)
92+
- Create note with a custom title (`weAudit: New Note from Selection`)
93+
- Edit finding under cursor (`weAudit: Edit Finding Under Cursor`)
94+
- Add an additional region via QuickPick (`weAudit: Add Region to a Finding`)
95+
96+
**Added extension-host tests (non-UI)**
97+
98+
Implemented under `test/extension/suite/`:
99+
- Command registration and activation (`test/extension/suite/activation.test.ts`)
100+
- Basic command execution and persistence (`test/extension/suite/commands.test.ts`)
101+
- `weAudit.addFinding` / `weAudit.addNote` (accepts empty title due to QuickInput limitations)
102+
- `weAudit.showMarkedFilesDayLog`
103+
- Tree view integration (`test/extension/suite/treeViews.test.ts`)
104+
- `weAudit.toggleTreeViewMode`
105+
- `weAudit.findAndLoadConfigurationFiles`
106+
- Decoration integration (`test/extension/suite/decorations.test.ts`)
107+
- `weAudit.toggleAudited`
108+
- `weAudit.addPartiallyAudited`
109+
110+
**Not yet added (UI candidates)**
111+
112+
From `package.json` and `src/codeMarker.ts`, the remaining UI-heavy commands worth adding coverage for:
113+
- QuickPick / QuickInput flows:
114+
- `weAudit: Export Findings as Markdown` (`weAudit.exportFindingsInMarkdown`) – multi-select quick pick and opens markdown editor
115+
- `weAudit: Add Region to a Finding with Label` (`weAudit.addRegionToAnEntryWithLabel`) – quick pick + label input box
116+
- `weAudit: Edit Repository URL (Client)` (`weAudit.editClientRemote`) – input box
117+
- `weAudit: Edit Repository URL (Audit)` (`weAudit.editAuditRemote`) – input box
118+
- `weAudit: Edit Git Commit Hash` (`weAudit.editGitHash`) – input box
119+
- Tree view / command palette UX:
120+
- `weAudit: Search and Filter Findings` (`weAudit.showFindingsSearchBar`) – triggers `list.find` on the tree view
121+
- `Toggle View Mode` (`weAudit.toggleTreeViewMode`) – already covered in extension-host tests; UI coverage would verify the actual tree structure changes
122+
- Context menu & multi-step flows:
123+
- `Resolve Finding` / `Restore Finding` / delete flows (`weAudit.resolveFinding`, `weAudit.restoreFinding`, `weAudit.deleteFinding`, `weAudit.deleteLocationUnderCursor`, `weAudit.deleteLocation`)
124+
125+
**Not yet added (other command candidates)**
126+
127+
These are typically better suited to extension-host tests (stubbing VS Code APIs) or webview tests:
128+
- Clipboard/external actions:
129+
- `weAudit.openGithubIssue`, `weAudit.openGithubIssueFromDetails` (stub `vscode.env.openExternal`)
130+
- `weAudit.copyEntryPermalink`, `weAudit.copyEntryPermalinks`, `weAudit.copySelectedCodePermalink`, `weAudit.copySelectedCodeClientPermalink` (stub `vscode.env.clipboard`)
131+
- Navigation and toggles:
132+
- `weAudit.navigateToNextPartiallyAuditedRegion` (assert cursor position changes)
133+
- `weAudit.toggleFindingsHighlighting` (assert decorations/visibility changes)
134+
- Resolved findings lifecycle:
135+
- `weAudit.resolveFinding`, `weAudit.restoreFinding`, `weAudit.deleteResolvedFinding`, `weAudit.deleteAllResolvedFinding`, `weAudit.restoreAllResolvedFindings`
136+
- Webview wiring (from `src/codeMarker.ts` command registrations not exposed as palette commands):
137+
- `weAudit.updateCurrentSelectedEntry`, `weAudit.updateGitConfig`, `weAudit.showSelectedEntryInFindingDetails`
138+
139+
**How we use ExTester successfully**
140+
141+
Key patterns that made the UI tests stable:
142+
- Prefer `VSBrowser.instance.openResources(...)` over `vscode.open` to open the fixture workspace and files without extra QuickInput interactions.
143+
- Avoid polling tree view contents during waits (it opens the weAudit view repeatedly and causes unnecessary UI churn). Instead, assert via the persisted `.vscode/<username>.weaudit` file when possible.
144+
- QuickPick tip: `InputBox.selectQuickPick(...)` often auto-accepts single-select quick picks; calling `confirm()` afterwards can throw `ElementNotInteractableError`.
145+
- Editor selection tip: `TextEditor.getTextAtLine()` selects the whole file internally (it uses a copy-to-clipboard implementation). Avoid it for selection logic.
146+
- Cursor positioning tip: `TextEditor.setCursor(line, column)` uses 1-based columns (it drives the `:Ln,Col` UI); column `0` will time out.
147+
- Timeouts: UI tests should use a suite-level Mocha timeout instead of scattered `this.timeout(...)` calls. This repo uses `test/ui/.mocharc.json` and passes it via `--mocha_config` in `package.json`.
148+
- Extension isolation: UI tests run with `--disable-extensions` and an isolated `--extensions_dir` (`.test-extensions/extensions`) to prevent local VS Code extensions from affecting runs.
149+
83150
---
84151

85152
## Phase 1: Data Integrity (P0)

0 commit comments

Comments
 (0)