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

Commit 90f0a94

Browse files
committed
Instead of having tests run with the protractor runner need to require()
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.
1 parent 78df75c commit 90f0a94

10 files changed

+9
-18
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The example folder contains multiple versions of a simple test suite which runs
2222
jasmine-node example/onJasmineNodeSpec.js
2323
mocha example/onMocha.js
2424

25-
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`.
25+
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`.
2626

2727
bin/protractor example/protractorConf.js
2828

example/onProtractor.js example/onProtractorRunner.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
var util = require('util');
2-
var protractor = require('../lib/protractor.js');
3-
require('../jasminewd');
42

53
describe('angularjs homepage', function() {
64
var ptor;

example/protractorConf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exports.config = {
1515

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

2020
// Options to be passed to Jasmine-node.
2121
jasmineNodeOpts: {

lib/cli.js

+6
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ var startJasmineTests = function() {
132132

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

135+
// Export protractor to the global namespace to be used in tests.
136+
global.protractor = protractor;
137+
138+
// Set up the Jasmine WebDriver Adapter
139+
require('../jasminewd');
140+
135141
var options = config.jasmineNodeOpts;
136142
options.onComplete = cleanUp;
137143

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
"scripts": {
3434
"test": "node lib/cli.js conf.js"
3535
},
36-
"version": "0.6.2"
36+
"version": "0.7.0"
3737
}

spec/findelements_spec.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
var protractor = require('../lib/protractor.js');
21
var util = require('util');
3-
require('../jasminewd');
42

53
describe('finding elements', function() {
64
var ptor;

spec/lib_spec.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
var protractor = require('../lib/protractor.js');
21
var util = require('util');
3-
require('../jasminewd');
42

53
describe('no ptor at all', function() {
64
it('should still do normal tests', function() {

spec/mockmodule_spec.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
var protractor = require('../lib/protractor.js');
21
var util = require('util');
3-
require('../jasminewd');
42

53
describe('mock modules', function() {
64
var ptor = protractor.getInstance();

spec/synchronize_spec.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
var protractor = require('../lib/protractor.js');
21
var util = require('util');
3-
require('../jasminewd');
42

53
describe('synchronizing with slow pages', function() {
64
var ptor = protractor.getInstance();

spec/testapp_spec.js

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
var protractor = require('../lib/protractor.js');
21
var util = require('util');
3-
require('../jasminewd');
4-
52

63
describe('longer example', function() {
74
var ptor = protractor.getInstance();
@@ -63,5 +60,3 @@ describe('longer example', function() {
6360
});
6461
});
6562
});
66-
67-

0 commit comments

Comments
 (0)