Skip to content
This repository has been archived by the owner on Sep 30, 2022. It is now read-only.

Commit

Permalink
Merge ecf3267 into 14becea
Browse files Browse the repository at this point in the history
  • Loading branch information
paradite committed Mar 9, 2019
2 parents 14becea + ecf3267 commit f4ea3f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 32 deletions.
16 changes: 5 additions & 11 deletions lib/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,11 @@ controllers.url = function * () {
* @returns {Promise.<string>}
*/
controllers.get = function * (url, options) {
const that = this;
return new Promise((resolve, reject) => {
co(function * () {
that.frame = null;
yield sendCommand.call(that, 'get', {
url,
args: that.args,
preserveCookies: options ? options.preserveCookies : null
});
resolve();
}).catch(reject);
this.frame = null;
return yield sendCommand.call(this, 'get', {
url,
args: this.args,
preserveCookies: options ? options.preserveCookies : null
});
};

Expand Down
27 changes: 7 additions & 20 deletions lib/macaca-electron.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const co = require('co');
const path = require('path');
const DriverBase = require('driver-base');

Expand All @@ -20,31 +19,19 @@ class Electron extends DriverBase {
}

* startDevice(caps) {
const that = this;
return new Promise((resolve, reject) => {
co(function * () {
that.args = _.clone(caps || {});
that.ipc = that.ipc || new IPC(that.args);
yield that.ipc.initElectron();
yield _.sleep(3 * 1000);
resolve();
}).catch(reject);
});
this.args = _.clone(caps || {});
this.ipc = this.ipc || new IPC(this.args);
yield this.ipc.initElectron();
yield _.sleep(3 * 1000);
}

get runnerProcess() {
return this.ipc && this.ipc.proc;
}

stopDevice() {
const that = this;
return new Promise((resolve, reject) => {
co(function * () {
yield that.ipc.stopElectron();
that.ipc = null;
resolve();
}).catch(reject);
});
* stopDevice() {
yield this.ipc.stopElectron();
this.ipc = null;
}

isProxy() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-electron",
"version": "2.2.3",
"version": "2.2.4",
"description": "macaca electron driver",
"keywords": [
"electron",
Expand Down

0 comments on commit f4ea3f2

Please sign in to comment.