Skip to content

Commit 67cd9a3

Browse files
authored
feat: support vscode@1.96.0 (#37)
## Proposed changes Update minimum version of the `vscode` to 1.96.0. (support latest Cursor at 2025-5-30 ) ## Types of changes [//]: # 'What types of changes does your code introduce to WebdriverIO?' [//]: # '_Put an `x` in the boxes that apply_' - [ ] Polish (an improvement for an existing feature) - [ ] Bugfix (non-breaking change which fixes an issue) - [X] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improvements to the project's docs) - [ ] Internal updates (everything related to internal scripts, governance documentation and CI files) ## Checklist [//]: # "_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._" - [X] I have read the [CONTRIBUTING](https://github.com/webdriverio/vscode-webdriverio/blob/main/CONTRIBUTION.md) doc - [X] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation (if appropriate) - [ ] I have added proper type definitions for new commands (if appropriate) ## Further comments [//]: # 'If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...' ### Reviewers: @webdriverio/project-committers
1 parent 748190e commit 67cd9a3

File tree

11 files changed

+99
-24
lines changed

11 files changed

+99
-24
lines changed

.github/workflows/ci-e2e.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
workflow_call:
55
# Make this a reusable workflow, no value needed
66
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
7+
inputs:
8+
compatibility-mode:
9+
description: 'If “yes”, run test for compatibility with vscode'
10+
default: 'no'
11+
type: string
712

813
env:
914
TURBO_TELEMETRY_DISABLED: 1
@@ -36,9 +41,19 @@ jobs:
3641
filename: vscode-webdriverio-build.zip
3742

3843
- name: 🧪 Run the e2e test
44+
env:
45+
VSCODE_WDIO_E2E_COMPATIBILITY_MODE: ${{ inputs.compatibility-mode }}
3946
run: pnpm run test:e2e
4047
shell: bash
4148

49+
- name: 📦 Upload Test Logs on Failure
50+
uses: ./.github/workflows/actions/upload-archive
51+
if: failure()
52+
with:
53+
name: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-logs-${{ matrix.os }}
54+
output: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-logs-${{ matrix.os }}.zip
55+
paths: e2e/logs
56+
4257
- name: 🐛 Debug Build
4358
uses: stateful/vscode-server-action@v1.1.0
4459
if: failure()

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ jobs:
4040
needs: [build]
4141
uses: ./.github/workflows/ci-e2e.yml
4242

43+
compatibility:
44+
name: Compatibility
45+
needs: [build]
46+
uses: ./.github/workflows/ci-e2e.yml
47+
with:
48+
compatibility-mode: 'yes'
49+
4350
smoke:
4451
name: Smoke
45-
needs: [build]
52+
needs: [build, e2e]
4653
uses: ./.github/workflows/ci-smoke.yml

e2e/helpers.ts

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DefaultTreeSection } from 'wdio-vscode-service'
22
import type { StatusStrings } from 'assertions/index.ts'
3-
import type { TreeItem, Workbench, ViewControl, ViewContent } from 'wdio-vscode-service'
3+
import type { TreeItem, Workbench, ViewControl, ViewContent, ViewItemAction } from 'wdio-vscode-service'
44

55
export const STATUS = {
66
NOT_YET_RUN: 'Not yet run',
@@ -41,6 +41,25 @@ export async function waitForResolved(browser: WebdriverIO.Browser, item: TreeIt
4141
)
4242
}
4343

