Skip to content

Commit

Permalink
Port UI tests to vscode-extension-tester and remove wdio
Browse files Browse the repository at this point in the history
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, this required a new way to run the tests so a script that runs the tests has been created.

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.
  • Loading branch information
jpogran committed Nov 14, 2024
1 parent 2a9af6f commit 553b9e2
Show file tree
Hide file tree
Showing 40 changed files with 4,016 additions and 16,849 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/INTERNAL-20241105-111825.yaml
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
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
- ubuntu-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
VSCODE_VERSION: ${{ matrix.vscode }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -72,3 +74,9 @@ jobs:
- name: Run Tests
run: npm test
if: runner.os != 'Linux'
- name: Run UI Tests
run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run test:ui
if: runner.os == 'Linux'
- name: Run UI Tests
run: npm run test:ui
if: runner.os != 'Linux'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
.terraform
.vscode-test
.vscode-test-web
.wdio-vscode-service
.test-storage
.test-extensions
*.vsix
bin
node_modules
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode-test
.vscode-test-web
.wdio-vscode-service
.test-storage
language-configuration.json
node_modules
dist
Expand Down
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@
"args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionDevelopmentKind=web"],
"outFiles": ["${workspaceFolder}/dist/web/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
"name": "Debug UI Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/extest",
"windows": {
"program": "${workspaceFolder}/node_modules/vscode-extension-tester/out/cli.js"
},
"args": [
"setup-and-run",
"${workspaceFolder}/out/test/e2e/specs/**/*.e2e.js",
"--code_settings",
"${workspaceFolder}/src/test/e2e/settings.json",
"--extensions_dir",
".test-extensions",
"--mocha_config",
"${workspaceFolder}/src/test/e2e/.mocharc.js",
"--uninstall_extension",
"--log_level",
"debug",
"--storage",
".test-storage"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
6 changes: 6 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.mocharc.js
esbuild.mjs
eslint.config.mjs
uitest.mjs
.changes
.changie.yaml
.copywrite.hcl
Expand All @@ -16,6 +20,7 @@
.vscode-test.mjs
.vscodeignore
.wdio-vscode-service
.test-storage
**/__mocks__
build/
DEVELOPMENT.md
Expand All @@ -26,3 +31,4 @@ src/
out/
esbuild.js
tsconfig.json
.test-extensions
8 changes: 5 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ export default [
semi: 'warn',
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
Expand All @@ -64,6 +65,7 @@ export default [
ignores: [
'.vscode-test',
'.wdio-vscode-service',
'.test-storage',
'dist',
'out',
'src/test',
Expand Down
Loading

0 comments on commit 553b9e2

Please sign in to comment.