-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port UI tests to vscode-extension-tester (#1873)
This installs the redhat extension tester and removes the wdio test runner and its dependencies from the project. This allows us to test treeviews, which is what the HCP integration uses, locally and in CI in a reliable manner. This is large port of existing UI tests to a new API and it required a new way to run the tests. So a script that runs the tests has been created that will run the tests in a headless mode when running in CI and in a windowed mode when running locally. This is to ensure that the tests can be run in a reliable manner in both environments. It also mocks the HCP API so that the tests can be run without needing to have a connection to HCP infrastructure. A bug in the login workflow was found during this effort. After successfully authenticing, the organization picker was left open and could not be closed. This was fixed by disposing the organization picker after successfully authenticating. Since the primary focus was on the HCP treeview tests (most likely to break when changing this area), the Terraform treeview tests (which have much simpler functionality) were not updated and left for a future PR. This also fixes the issue with the `test.yml` file where the `VSCODE_VERSION` was not being set correctly. This was causing the tests to not actually run with different versions of VSCode. A minor addition to the eslint ruleset to allow for the use of `unsafe` access or `any` in the codebase where it is needed, specifically in places where we interact with libraries that are not typed or where we need to access properties that are not typed.
- Loading branch information
Showing
29 changed files
with
3,777 additions
and
16,827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: INTERNAL | ||
body: Port UI tests to vscode-extension-tester and remove wdio | ||
time: 2024-11-05T11:18:25.988501-05:00 | ||
custom: | ||
Issue: "1873" | ||
Repository: vscode-terraform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import { ExTester, ReleaseQuality } from 'vscode-extension-tester'; | ||
|
||
async function runTests() { | ||
let code_version; | ||
let code_type; | ||
|
||
if (process.env.VSCODE_VERSION === 'insiders') { | ||
code_type = ReleaseQuality.Insider; | ||
} else if (process.env.VSCODE_VERSION === 'stable') { | ||
code_type = ReleaseQuality.Stable; | ||
} else { | ||
code_version = process.env.VSCODE_VERSION; | ||
} | ||
|
||
if (code_type) { | ||
console.log(`Running tests for ${code_version} ${code_type} version of VS Code`); | ||
} else { | ||
console.log(`Running tests for ${code_version} version of VS Code`); | ||
} | ||
|
||
process.env.HASHI_CODE_TEST = 'true'; | ||
|
||
const tester = new ExTester('.test-storage', code_type, '.test-extensions', false); | ||
await tester.setupAndRunTests( | ||
'out/test/e2e/specs/**/*.e2e.js', | ||
code_version, | ||
{ | ||
installDependencies: false, | ||
}, | ||
{ | ||
settings: 'src/test/e2e/settings.json', | ||
cleanup: true, | ||
config: 'src/test/e2e/.mocharc.js', | ||
logLevel: 'info', | ||
resources: [], | ||
}, | ||
); | ||
} | ||
|
||
runTests().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.