Skip to content

Commit 6d10319

Browse files
committed
more work towards ide tests
1 parent 8e05ce1 commit 6d10319

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

packages/selenium-ide/scripts/ide-runner.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ main()
3636

3737
async function main() {
3838
console.log('Starting webdriver backend')
39-
await startWebdriverBackend({ driver: 'chrome' })
39+
const {proc, success} = await startWebdriverBackend({ driver: 'chrome' })
40+
if (!success) {
41+
console.error('Failed to start webdriver backend')
42+
console.error(proc.error)
43+
return
44+
}
4045
const sideFiles = args.filter((arg) => arg.endsWith('.side'))
41-
for (const sideFile of sideFiles) {
46+
for (const sideFile of [sideFiles[0]]) {
4247
console.log('Starting driver for sidefile', sideFile)
4348
const driver = await new webdriver.Builder()
4449
.usingServer(`http://localhost:${port}`)
@@ -48,8 +53,9 @@ async function main() {
4853
binary: electronBinaryPath,
4954
args: [
5055
'app=' + pathToSeleniumIDE,
51-
`side-file=./../../${sideFile.replace('./', '')}`,
56+
`side-file=${sideFile}`,
5257
],
58+
excludeSwitches: ['enable-logging'],
5359
},
5460
})
5561
.forBrowser('chrome') // note: use .forBrowser('electron') for selenium-webdriver <= 3.6.0
@@ -58,6 +64,7 @@ async function main() {
5864
await driver.quit()
5965
return
6066
}
67+
proc.kill()
6168
}
6269

6370
function startWebdriverBackend() {
@@ -66,31 +73,33 @@ function startWebdriverBackend() {
6673
let initialized = false
6774
const args = ['--verbose', `--port=${port}`]
6875
if (fs.existsSync(driverPath)) {
69-
const driver = spawn(driverPath.replace(/\s/g, ' '), args, {
76+
const proc = spawn(driverPath.replace(/\s/g, ' '), args, {
7077
env: {},
7178
shell: false,
7279
})
7380
process.on('exit', () => {
74-
driver.kill()
81+
if (!proc.killed) {
82+
proc.kill()
83+
}
7584
})
76-
driver.stdout.on('data', (out) => {
85+
proc.stdout.on('data', (out) => {
7786
const outStr = `${out}`
7887
WebdriverDebugLog(outStr)
7988
const fullyStarted = outStr.includes(successMessage)
8089
if (fullyStarted) {
8190
initialized = true
8291
WebdriverDebugLog('Driver has initialized!')
83-
resolve({ success: true, driver: driver })
92+
resolve({ success: true, proc: proc })
8493
}
8594
})
86-
driver.stderr.on('data', (err) => {
95+
proc.stderr.on('data', (err) => {
8796
const errStr = `${err}`
8897
WebdriverDebugLog(errStr)
8998
if (!initialized) {
9099
resolve({ success: false, error: errStr })
91100
}
92101
})
93-
driver.on('close', (code) => {
102+
proc.on('close', (code) => {
94103
if (code) {
95104
WebdriverDebugLog(`driver has exited with code ${code}`)
96105
if (!initialized) {

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)