Skip to content

Commit

Permalink
Merging upstream changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
disciplezero committed Apr 10, 2014
2 parents 3604431 + 0f53904 commit 45bbe05
Show file tree
Hide file tree
Showing 36 changed files with 178 additions and 77 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.project
*.DS_Store
*.idea
.coveralls.yml
/nightwatch.json
node_modules
npm-debug.log
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

UI automated testing framework powered by [Node.js](http://nodejs.org/). It uses the [Selenium WebDriver API](https://code.google.com/p/selenium/wiki/JsonWireProtocol).

[![Build Status](https://travis-ci.org/beatfactor/nightwatch.png?branch=master)](https://travis-ci.org/beatfactor/nightwatch) [![NPM version](https://badge.fury.io/js/nightwatch.png)](http://badge.fury.io/js/nightwatch) [![Dependency Status](https://david-dm.org/beatfactor/nightwatch.png)](https://david-dm.org/beatfactor/nightwatch)
[![Build Status](https://travis-ci.org/beatfactor/nightwatch.png?branch=master)](https://travis-ci.org/beatfactor/nightwatch) [![NPM version](https://badge.fury.io/js/nightwatch.png)](http://badge.fury.io/js/nightwatch) [![Coverage Status](https://coveralls.io/repos/beatfactor/nightwatch/badge.png?branch=master)](https://coveralls.io/r/beatfactor/nightwatch?branch=master)

***

Expand Down
6 changes: 3 additions & 3 deletions bin/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
var fs = require('fs');
var path = require('path');
var Logger = require('../lib/logger.js');
var Logger = require('../lib/util/logger.js');
var cli = require('./_cli.js');


Expand Down Expand Up @@ -211,7 +211,7 @@ try {
process.chdir(process.cwd());

// the test runner
var runner = require(__dirname + '/../runner/run.js');
var runner = require(__dirname + '/../lib/runner/run.js');

var settings = readSettings(argv);

Expand Down Expand Up @@ -249,7 +249,7 @@ try {

// running the tests
if (settings.selenium && settings.selenium.start_process) {
var selenium = require(__dirname + '/../runner/selenium.js');
var selenium = require(__dirname + '/../lib/runner/selenium.js');
selenium.startServer(settings, test_settings, function(error, child, error_out, exitcode) {
if (error) {
Logger.error('There was an error while starting the Selenium server:');
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('./lib/index');
module.exports = process.env.NIGHTWATCH_COV
? require('./lib-cov/index')
: require('./lib/index');
12 changes: 6 additions & 6 deletions lib/api.js → lib/core/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = new (function() {
}
}

var dirPath = path.join(__dirname, './selenium/assertions/');
var dirPath = path.join(__dirname, './../selenium/assertions/');

loadAssertionFiles(dirPath, client.api.assert, true);
loadAssertionFiles(dirPath, client.api.verify, false);
Expand Down Expand Up @@ -128,7 +128,7 @@ module.exports = new (function() {
* Loads selenium protocol actions
*/
function loadProtocolActions() {
var protocol = require('./selenium/protocol.js')(client);
var protocol = require('./../selenium/protocol.js')(client);
var actions = Object.keys(protocol);
actions.forEach(function(command) {
addCommand(command, protocol[command], client.api, client.api);
Expand All @@ -140,14 +140,14 @@ module.exports = new (function() {
*/
function loadClientCommands() {
// adding element specific commands
var elementCommands = require('./selenium/element-commands.js')(client);
var elementCommands = require('./../selenium/element-commands.js')(client);
var entries = Object.keys(elementCommands);
entries.forEach(function(command) {
addCommand(command, elementCommands[command], client.api, client.api);
});

// adding client specific commands
var clientCommands = require('./selenium/client-commands.js')(client);
var clientCommands = require('./../selenium/client-commands.js')(client);
entries = Object.keys(clientCommands);
entries.forEach(function(command) {
addCommand(command, clientCommands[command], client.api, client.api);
Expand All @@ -160,8 +160,8 @@ module.exports = new (function() {
* Loads the external commands
*/
function loadCommandFiles(context) {
var relativePath = '/selenium/commands/';
var commandFiles = fs.readdirSync(__dirname + relativePath);
var relativePath = './../selenium/commands/';
var commandFiles = fs.readdirSync(path.join(__dirname, relativePath));
var commandName;
var commandModule;

Expand Down
2 changes: 1 addition & 1 deletion lib/assertion.js → lib/core/assertion.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var util = require('util');
var events = require('events');
var Logger = require('./logger.js');
var Logger = require('./../util/logger.js');

module.exports = new (function() {
var doneSymbol = String.fromCharCode(10004);
Expand Down
2 changes: 1 addition & 1 deletion lib/queue.js → lib/core/queue.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var util = require('util');
var events = require('events');
var Logger = require('./logger.js');
var Logger = require('./../util/logger.js');

function AsyncTree() {
events.EventEmitter.call(this);
Expand Down
2 changes: 1 addition & 1 deletion lib/request.js → lib/http/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var util = require('util'),
qs = require('querystring'),
http = require('http'),
https = require('https'),
Logger = require('./logger');
Logger = require('./../util/logger');

module.exports = (function() {
var Settings = {
Expand Down
12 changes: 6 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ var util = require('util');
var fs = require('fs');
var path = require('path');
var events = require('events');
var HttpRequest = require('./request.js');
var CommandQueue = require('./queue.js');
var Assertion = require('./assertion.js');
var Logger = require('./logger.js');
var Api = require('./api.js');
var HttpRequest = require('./http/request.js');
var CommandQueue = require('./core/queue.js');
var Assertion = require('./core/assertion.js');
var Logger = require('./util/logger.js');
var Api = require('./core/api.js');

function Nightwatch(options) {
var self = this;
Expand Down Expand Up @@ -150,7 +150,7 @@ Nightwatch.prototype.setCapabilities = function() {
};

Nightwatch.prototype.loadKeyCodes = function() {
this.api.Keys = require('./keys.json');
this.api.Keys = require('./util/keys.json');
return this;
};

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions runner/run.js → lib/runner/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ var fs = require('fs');
var util = require('util');
var mkpath = require('mkpath');
var minimatch = require('minimatch');
var Nightwatch = require('../index.js');
var Logger = require('../lib/logger.js');
var Nightwatch = require('../../index.js');
var Logger = require('../util/logger.js');

module.exports = new (function() {
var globalStartTime;
Expand Down
2 changes: 1 addition & 1 deletion runner/selenium.js → lib/runner/selenium.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var path = require('path');
var fs = require('fs');
var child_process = require('child_process');
var util = require('util');
var Logger = require('../lib/logger.js');
var Logger = require('../util/logger.js');

module.exports = new (function() {
var SENTINEL = 'Started org.openqa.jetty.jetty.Server';
Expand Down
2 changes: 1 addition & 1 deletion lib/selenium/element-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var fs = require('fs');
var path = require('path');
var util = require('util');
var events = require('events');
var Logger = require('../logger.js');
var Logger = require('../util/logger.js');

module.exports = function(client) {
var Protocol = require('./protocol.js')(client);
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
},
"devDependencies": {
"nodeunit": "latest",
"jscoverage": "latest",
"coveralls": "latest",
"jshint": "~2.4.4"
},
"bin": {
Expand All @@ -33,6 +35,7 @@
"man": "",
"scripts": {
"jshint": "./node_modules/.bin/jshint --verbose --config .jshintrc lib/",
"coveralls": "jscoverage lib && NIGHTWATCH_COV=1 node ./tests/run_tests.js lcov | coveralls",
"test": "node ./tests/run_tests.js"
}
}
2 changes: 1 addition & 1 deletion tests/run_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ process.chdir(__dirname);
try {
var server = require('mockserver').init();
server.on('listening', function() {
reporter.run(['src', 'src/index', 'src/runner', 'src/assertions', 'src/protocol', 'src/commands'], options, function() {
reporter.run(['src', 'src/index', 'src/runner', 'src/assertions', 'src/commands'], options, function() {
server.close();
});
});
Expand Down
11 changes: 7 additions & 4 deletions tests/src/assertions/testAttributeEquals.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
var Api = require('../../../lib/api.js');
var BASE_PATH = process.env.NIGHTWATCH_COV
? 'lib-cov'
: 'lib';
var Api = require('../../../'+BASE_PATH+'/core/api.js');
module.exports = {
setUp: function (callback) {
callback();
},

'attributeEquals assertion passed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/attributeEquals.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/attributeEquals.js');
var client = {
options : {},
api : {
Expand All @@ -32,7 +35,7 @@ module.exports = {
},

'attributeEquals assertion failed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/attributeEquals.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/attributeEquals.js');
var client = {
options : {},
api : {
Expand All @@ -59,7 +62,7 @@ module.exports = {
},

'attributeEquals assertion not found' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/attributeEquals.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/attributeEquals.js');
var client = {
options : {},
api : {
Expand Down
11 changes: 7 additions & 4 deletions tests/src/assertions/testContainsText.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
var Api = require('../../../lib/api.js');
var BASE_PATH = process.env.NIGHTWATCH_COV
? 'lib-cov'
: 'lib';
var Api = require('../../../'+BASE_PATH+'/core/api.js');
module.exports = {
setUp: function (callback) {
callback();
},

'containsText assertion passed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/containsText.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/containsText.js');
var client = {
options : {},
api : {
Expand All @@ -31,7 +34,7 @@ module.exports = {
},

'containsText assertion failed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/containsText.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/containsText.js');
var client = {
options : {},
api : {
Expand All @@ -56,7 +59,7 @@ module.exports = {
},

'containsText assertion not found' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/containsText.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/containsText.js');
var client = {
options : {},
api : {
Expand Down
11 changes: 7 additions & 4 deletions tests/src/assertions/testCssClassNotPresent.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
var Api = require('../../../lib/api.js');
var BASE_PATH = process.env.NIGHTWATCH_COV
? 'lib-cov'
: 'lib';
var Api = require('../../../'+BASE_PATH+'/core/api.js');
module.exports = {
setUp: function (callback) {
callback();
},

'cssClassNotPresent assertion passed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssClassNotPresent.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssClassNotPresent.js');
var client = {
options : {},
api : {
Expand Down Expand Up @@ -33,7 +36,7 @@ module.exports = {
},

'cssClassNotPresent assertion failed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssClassNotPresent.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssClassNotPresent.js');
var client = {
options : {},
api : {
Expand All @@ -58,7 +61,7 @@ module.exports = {
},

'cssClassNotPresent assertion not found' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssClassNotPresent.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssClassNotPresent.js');
var client = {
options : {},
api : {
Expand Down
11 changes: 7 additions & 4 deletions tests/src/assertions/testCssClassPresent.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
var Api = require('../../../lib/api.js');
var BASE_PATH = process.env.NIGHTWATCH_COV
? 'lib-cov'
: 'lib';
var Api = require('../../../'+BASE_PATH+'/core/api.js');
module.exports = {
setUp: function (callback) {
callback();
},

'cssClassNotPresent assertion passed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssClassPresent.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssClassPresent.js');
var client = {
options : {},
api : {
Expand Down Expand Up @@ -33,7 +36,7 @@ module.exports = {
},

'cssClassNotPresent assertion failed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssClassPresent.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssClassPresent.js');
var client = {
options : {},
api : {
Expand All @@ -58,7 +61,7 @@ module.exports = {
},

'cssClassNotPresent assertion not found' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssClassPresent.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssClassPresent.js');
var client = {
options : {},
api : {
Expand Down
11 changes: 7 additions & 4 deletions tests/src/assertions/testCssProperty.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
var Api = require('../../../lib/api.js');
var BASE_PATH = process.env.NIGHTWATCH_COV
? 'lib-cov'
: 'lib';
var Api = require('../../../'+BASE_PATH+'/core/api.js');
module.exports = {
setUp: function (callback) {
callback();
},

'cssProperty assertion passed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssProperty.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssProperty.js');
var client = {
options : {},
api : {
Expand Down Expand Up @@ -33,7 +36,7 @@ module.exports = {
},

'cssProperty assertion failed' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssProperty.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssProperty.js');
var client = {
options : {},
api : {
Expand All @@ -60,7 +63,7 @@ module.exports = {
},

'cssProperty assertion not found' : function(test) {
var assertionFn = require('../../../lib/selenium/assertions/cssProperty.js');
var assertionFn = require('../../../'+BASE_PATH+'/selenium/assertions/cssProperty.js');
var client = {
options : {},
api : {
Expand Down
Loading

0 comments on commit 45bbe05

Please sign in to comment.