44+
export async function clickTreeItemButton(browser: WebdriverIO.Browser, target: TreeItem, buttonLabel: string) {
45+
let btn: ViewItemAction | undefined
46+
await browser.waitUntil(
47+
async () => {
48+
btn = await target.getActionButton(buttonLabel)
49+
if (btn && (await (btn.elem as WebdriverIO.Element).isClickable())) {
50+
return true
51+
}
52+
return false
53+
},
54+
{
55+
timeoutMsg: 'The button is not clickable.',
56+
}
57+
)
58+
59+
btn = await target.getActionButton(buttonLabel)
60+
await (btn!.elem as WebdriverIO.Element).click()
61+
}
62+
4463
export async function waitForTestStatus(browser: WebdriverIO.Browser, item: TreeItem, status: StatusStrings) {
4564
await browser.waitUntil(
4665
async () => {
@@ -57,21 +76,30 @@ export async function waitForTestStatus(browser: WebdriverIO.Browser, item: Tree
5776
}
5877

5978
export async function clearAllTestResults(workbench: Workbench) {
79+
const notifications = await workbench.getNotifications()
80+
await Promise.all(
81+
notifications.map(async (notification) => {
82+
return await notification.dismiss()
83+
})
84+
)
6085
const bottomBarPanel = workbench.getBottomBar()
6186
const tabTitle = 'Test Results'
62-
const actionTitle = 'Clear All Results'
6387
try {
64-
await bottomBarPanel.toggle(true)
6588
const tabContainer = await bottomBarPanel.tabContainer$
6689
const tab = (await tabContainer.$(`.//a[starts-with(@aria-label, '${tabTitle}')]`)) as WebdriverIO.Element
90+
6791
if (await tab.isExisting()) {
6892
await tab.click()
69-
await ((await bottomBarPanel.actions$) as WebdriverIO.Element)
70-
.$(`.//a[@aria-label='${actionTitle}']`)
93+
await bottomBarPanel.elem
94+
.$(
95+
(bottomBarPanel.locatorMap.BottomBarViews.actionsContainer as Function)(
96+
'Test Results actions'
97+
) as string
98+
)
99+
.$(bottomBarPanel.locatorMap.BottomBarViews.clearText as string)
71100
.click()
72101
}
73-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
74102
} catch (_error) {
75-
// pass
103+
console.log(_error)
76104
}
77105
}

e2e/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
"wdio": "wdio run ./wdio.conf.ts"
2020
},
2121
"devDependencies": {
22+
"@types/semver": "^7.7.0",
2223
"@wdio/cli": "^9.13.0",
2324
"@wdio/globals": "^9.12.6",
2425
"@wdio/local-runner": "^9.13.0",
2526
"@wdio/mocha-framework": "^9.13.0",
2627
"@wdio/spec-reporter": "^9.13.0",
2728
"chai": "^5.2.0",
2829
"expect": "^29.7.0",
30+
"semver": "^7.7.2",
2931
"wdio-vscode-service": "^6.1.3",
3032
"webdriver": "^9.13.0",
3133
"webdriverio": "^9.13.0"

e2e/tests/basic.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { browser, expect } from '@wdio/globals'
33
import {
44
STATUS,
55
clearAllTestResults,
6+
clickTreeItemButton,
67
getTestingSection,
78
openTestingView,
89
waitForResolved,
@@ -84,8 +85,7 @@ describe(`VS Code Extension Testing with ${targetFramework}`, function () {
8485

8586
await waitForResolved(browser, items[0])
8687

87-
const actionRunTest = await items[0].getActionButton('Run Test')
88-
await (actionRunTest!.elem as WebdriverIO.Element).click()
88+
await clickTreeItemButton(browser, items[0], 'Run Test')
8989

9090
await waitForTestStatus(browser, items[0], STATUS.FAILED)
9191

@@ -130,8 +130,7 @@ describe(`VS Code Extension Testing with ${targetFramework}`, function () {
130130
.then((items) => items[0].getChildren())
131131
.then((items) => items[1])
132132

133-
const actionRunTest = await target.getActionButton('Run Test')
134-
await (actionRunTest!.elem as WebdriverIO.Element).click()
133+
await clickTreeItemButton(browser, target, 'Run Test')
135134

136135
await waitForTestStatus(browser, items[0], STATUS.PASSED)
137136

e2e/tests/basicCucumber.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { browser, expect } from '@wdio/globals'
33
import {
44
STATUS,
55
clearAllTestResults,
6+
clickTreeItemButton,
67
getTestingSection,
78
openTestingView,
89
waitForResolved,
@@ -135,8 +136,7 @@ describe(`VS Code Extension Testing with ${targetFramework}`, function () {
135136

136137
await waitForResolved(browser, items[0])
137138

138-
const actionRunTest = await items[0].getActionButton('Run Test')
139-
await (actionRunTest!.elem as WebdriverIO.Element).click()
139+
await clickTreeItemButton(browser, items[0], 'Run Test')
140140

141141
await waitForTestStatus(browser, items[0], STATUS.PASSED)
142142

@@ -233,8 +233,7 @@ describe(`VS Code Extension Testing with ${targetFramework}`, function () {
233233
.then((items) => items[0].getChildren())
234234
.then((items) => items[1])
235235

236-
const actionRunTest = await target.getActionButton('Run Test')
237-
await (actionRunTest!.elem as WebdriverIO.Element).click()
236+
await clickTreeItemButton(browser, target, 'Run Test')
238237

239238
await waitForTestStatus(browser, items[0], STATUS.PASSED)
240239

e2e/tests/updateConfig.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import shell from 'shelljs'
88
import {
99
STATUS,
1010
clearAllTestResults,
11+
clickTreeItemButton,
1112
getTestingSection,
1213
openTestingView,
1314
waitForResolved,
@@ -123,8 +124,7 @@ describe('VS Code Extension Testing (Update config)', function () {
123124

124125
await waitForResolved(browser, items[0])
125126

126-
const actionRunTest = await items[0].getActionButton('Run Test')
127-
await (actionRunTest!.elem as WebdriverIO.Element).click()
127+
await clickTreeItemButton(browser, items[0], 'Run Test')
128128

129129
await waitForTestStatus(browser, items[0], STATUS.PASSED)
130130

e2e/wdio.conf.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
import * as path from 'node:path'
2+
import * as url from 'node:url'
23

4+
import { minVersion } from 'semver'
5+
6+
import pkg from '../packages/vscode-webdriverio/package.json' with { type: 'json' }
7+
8+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
39
const target = process.env.VSCODE_WDIO_E2E_FRAMEWORK || 'mocha'
410

11+
const minimumVersion = minVersion(pkg.engines.vscode)?.version || 'stable'
12+
13+
const isCompatibilityMode = process.env.VSCODE_WDIO_E2E_COMPATIBILITY_MODE === 'yes'
14+
const version = isCompatibilityMode ? minimumVersion : 'stable'
15+
16+
const outputDir = path.join(__dirname, 'logs', [isCompatibilityMode ? 'compatibility' : 'e2e', target].join('-'))
17+
process.env.VSCODE_WDIO_TRACE_LOG_PATH = outputDir
18+
519
const specs = target === 'cucumber' ? ['./tests/basicCucumber.spec.ts'] : ['./tests/basic.spec.ts']
620

721
export const config: WebdriverIO.Config = {
@@ -12,7 +26,7 @@ export const config: WebdriverIO.Config = {
1226
capabilities: [
1327
{
1428
browserName: 'vscode',
15-
browserVersion: 'stable', // also possible: "insiders" or a specific version e.g. "1.80.0"
29+
browserVersion: version,
1630
'wdio:vscodeOptions': {
1731
// points to directory where extension package.json is located
1832
extensionPath: path.resolve('../packages/vscode-webdriverio'),
@@ -27,7 +41,7 @@ export const config: WebdriverIO.Config = {
2741
],
2842

2943
logLevel: 'debug',
30-
outputDir: 'logs',
44+
outputDir,
3145
bail: 0,
3246
waitforTimeout: 120000,
3347
connectionRetryTimeout: 120000,

packages/vscode-wdio-constants/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const EXTENSION_ID = 'webdriverio'
33

44
export const DEFAULT_CONFIG_VALUES = {
55
nodeExecutable: undefined,
6-
configFilePattern: ['**/wdio.conf.{ts,js}'],
6+
configFilePattern: ['**/*wdio*.conf*.{ts,js,mjs,cjs,cts,mts}'],
77
showOutput: true,
88
logLevel: 'info',
99
} as const

packages/vscode-webdriverio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"Testing"
6868
],
6969
"engines": {
70-
"vscode": "^1.98.0"
70+
"vscode": "^1.96.0"
7171
},
7272
"activationEvents": [
7373
"onLanguage:javascript",

0 commit comments

Comments
 (0)