Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: correct methods overriding #15

Merged
merged 1 commit into from
Nov 14, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var fs = require('fs');
var wd = require('wd');

var WebDriverInstance = function (baseBrowserDecorator, args) {
var WebDriverInstance = function (baseBrowserDecorator, args, logger) {
var log = logger.create('WebDriver');

var config = args.config || {
hostname: '127.0.0.1',
port: 4444
Expand All @@ -19,19 +20,24 @@ var WebDriverInstance = function (baseBrowserDecorator, args) {

this.name = spec.browserName + ' via Remote WebDriver';

this.on('kill', function(callback) {
self.browser.quit(function() {
console.log('Killed ' + spec.name + '.');
callback();
});
});

this._start = function (url) {
self.browser = wd.remote(config);
self.browser.init(spec, function () {
self.browser.get(url);
});
this._start = function(url) {
self.browser = wd.remote(config, 'promiseChain');
self.browser.init(spec)
.get(url)
.done();

self._process = {
kill: function() {
self.browser.quit(function() {
log.info('Killed ' + spec.name + '.');
self._onProcessExit(self.error ? -1 : 0, self.error);
});
}
};
};

// We can't really force browser to quit so just avoid warning about SIGKILL
this._onKillTimeout = function(){};
};

WebDriverInstance.prototype = {
Expand All @@ -45,7 +51,7 @@ WebDriverInstance.prototype = {
ENV_CMD: 'WEBDRIVER_BIN'
};

WebDriverInstance.$inject = ['baseBrowserDecorator', 'args'];
WebDriverInstance.$inject = ['baseBrowserDecorator', 'args', 'logger'];

// PUBLISH DI MODULE
module.exports = {
Expand Down