diff --git a/README.md b/README.md index 9cc1adff3..3b8043edb 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/example/onProtractor.js b/example/onProtractorRunner.js similarity index 94% rename from example/onProtractor.js rename to example/onProtractorRunner.js index f1101ac88..7729cf044 100644 --- a/example/onProtractor.js +++ b/example/onProtractorRunner.js @@ -1,6 +1,4 @@ var util = require('util'); -var protractor = require('../lib/protractor.js'); -require('../jasminewd'); describe('angularjs homepage', function() { var ptor; diff --git a/example/protractorConf.js b/example/protractorConf.js index ea6772d6f..762eb8d7a 100644 --- a/example/protractorConf.js +++ b/example/protractorConf.js @@ -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: { diff --git a/lib/cli.js b/lib/cli.js index ec2a25350..43513dbb2 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -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; diff --git a/package.json b/package.json index 10064dff5..de11b1ed7 100644 --- a/package.json +++ b/package.json @@ -33,5 +33,5 @@ "scripts": { "test": "node lib/cli.js conf.js" }, - "version": "0.6.2" + "version": "0.7.0" } diff --git a/spec/findelements_spec.js b/spec/findelements_spec.js index 371b7fc4b..c85d5d615 100644 --- a/spec/findelements_spec.js +++ b/spec/findelements_spec.js @@ -1,6 +1,4 @@ -var protractor = require('../lib/protractor.js'); var util = require('util'); -require('../jasminewd'); describe('finding elements', function() { var ptor; diff --git a/spec/lib_spec.js b/spec/lib_spec.js index eb896d7bc..0d4cbd1a0 100644 --- a/spec/lib_spec.js +++ b/spec/lib_spec.js @@ -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() { diff --git a/spec/mockmodule_spec.js b/spec/mockmodule_spec.js index 5968baeeb..cd36d9298 100644 --- a/spec/mockmodule_spec.js +++ b/spec/mockmodule_spec.js @@ -1,6 +1,4 @@ -var protractor = require('../lib/protractor.js'); var util = require('util'); -require('../jasminewd'); describe('mock modules', function() { var ptor = protractor.getInstance(); diff --git a/spec/synchronize_spec.js b/spec/synchronize_spec.js index 126909993..2f0a7aff7 100644 --- a/spec/synchronize_spec.js +++ b/spec/synchronize_spec.js @@ -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(); diff --git a/spec/testapp_spec.js b/spec/testapp_spec.js index 819d8cc7e..6512a07f3 100644 --- a/spec/testapp_spec.js +++ b/spec/testapp_spec.js @@ -1,7 +1,4 @@ -var protractor = require('../lib/protractor.js'); var util = require('util'); -require('../jasminewd'); - describe('longer example', function() { var ptor = protractor.getInstance(); @@ -63,5 +60,3 @@ describe('longer example', function() { }); }); }); - -