Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Instead of having tests run with the protractor runner need to require()
Browse files Browse the repository at this point in the history
the protractor library, publish it to the global namespace. This insures
the instance of protractor used within the tests is the same as the
one used on the command line. Closes #36. Version bump for incompatible
API changes.
  • Loading branch information
juliemr committed Aug 9, 2013
1 parent 78df75c commit 90f0a94
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The example folder contains multiple versions of a simple test suite which runs
jasmine-node example/onJasmineNodeSpec.js
mocha example/onMocha.js

You can also run the example suite using the Protractor runner. The runner accepts a configuration file, which runs the tests at `example/onProtractor.js`.
You can also run the example suite using the Protractor runner. The runner accepts a configuration file, which runs the tests at `example/onProtractorRunner.js`.

bin/protractor example/protractorConf.js

Expand Down
2 changes: 0 additions & 2 deletions example/onProtractor.js → example/onProtractorRunner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var util = require('util');
var protractor = require('../lib/protractor.js');
require('../jasminewd');

describe('angularjs homepage', function() {
var ptor;
Expand Down
2 changes: 1 addition & 1 deletion example/protractorConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.config = {

// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['example/onProtractor.js'],
specs: ['example/onProtractorRunner.js'],

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
Expand Down
6 changes: 6 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ var startJasmineTests = function() {

protractor.setInstance(protractor.wrapDriver(driver, config.baseUrl));

// Export protractor to the global namespace to be used in tests.
global.protractor = protractor;

// Set up the Jasmine WebDriver Adapter
require('../jasminewd');

var options = config.jasmineNodeOpts;
options.onComplete = cleanUp;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"scripts": {
"test": "node lib/cli.js conf.js"
},
"version": "0.6.2"
"version": "0.7.0"
}
2 changes: 0 additions & 2 deletions spec/findelements_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var protractor = require('../lib/protractor.js');
var util = require('util');
require('../jasminewd');

describe('finding elements', function() {
var ptor;
Expand Down
2 changes: 0 additions & 2 deletions spec/lib_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var protractor = require('../lib/protractor.js');
var util = require('util');
require('../jasminewd');

describe('no ptor at all', function() {
it('should still do normal tests', function() {
Expand Down
2 changes: 0 additions & 2 deletions spec/mockmodule_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var protractor = require('../lib/protractor.js');
var util = require('util');
require('../jasminewd');

describe('mock modules', function() {
var ptor = protractor.getInstance();
Expand Down
2 changes: 0 additions & 2 deletions spec/synchronize_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var protractor = require('../lib/protractor.js');
var util = require('util');
require('../jasminewd');

describe('synchronizing with slow pages', function() {
var ptor = protractor.getInstance();
Expand Down
5 changes: 0 additions & 5 deletions spec/testapp_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
var protractor = require('../lib/protractor.js');
var util = require('util');
require('../jasminewd');


describe('longer example', function() {
var ptor = protractor.getInstance();
Expand Down Expand Up @@ -63,5 +60,3 @@ describe('longer example', function() {
});
});
});


0 comments on commit 90f0a94

Please sign in to comment.