Skip to content

Commit

Permalink
chore: upgrade webdriverio to 6.1.20 (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandramedway authored Jun 29, 2020
1 parent 0e91e2b commit 9fdb353
Show file tree
Hide file tree
Showing 18 changed files with 2,271 additions and 1,269 deletions.
2 changes: 1 addition & 1 deletion lib/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports.addCommand = function (client, requireName) {
}
}
}, axsPath, requireName, options).then(function (response) {
return response.value
return response
})
})
}
37 changes: 17 additions & 20 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function Api (app, requireName) {
}

Api.prototype.initialize = function () {
return this.load().then(this.addApiCommands.bind(this))
var self = this
return self.load().then(self.addApiCommands.bind(self))
}

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

Api.prototype.load = function () {
var self = this

return this.isNodeIntegrationEnabled().then(function (nodeIntegration) {
self.nodeIntegration = nodeIntegration
if (!nodeIntegration) {
Expand All @@ -54,9 +56,10 @@ Api.prototype.load = function () {
}

Api.prototype.isNodeIntegrationEnabled = function () {
return this.app.client.execute(function (requireName) {
var self = this
return self.app.client.execute(function (requireName) {
return typeof window[requireName] === 'function'
}, this.requireName).then(getResponseValue)
}, self.requireName)
}

Api.prototype.getVersion = function () {
Expand All @@ -65,7 +68,7 @@ Api.prototype.getVersion = function () {
if (process != null && process.versions != null) {
return process.versions.electron
}
}, this.requireName).then(getResponseValue)
}, this.requireName)
}

Api.prototype.loadApi = function () {
Expand Down Expand Up @@ -183,7 +186,7 @@ Api.prototype.loadApi = function () {
addProcess()

return api
}, this.requireName).then(getResponseValue)
}, this.requireName)
}

Api.prototype.addClientProperty = function (name) {
Expand Down Expand Up @@ -229,7 +232,7 @@ Api.prototype.addRenderProcessApis = function (api) {

app.client.addCommand(commandName, function () {
var args = Array.prototype.slice.call(arguments)
return this.execute(callRenderApi, moduleName, key, args, self.requireName).then(getResponseValue)
return this.execute(callRenderApi, moduleName, key, args, self.requireName)
})

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

app.client.addCommand(commandName, function () {
var args = Array.prototype.slice.call(arguments)
return this.execute(callMainApi, null, name, args, self.requireName).then(getResponseValue)
return this.execute(callMainApi, '', name, args, self.requireName)
})

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

app.client.addCommand(commandName, function () {
var args = Array.prototype.slice.call(arguments)
return this.execute(callMainApi, moduleName, key, args, self.requireName).then(getResponseValue)
return this.execute(callMainApi, moduleName, key, args, self.requireName)
})

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

app.client.addCommand(commandName, function () {
var args = Array.prototype.slice.call(arguments)
return this.execute(callBrowserWindowApi, name, args, self.requireName).then(getResponseValue)
return this.execute(callBrowserWindowApi, name, args, self.requireName)
})

app.browserWindow[name] = function () {
Expand All @@ -323,7 +326,7 @@ Api.prototype.addCapturePageSupport = function () {
} else {
done(image)
}
}, rect, self.requireName).then(getResponseValue).then(function (image) {
}, rect, self.requireName).then(function (image) {
return Buffer.from(image, 'base64')
})
})
Expand All @@ -350,7 +353,7 @@ Api.prototype.addWebContentsApis = function (api) {

app.client.addCommand(commandName, function () {
var args = Array.prototype.slice.call(arguments)
return this.execute(callWebContentsApi, name, args, self.requireName).then(getResponseValue)
return this.execute(callWebContentsApi, name, args, self.requireName)
})

app.webContents[name] = function () {
Expand All @@ -371,7 +374,7 @@ Api.prototype.addSavePageSupport = function () {
var webContents = window[requireName]('electron').remote.getCurrentWebContents()
await webContents.savePage(fullPath, saveType)
done()
}, fullPath, saveType, self.requireName).then(getResponseValue).then(function (rawError) {
}, fullPath, saveType, self.requireName).then(function (rawError) {
if (rawError) {
var error = new Error(rawError.message)
if (rawError.name) error.name = rawError.name
Expand All @@ -394,7 +397,7 @@ Api.prototype.addExecuteJavaScriptSupport = function () {
const webContents = window[requireName]('electron').remote.getCurrentWebContents()
const result = await webContents.executeJavaScript(code, useGesture)
done(result)
}, code, useGesture, self.requireName).then(getResponseValue)
}, code, useGesture, self.requireName)
})

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

app.client.addCommand(commandName, function () {
var args = Array.prototype.slice.call(arguments)
return this.execute(callProcessApi, name, args).then(getResponseValue)
return this.execute(callProcessApi, name, args)
})

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

Api.prototype.transferPromiseness = function (target, promise) {
this.app.client.transferPromiseness(target, promise)

if (!this.nodeIntegration) return

var addProperties = function (source, target, moduleName) {
Expand Down Expand Up @@ -501,8 +502,4 @@ function callProcessApi (name, args) {
}
}

function getResponseValue (response) {
return response.value
}

module.exports = Api
Loading

0 comments on commit 9fdb353

Please sign in to comment.