Skip to content

Files

Latest commit

 

History

History

e2e

MSSQL for VSCode Extension - E2E Tests

Get started

Limitations

If running extension tests from CLI, the VS Code version the tests run with cannot be running already. As a workaround, VS Code Insiders should be used for test development, so that tests may run in VS Code Stable.

For more information regarding this limitation, refer to using insiders version for extension development.

Prerequisites

  • Node.js v18 or higher
  • yarn v1.22.0 or higher, npm install -g yarn

Setup

Tests are currently only setup to run locally.

  1. Install root dependencies

From the root of the repo, install all of the build dependencies:

[sudo] yarn
  1. Compile the extension and tests by running:
gulp build

or watch for changes in the tests by running:

gulp watch-tests

Running tests

To run tests, the following options can be used:

  1. Using Playwright Test for VSCode:

    Note: If you don't see any tests appearing in the Test Explorer view, like in the image, then you'll need to run them from the terminal first to get them to appear. Please refer to option 2.

Playwright Test for VSCode Test Explorer.

  1. Setup environment variables in the test\e2e folder

    • Create a .env file
    • Add the variables that you want based on the .env.example
    • Example:
      VS_CODE_VERSION_NAME=stable
      SERVER_NAME=(localdb)\MSSqlLocalDb
      AUTHENTICATION_TYPE=Integrated
      PROFILE_NAME=test-server
  2. To run tests from the command line execute the following command from the root:

    npx playwright test

The tests will automatically appear in the Test Explorer view after running them once, and green run icons will appear to the left of line numbers in the editor, like this:

Run buttons to the left of line numbers in editor