Skip to content

Testing: Phase 5 - Extension integration tests #102

@fegge

Description

@fegge

Parent issue: #90

Overview

Implement extension integration tests that run inside a real VS Code instance via @vscode/test-electron. These tests verify that the extension integrates correctly with VS Code APIs and provides end-to-end validation of extension functionality.

Test Categories

Extension Activation (7 tests)

Test Type
Extension activates on workspace open +
Extension activates on view open +
Extension exports public API +
Extension registers all commands +
Extension creates tree views +
Extension handles missing .vscode folder +
Extension handles corrupt .weaudit file -

Command Execution (19 tests)

Test Type
weAudit.addFinding creates finding at selection +
weAudit.addFinding prompts for label +
weAudit.addFinding cancels on escape -
weAudit.addNote creates note at selection +
weAudit.editEntryLabel updates existing label +
weAudit.deleteEntry removes entry +
weAudit.deleteEntry handles multi-location entry +
weAudit.toggleAudited marks file as reviewed +
weAudit.toggleAudited unmarks reviewed file +
weAudit.addPartiallyAudited marks region +
weAudit.resolveFinding moves to resolved tree +
weAudit.restoreFinding moves back to active +
weAudit.copyPermalink copies to clipboard +
weAudit.copyClientPermalink uses client remote +
weAudit.openGitHubIssue opens external URL +
weAudit.exportFindings creates markdown file +
weAudit.showDayLog displays log in output +
weAudit.navigateToNextPartiallyAuditedRegion moves cursor +
weAudit.setTreeViewMode toggles view mode +

Tree View Integration (10 tests)

Test Type
Findings tree view shows entries +
Findings tree view updates on add +
Findings tree view updates on delete +
Findings tree view click opens file +
Findings tree view context menu appears +
Resolved tree view shows resolved entries +
Saved findings tree shows .weaudit files +
Saved findings tree toggles visibility +
Tree view drag-and-drop reorders +
Tree view refresh command works +

Editor Decorations (10 tests)

Test Type
Finding decorations appear on marked lines +
Note decorations appear on marked lines +
Audited file decoration covers all lines +
Partial audit decoration covers region only +
Decorations update on file edit +
Decorations clear on entry delete +
Gutter icons appear for findings +
Hover shows finding label +
Decoration colors respect configuration +
Theme change updates decorations +

Webview Panels (8 tests)

Test Type
Finding details panel opens +
Finding details panel shows entry data +
Finding details panel updates on selection +
Finding details panel saves changes +
Git config panel opens +
Git config panel shows repository URLs +
Git config panel saves changes +
Webview survives editor close/reopen +

Workspace Operations (8 tests)

Test Type
Single-root workspace loads findings +
Multi-root workspace loads all roots +
Adding workspace folder updates tree +
Removing workspace folder updates tree +
File rename updates entry locations +
File delete prompts for entry removal +
External .weaudit change reloads +
Configuration change updates behavior +

File Decorations - Explorer (4 tests)

Test Type
Audited files show badge in explorer +
Partially audited files show different badge +
Badge updates on audit toggle +
Badge respects file filter +

Error Handling (5 tests)

Test Type
Invalid selection shows error message -
Missing workspace shows warning -
Git remote not configured shows warning -
Concurrent saves handled correctly +
Large file handling doesn't freeze UI +

Performance (4 tests)

Test Type
Extension activates under 500ms +
Tree view renders 100 entries under 100ms +
File decoration applies under 50ms +
Large .weaudit file (1000 entries) loads +

Tasks

  • Create test directory structure:
    test/extension/
    ├── suite/
    │   ├── index.ts
    │   ├── activation.test.ts
    │   ├── commands.test.ts
    │   ├── treeViews.test.ts
    │   ├── decorations.test.ts
    │   └── workspace.test.ts
    └── fixtures/
        └── sample-workspace/
    
  • Create test runner configuration (test/extension/suite/index.ts)
  • Create sample workspace fixture with pre-populated .weaudit file
  • Implement activation tests
  • Implement command execution tests
  • Implement tree view integration tests
  • Implement decoration tests
  • Implement webview panel tests
  • Implement workspace operation tests
  • Implement error handling tests
  • Implement performance tests

Acceptance Criteria

  • npm run test:ext runs all extension tests
  • Tests pass on all platforms (Linux, macOS, Windows)
  • Tests pass on VS Code stable and insiders
  • All 75 planned tests implemented
  • Tests complete within CI timeout (10 minutes)

Reference

See TESTING.md Phase 5 for detailed test specifications.

Total: 75 tests

Metadata

Metadata

Assignees

Labels

testingTest-related issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions