Skip to content

Commit 9fdb353

Browse files
chore: upgrade webdriverio to 6.1.20 (#631)
1 parent 0e91e2b commit 9fdb353

18 files changed

+2271
-1269
lines changed

lib/accessibility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ exports.addCommand = function (client, requireName) {
5555
}
5656
}
5757
}, axsPath, requireName, options).then(function (response) {
58-
return response.value
58+
return response
5959
})
6060
})
6161
}

lib/api.js

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ function Api (app, requireName) {
66
}
77

88
Api.prototype.initialize = function () {
9-
return this.load().then(this.addApiCommands.bind(this))
9+
var self = this
10+
return self.load().then(self.addApiCommands.bind(self))
1011
}
1112

1213
Api.prototype.addApiCommands = function (api) {
@@ -30,6 +31,7 @@ Api.prototype.addApiCommands = function (api) {
3031

3132
Api.prototype.load = function () {
3233
var self = this
34+
3335
return this.isNodeIntegrationEnabled().then(function (nodeIntegration) {
3436
self.nodeIntegration = nodeIntegration
3537
if (!nodeIntegration) {
@@ -54,9 +56,10 @@ Api.prototype.load = function () {
5456
}
5557

5658
Api.prototype.isNodeIntegrationEnabled = function () {
57-
return this.app.client.execute(function (requireName) {
59+
var self = this
60+
return self.app.client.execute(function (requireName) {
5861
return typeof window[requireName] === 'function'
59-
}, this.requireName).then(getResponseValue)
62+
}, self.requireName)
6063
}
6164

6265
Api.prototype.getVersion = function () {
@@ -65,7 +68,7 @@ Api.prototype.getVersion = function () {
6568
if (process != null && process.versions != null) {
6669
return process.versions.electron
6770
}
68-
}, this.requireName).then(getResponseValue)
71+
}, this.requireName)
6972
}
7073

7174
Api.prototype.loadApi = function () {
@@ -183,7 +186,7 @@ Api.prototype.loadApi = function () {
183186
addProcess()
184187

185188
return api
186-
}, this.requireName).then(getResponseValue)
189+
}, this.requireName)
187190
}
188191

189192
Api.prototype.addClientProperty = function (name) {
@@ -229,7 +232,7 @@ Api.prototype.addRenderProcessApis = function (api) {
229232

230233
app.client.addCommand(commandName, function () {
231234
var args = Array.prototype.slice.call(arguments)
232-
return this.execute(callRenderApi, moduleName, key, args, self.requireName).then(getResponseValue)
235+
return this.execute(callRenderApi, moduleName, key, args, self.requireName)
233236
})
234237

235238
electron[moduleName][key] = function () {
@@ -252,7 +255,7 @@ Api.prototype.addMainProcessApis = function (api) {
252255

253256
app.client.addCommand(commandName, function () {
254257
var args = Array.prototype.slice.call(arguments)
255-
return this.execute(callMainApi, null, name, args, self.requireName).then(getResponseValue)
258+
return this.execute(callMainApi, '', name, args, self.requireName)
256259
})
257260

258261
remote[name] = function () {
@@ -271,7 +274,7 @@ Api.prototype.addMainProcessApis = function (api) {
271274

272275
app.client.addCommand(commandName, function () {
273276
var args = Array.prototype.slice.call(arguments)
274-
return this.execute(callMainApi, moduleName, key, args, self.requireName).then(getResponseValue)
277+
return this.execute(callMainApi, moduleName, key, args, self.requireName)
275278
})
276279

277280
remote[moduleName][key] = function () {
@@ -297,7 +300,7 @@ Api.prototype.addBrowserWindowApis = function (api) {
297300

298301
app.client.addCommand(commandName, function () {
299302
var args = Array.prototype.slice.call(arguments)
300-
return this.execute(callBrowserWindowApi, name, args, self.requireName).then(getResponseValue)
303+
return this.execute(callBrowserWindowApi, name, args, self.requireName)
301304
})
302305

303306
app.browserWindow[name] = function () {
@@ -323,7 +326,7 @@ Api.prototype.addCapturePageSupport = function () {
323326
} else {
324327
done(image)
325328
}
326-
}, rect, self.requireName).then(getResponseValue).then(function (image) {
329+
}, rect, self.requireName).then(function (image) {
327330
return Buffer.from(image, 'base64')
328331
})
329332
})
@@ -350,7 +353,7 @@ Api.prototype.addWebContentsApis = function (api) {
350353

351354
app.client.addCommand(commandName, function () {
352355
var args = Array.prototype.slice.call(arguments)
353-
return this.execute(callWebContentsApi, name, args, self.requireName).then(getResponseValue)
356+
return this.execute(callWebContentsApi, name, args, self.requireName)
354357
})
355358

356359
app.webContents[name] = function () {
@@ -371,7 +374,7 @@ Api.prototype.addSavePageSupport = function () {
371374
var webContents = window[requireName]('electron').remote.getCurrentWebContents()
372375
await webContents.savePage(fullPath, saveType)
373376
done()
374-
}, fullPath, saveType, self.requireName).then(getResponseValue).then(function (rawError) {
377+
}, fullPath, saveType, self.requireName).then(function (rawError) {
375378
if (rawError) {
376379
var error = new Error(rawError.message)
377380
if (rawError.name) error.name = rawError.name
@@ -394,7 +397,7 @@ Api.prototype.addExecuteJavaScriptSupport = function () {
394397
const webContents = window[requireName]('electron').remote.getCurrentWebContents()
395398
const result = await webContents.executeJavaScript(code, useGesture)
396399
done(result)
397-
}, code, useGesture, self.requireName).then(getResponseValue)
400+
}, code, useGesture, self.requireName)
398401
})
399402

400403
app.webContents.executeJavaScript = function () {
@@ -411,7 +414,7 @@ Api.prototype.addProcessApis = function (api) {
411414

412415
app.client.addCommand(commandName, function () {
413416
var args = Array.prototype.slice.call(arguments)
414-
return this.execute(callProcessApi, name, args).then(getResponseValue)
417+
return this.execute(callProcessApi, name, args)
415418
})
416419

417420
app.rendererProcess[name] = function () {
@@ -423,8 +426,6 @@ Api.prototype.addProcessApis = function (api) {
423426
}
424427

425428
Api.prototype.transferPromiseness = function (target, promise) {
426-
this.app.client.transferPromiseness(target, promise)
427-
428429
if (!this.nodeIntegration) return
429430

430431
var addProperties = function (source, target, moduleName) {
@@ -501,8 +502,4 @@ function callProcessApi (name, args) {
501502
}
502503
}
503504

504-
function getResponseValue (response) {
505-
return response.value
506-
}
507-
508505
module.exports = Api

0 commit comments

Comments
 (0)