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

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Tatarintsev committed Apr 4, 2014
1 parent 33bc385 commit d7acde4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"devDependencies": {
"mocha": "~1.18.2",
"must": "~0.11.0"
"must": "~0.11.0",
"sinon": "~1.9.1"
},
"scripts": {
"test": "mocha"
Expand Down
13 changes: 9 additions & 4 deletions test/runner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var q = require('q'),

CONFIG_TEXT = [
'rootUrl: http://example.com',
'gridUrl: http://grid.example.com',
'browsers: ',
' - browser',
].join('\n');
Expand All @@ -18,7 +19,7 @@ describe('runner', function() {

var browser = {
open: function () { return q.resolve(); },
findElements: function() { return q.resolve(); },
buildElementsMap: function() { return q.resolve(); },
captureState: function() { return q.resolve(); },
quit: function() { return q.resolve(); }
};
Expand Down Expand Up @@ -123,11 +124,15 @@ describe('runner', function() {
it('should search for plan elements', function() {
this.plan
.setElements({element: '.selector'})
.setDynamicElements({element2: '.selector'})
.capture('state');

this.sinon.spy(this.browser, 'findElements');
this.sinon.spy(this.browser, 'buildElementsMap');
return this.runner.runPlans([this.plan]).then(function() {
sinon.assert.calledWith(this.browser.findElements, {element: '.selector'});
sinon.assert.calledWith(this.browser.buildElementsMap,
{element: '.selector'},
{element2: '.selector'}
);
}.bind(this));
});

Expand All @@ -149,7 +154,7 @@ describe('runner', function() {
.setElements({element: '.selector'})
.capture('state');

this.sinon.stub(this.browser, 'findElements').returns(q.resolve(stubElements));
this.sinon.stub(this.browser, 'buildElementsMap').returns(q.resolve(stubElements));
this.sinon.spy(this.browser, 'captureState');
return this.runner.runPlans([this.plan]).then(function() {
sinon.assert.calledWith(this.browser.captureState, sinon.match.any, stubElements);
Expand Down

0 comments on commit d7acde4

Please sign in to comment.