Skip to content

Commit

Permalink
fixed the failing session test
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Aug 15, 2016
1 parent df10355 commit f79e8be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
11 changes: 0 additions & 11 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,6 @@ Nightwatch.prototype.startSession = function () {
data = err;
}

if (data) {
var error = data;
if (typeof data == 'object') {
if (data.stack) {
error = data.stack;
} else {
error = util.inspect(data, true, 3, true);
}
}
}

self.emit('error', data);
})
.send();
Expand Down
12 changes: 7 additions & 5 deletions test/src/index/testNightwatchIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,28 +294,30 @@ module.exports = {
'test session response with status success and no sessionId': function (done) {
MockServer.addMock({
url : '/wd/hub/session',

postdata : JSON.stringify({
desiredCapabilities: {
browserName : 'chrome',
browserName : 'safari',
javascriptEnabled: true,
acceptSslCerts:true,
platform:'ANY'
}
}),
response : JSON.stringify({value: { message: 'Could not find device : iPhone 6' }}),
response : '{"value":{"message":"Could not find device : iPhone 6"}}',
statusCode : 200,
method: 'POST'
}, true);

var client = Nightwatch.createClient({
desiredCapabilities: {
browserName: 'chrome'
browserName: 'safari'
}
});

client.on('error', function (data) {
assert.deepEqual(data, {value: { message: 'Could not find device : iPhone 6' }});
assert.equal(typeof data, 'object');
assert.ok('value' in data);
assert.ok('message' in data.value);
assert.equal(data.value.message, 'Could not find device : iPhone 6');
done();
});

Expand Down
1 change: 0 additions & 1 deletion test/src/runner/cli/testCliRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ module.exports = {
return false;
},
statSync : function(file) {
console.log('statSync', file)
if (file == ABSOLUTE_PATH) {
statSyncCalled = true;
return {
Expand Down

0 comments on commit f79e8be

Please sign in to comment.