Skip to content

Commit 2d649c6

Browse files
committed
test: update updateConfig to reduce retry
1 parent 2371cb0 commit 2d649c6

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

e2e/tests/updateConfig.spec.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import url from 'node:url'
33

44
import { browser, expect } from '@wdio/globals'
55
import shell from 'shelljs'
6+
import { sleep, type SideBarView, type Workbench } from 'wdio-vscode-service'
67

78
import {
89
STATUS,
@@ -15,8 +16,6 @@ import {
1516
waitForTestStatus,
1617
} from '../helpers/index.js'
1718

18-
import type { SideBarView, Workbench } from 'wdio-vscode-service'
19-
2019
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
2120
const rootDir = path.resolve(__dirname, '..', '..')
2221
const workspacePath = path.resolve(rootDir, 'samples/smoke/update-config/')
@@ -85,20 +84,24 @@ describe('VS Code Extension Testing (Update config)', function () {
8584

8685
// Emulate the changing configuration
8786
shell.cp('-f', afterConfig, beforeConfig)
88-
await new Promise((resolve) => setTimeout(resolve, 1000))
87+
await sleep(1500)
8988
await browser.waitUntil(
9089
async () => {
91-
if (!(await items[0].isExpanded())) {
92-
await items[0].expand()
93-
}
94-
95-
const children = await items[0].getChildren()
96-
const target = children[0]
97-
if (!target) {
90+
try {
91+
if (!(await items[0].isExpanded())) {
92+
await items[0].expand()
93+
}
94+
95+
const children = await items[0].getChildren()
96+
const target = children[0]
97+
if (!target) {
98+
return false
99+
}
100+
const regex = new RegExp('after.test.ts')
101+
return regex.test(await target.getLabel())
102+
} catch {
98103
return false
99104
}
100-
const regex = new RegExp('after.test.ts')
101-
return regex.test(await target.getLabel())
102105
},
103106
{ timeoutMsg: 'The label "after.test.ts" is not found.' }
104107
)

0 commit comments

Comments
 (0)