Skip to content

Commit c3c2069

Browse files
committed
feat: add UI tests with vscode-extension-tester
1 parent 17b2ebe commit c3c2069

File tree

9 files changed

+5457
-408
lines changed

9 files changed

+5457
-408
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ node_modules
1010
# Test coverage
1111
coverage/
1212
.nyc_output/
13+
14+
# ExTester storage
15+
.test-extensions/

.vscode-test-ui.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
vscodeVersion: "stable",
3+
extensions: [],
4+
settings: {
5+
mocha: {
6+
ui: "bdd",
7+
timeout: 20000,
8+
color: true,
9+
},
10+
},
11+
};

CLAUDE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Claude Code AI Agents
2+
3+
This project includes AI agents powered by Claude Code to assist with development tasks.
4+
5+
## Available Agents
6+
7+
For detailed information about the available AI agents, their capabilities, and usage instructions, please see:
8+
9+
**[AGENTS.md](./AGENTS.md)**
10+
11+
## What are AI Agents?
12+
13+
AI agents are specialized Claude Code tools that can autonomously perform complex tasks such as:
14+
- Writing security vulnerability reports
15+
- Searching historical audit findings
16+
- Creating executive summaries for security audits
17+
- Analyzing code for security issues
18+
19+
## Getting Started
20+
21+
1. Ensure you have Claude Code installed and configured
22+
2. Review the [AGENTS.md](./AGENTS.md) file for available agents
23+
3. Invoke agents using the `/` command syntax described in the documentation
24+
25+
## Contributing
26+
27+
When adding new agents, please update the [AGENTS.md](./AGENTS.md) file with:
28+
- Agent name and description
29+
- Usage examples
30+
- Required inputs/parameters
31+
- Expected outputs

TESTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| `mocha` + `chai` | Unit test runner and assertions |
88
| `sinon` | Stubs and mocks |
99
| `@vscode/test-electron` | Extension-host tests with real VS Code APIs |
10+
| `vscode-extension-tester` | **NEW**: UI automation with Selenium WebDriver |
1011
| `jsdom` | Webview DOM simulation |
1112
| `nyc` | Coverage reporting (target: 80% for `types.ts`, 60% overall) |
1213

@@ -16,11 +17,69 @@
1617
test/
1718
├── unit/ # Pure logic, no VS Code host (fast)
1819
├── extension/ # Extension-host tests via @vscode/test-electron
20+
├── ui/ # **NEW**: UI tests with vscode-extension-tester
21+
│ └── suite/ # UI automation tests (InputBox, QuickPick, TreeView)
1922
├── webview/ # DOM tests with jsdom
2023
├── mocks/ # Shared mock factories
2124
└── fixtures/ # Sample workspaces and .weaudit files
2225
```
2326

27+
## UI Testing with vscode-extension-tester
28+
29+
**NEW**: We use [vscode-extension-tester](https://github.com/redhat-developer/vscode-extension-tester) (ExTester) for full UI automation. This allows us to:
30+
- Type into InputBox and QuickPick elements programmatically
31+
- Interact with tree views (click, expand, verify content)
32+
- Test the actual user experience, not just the API
33+
34+
### Key Capabilities
35+
36+
- **InputBox Interaction**: Can type custom titles for findings/notes
37+
- **TreeView Testing**: Can click items, verify labels, test drag-and-drop
38+
- **Command Palette**: Can invoke commands via UI
39+
- **Full User Experience**: Tests what users actually see and interact with
40+
41+
### Running UI Tests
42+
43+
```bash
44+
# Run all tests (unit + integration + UI)
45+
npm run test:all
46+
47+
# Run only UI tests
48+
npm run test:ui
49+
50+
# Setup UI test environment (download VS Code + ChromeDriver)
51+
npm run test:ui-setup
52+
```
53+
54+
### Example UI Test
55+
56+
```typescript
57+
import { InputBox, Workbench } from 'vscode-extension-tester';
58+
59+
it("should create finding with custom title", async () => {
60+
const workbench = new Workbench();
61+
62+
// Execute command
63+
await workbench.executeCommand("weAudit: New Finding from Selection");
64+
65+
// Type into input box (impossible with @vscode/test-electron!)
66+
const input = await InputBox.create();
67+
await input.setText("SQL Injection Vulnerability");
68+
await input.confirm();
69+
70+
// Verify in tree view
71+
// ... assertions
72+
});
73+
```
74+
75+
### Hybrid Testing Strategy
76+
77+
We use **both** testing frameworks:
78+
- `@vscode/test-electron` - Fast integration tests for API-level operations
79+
- `vscode-extension-tester` - UI tests for InputBox, QuickPick, TreeView interactions
80+
81+
This gives us the best of both worlds: speed + comprehensive coverage.
82+
2483
---
2584

2685
## Phase 1: Data Integrity (P0)

0 commit comments

Comments
 (0)