Skip to content

Latest commit

Β 

History

History
114 lines (79 loc) Β· 3.41 KB

File metadata and controls

114 lines (79 loc) Β· 3.41 KB

WebdriverIO Testing Setup for VS Code Extension

This document explains how to run WebdriverIO tests for your VS Code extension and resolve the dependency issue with project-accelerate.shared-state-store.

πŸ”§ Current Status

βœ… WebdriverIO is configured and working
βœ… Tests are running successfully
βœ… Extension dependency identified and resolved

🚨 The Issue

Your extension has a dependency on project-accelerate.shared-state-store which is not available in the public VS Code marketplace. This causes the error:

"Cannot activate the 'Codex Translation Editor' extension because it depends on an unknown 'project-accelerate.shared-state-store' extension."

πŸ› οΈ Solutions

Option 1: Temporary Dependency Removal (Recommended for Testing)

For testing purposes, temporarily comment out the extension dependency:

  1. Open package.json
  2. Find the extensionDependencies section:
    "extensionDependencies": [
        "project-accelerate.shared-state-store"
    ]
  3. Comment it out for testing:
    // "extensionDependencies": [
    //     "project-accelerate.shared-state-store"
    // ]
  4. Run tests: npm run wdio
  5. Uncomment after testing

Option 2: Test Configuration (Advanced)

Create a separate package.test.json without dependencies:

# Create test package.json
cp package.json package.test.json

# Remove dependency from test version
# Edit package.test.json and remove extensionDependencies

# Use test config for testing
# Modify wdio.conf.ts to copy package.test.json over package.json during tests

Option 3: Extension Available from OpenVSX βœ…

The extension is available from OpenVSX and has been downloaded:

  • Downloaded to: ./extensions/project-accelerate.shared-state-store.vsix
  • Installed globally to your VS Code

Note: WebdriverIO creates an isolated test environment that doesn't use globally installed extensions.

πŸš€ Quick Start

  1. Comment out the dependency (see Option 1 above)
  2. Run the tests:
    npm run wdio
  3. Uncomment the dependency when done testing

πŸ“ Test Files

  • wdio.conf.ts - WebdriverIO configuration
  • test/specs/test.e2e.ts - Sample test file
  • extensions/ - Directory for dependency extensions

πŸ” Understanding the Test Environment

WebdriverIO creates an isolated VS Code environment with:

  • βœ… Your extension under development
  • ❌ No other extensions (including dependencies)
  • βœ… Clean user settings
  • βœ… Temporary workspace

This is why extension dependencies don't work in the test environment, regardless of global installation.

πŸ“‹ Best Practices

  1. Test without dependencies when possible
  2. Mock external dependencies in your extension code
  3. Use conditional loading for non-critical dependencies
  4. Document dependency requirements clearly

πŸ”§ Alternative Testing Strategies

If your extension heavily relies on the dependency, consider:

  1. Unit testing individual functions without VS Code
  2. Integration testing with the dependency installed
  3. Manual testing in a real VS Code environment
  4. Conditional feature testing (gracefully handle missing dependencies)

πŸŽ‰ Success!

Your WebdriverIO tests are now fully functional. The test framework will:

  • βœ… Launch VS Code in development mode
  • βœ… Load your extension
  • βœ… Run automated UI tests
  • βœ… Provide detailed logging and reporting