Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nightwatch

Package Overview
Dependencies
Maintainers
1
Versions
355
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nightwatch - npm Package Compare versions

Comparing version 0.4.8 to 0.4.9

tests/sampletests/withexclude/excluded/excluded-module.js

5

bin/runner.js

@@ -175,3 +175,6 @@ /**

if (typeof settings.globals == 'string' && settings.globals) {
var globals = readExternalGlobals(settings.globals);
settings.globals_path = settings.globals_path;
}
if (typeof settings.globals_path == 'string' && settings.globals_path) {
var globals = readExternalGlobals(settings.globals_path);
if (globals && globals.hasOwnProperty(argv.e)) {

@@ -178,0 +181,0 @@ test_settings.globals = globals[argv.e];

2

examples/tests/google.js

@@ -10,3 +10,3 @@ /**

setUp : function(c) {
console.log('Setting up...');
this.client.assert.equal(c.globals.myGlobal, 1, 'checking globals are loaded.');
},

@@ -13,0 +13,0 @@

@@ -271,11 +271,6 @@ /*!

var fileName = path.join(self.options.screenshots.path, 'ERROR_' +
dateStamp + '.png');
self.saveScreenshotToFile(fileName, screenshotContent);
if (self.results.tests.length) {
var lastTest = self.results.tests[self.results.tests.length-1];
lastTest.screenshots = lastTest.screenshots || [];
lastTest.screenshots.push(fileName);
}
var fileNamePath = path.resolve(path.join(self.options.screenshots.path, 'ERROR_' +
dateStamp + '.png'));
self.saveScreenshotToFile(fileNamePath, screenshotContent);
result.lastScreenshotFile = fileNamePath;
}

@@ -304,2 +299,9 @@

}
if (result.lastScreenshotFile && self.results.tests.length > 0) {
var lastTest = self.results.tests[self.results.tests.length-1];
lastTest.screenshots = lastTest.screenshots || [];
lastTest.screenshots.push(result.lastScreenshotFile);
delete result.lastScreenshotFile;
}
}

@@ -306,0 +308,0 @@ });

@@ -20,2 +20,3 @@ var util = require('util');

var node = {
startTime : null,
name : nodeName,

@@ -43,3 +44,4 @@ command : command,

this.runCommand(node, function onCommandComplete(command) {
Logger.log(Logger.colors.light_gray(' - Completed command ' + Logger.colors.light_green(node.name)));
var timems = new Date().getTime() - node.startTime;
Logger.log(Logger.colors.light_gray(' - Completed command ' + Logger.colors.light_green(node.name)), '(' + timems, 'ms)');

@@ -95,2 +97,3 @@ // checking if new children have been added while running this command which haven't finished yet

node.startTime = new Date().getTime();
var emitter = commandFn.apply(node.context, node.args);

@@ -97,0 +100,0 @@ if (emitter instanceof events.EventEmitter) {

@@ -114,3 +114,3 @@ module.exports = function(client) {

* ```
* this.demoTest = function (client) {
* this.demoTest = function (browser) {
* browser.end();

@@ -218,3 +218,3 @@ * };

* this.demoTest = function(browser) {
* client.getCookies(function callback(result) {
* browser.getCookies(function callback(result) {
* this.assert.equal(result.value.length, 1);

@@ -244,3 +244,3 @@ * this.assert.equals(result.value[0].name, 'test_cookie');

* this.demoTest = function(browser) {
* client.getCookie(function callback(result) {
* browser.getCookie(function callback(result) {
* this.assert.equal(result.value, '123456');

@@ -286,3 +286,3 @@ * this.assert.equals(result.name, 'test_cookie');

* this.demoTest = function(browser) {
* client.setCookie({
* browser.setCookie({
* name : "test_cookie",

@@ -315,3 +315,3 @@ * value : "test_value",

* this.demoTest = function(browser) {
* client.deleteCookie("test_cookie", function() {
* browser.deleteCookie("test_cookie", function() {
* // do something more in here

@@ -337,3 +337,3 @@ * });

* this.demoTest = function(browser) {
* client.deleteCookies(function() {
* browser.deleteCookies(function() {
* // do something more in here

@@ -340,0 +340,0 @@ * });

@@ -8,3 +8,3 @@ var util = require('util');

* ```
* this.demoTest = function (client) {
* this.demoTest = function (browser) {
* browser.pause(1000);

@@ -11,0 +11,0 @@ * // or suspend indefinitely

@@ -10,3 +10,3 @@ var util = require('util');

* ```
* this.demoTest = function (client) {
* this.demoTest = function (browser) {
* browser.waitForElementNotPresent('#dialog', 1000);

@@ -13,0 +13,0 @@ * };

@@ -10,3 +10,3 @@ var util = require('util');

* ```
* this.demoTest = function (client) {
* this.demoTest = function (browser) {
* browser.waitForElementNotVisible('#dialog', 1000);

@@ -13,0 +13,0 @@ * };

@@ -10,3 +10,3 @@ var util = require('util');

* ```
* this.demoTest = function (client) {
* this.demoTest = function (browser) {
* browser.waitForElementPresent('body', 1000);

@@ -13,0 +13,0 @@ * // continue if failed

@@ -10,3 +10,3 @@ var util = require('util');

* ```
* this.demoTest = function (client) {
* this.demoTest = function (browser) {
* browser.waitForElementVisible('body', 1000);

@@ -13,0 +13,0 @@ * // continue if failed

@@ -598,4 +598,6 @@ module.exports = function(Nightwatch) {

*
* @param callback
* @returns {*}
* @link /session/:sessionId/frame/parent
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @since v0.4.8
* @api protocol
*/

@@ -774,2 +776,14 @@ Actions.frameParent = function(callback) {

/**
* Send a sequence of key strokes to the active element.
*
* @link /session/:sessionId/keys
* @param {Array} keys The keys sequence to be sent. The sequence is defined in the [send keys](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value) command.
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api protocol
*/
Actions.keys = function(keys, callback) {
return postRequest('/keys', { value: keys }, callback);
};
/////////////////////////////////////////////////////////////////////////////

@@ -776,0 +790,0 @@ // Cookies

{
"name": "nightwatch",
"description": "A node.js bindings implementation for selenium 2.0/webdriver",
"version": "0.4.8",
"version": "0.4.9",
"author": {

@@ -6,0 +6,0 @@ "name": "Andrei Rusu",

@@ -26,3 +26,2 @@ var fs = require('fs'),

}
var rendered = ejs.render(tmpl, {

@@ -32,3 +31,3 @@ locals: {

moduleName : moduleName,
tests : tests,
testsNo : tests,
errors : errors,

@@ -35,0 +34,0 @@ failures : failures,

@@ -115,3 +115,3 @@ /**

if (opts.output) {
console.log('\nSkipping module: ', Logger.colors.cyan(moduleName));
console.log(Logger.colors.cyan(moduleName), 'module is disabled, skipping...');
}

@@ -188,3 +188,3 @@ moduleCallback(null, false);

function processExitListener() {
process.on('exit', function(code) {
process.on('exit', function (code) {
if (globalResults.errors > 0 || globalResults.failed > 0) {

@@ -218,2 +218,15 @@ process.exit(1);

paths.forEach(function(p) {
if (opts.exclude) {
if (!Array.isArray(opts.exclude)) {
opts.exclude = [opts.exclude];
}
opts.exclude = opts.exclude.map(function(item) {
// remove trailing slash
if (item.charAt(item.length-1) === path.sep) {
item = item.substring(0, item.length-1);
}
return path.join(p, item);
});
}
walk(p, function(err, list) {

@@ -227,5 +240,15 @@ if (err) {

var filename = filePath.split(path.sep).slice(-1)[0];
return opts.filter ?
minimatch(filename, opts.filter) :
extensionPattern.exec(filePath);
if (opts.exclude) {
for (var i = 0; i < opts.exclude.length; i++) {
if (minimatch(filePath, opts.exclude[i])) {
return false;
}
}
}
if (opts.filter) {
return minimatch(filename, opts.filter);
}
return extensionPattern.exec(filePath);
});

@@ -236,3 +259,2 @@

});
cb(null, modules);

@@ -261,3 +283,6 @@ }, opts);

var dirName = file.split(path.sep).slice(-1)[0];
if (opts.skipgroup && opts.skipgroup.indexOf(dirName) > -1) {
var isExcluded = opts.exclude && opts.exclude.indexOf(file) > -1;
var isSkipped = opts.skipgroup && opts.skipgroup.indexOf(dirName) > -1;
if (isExcluded || isSkipped) {
pending = pending-1;

@@ -368,3 +393,3 @@ } else {

} else {
if (opts.output && testresults.tests != globalResults.tests || testresults.steps.length > 1) {
if (opts.output && (testresults.tests != globalResults.tests || testresults.steps.length > 1)) {
printResults(globalResults, modulekeys);

@@ -392,4 +417,4 @@ }

}
finishCallback(null);
});
finishCallback(null);
});

@@ -396,0 +421,0 @@ }

@@ -28,3 +28,3 @@ try {

server.on('listening', function() {
reporter.run(['src', 'src/index', 'src/assertions', 'src/protocol', 'src/commands'], options, function() {
reporter.run(['src', 'src/index', 'src/runner', 'src/assertions', 'src/protocol', 'src/commands'], options, function() {
server.close();

@@ -31,0 +31,0 @@ });

@@ -14,6 +14,6 @@ var MockServer = require('mockserver');

MockServer.addMock({
url : "/wd/hub/session/1352110219202/element/0/displayed",
url : '/wd/hub/session/1352110219202/element/0/displayed',
method:'GET',
response : JSON.stringify({
sessionId: "1352110219202",
sessionId: '1352110219202',
status:0,

@@ -25,5 +25,5 @@ value : true

client.isVisible('css selector', '#weblogin', function callback(result) {
test.equals(result.value, true)
test.equals(result.value, true);
}).isVisible('#weblogin', function callback(result) {
test.equals(result.value, true)
test.equals(result.value, true);
test.done();

@@ -30,0 +30,0 @@ });

var Runner = require('../../../runner/run.js');
module.exports = {
setUp: function (callback) {
process.on('exit', function(code) {
process.exit(0);
});
callback();
},
testRunEmptyFolder : function(test) {

@@ -39,2 +32,36 @@ Runner.run([process.cwd() + '/sampletests/empty'], {

testRunWithExcludeFolder : function(test) {
Runner.run([process.cwd() + '/sampletests/withexclude'], {
seleniumPort : 10195,
silent : true,
output : false,
globals : {
test : test
},
exclude : ['excluded']
}, {
output_folder : false
}, function(err, results) {
test.ok(!('excluded-module' in results.modules));
test.done();
});
},
testRunWithExcludePattern : function(test) {
Runner.run([process.cwd() + '/sampletests/withexclude'], {
seleniumPort : 10195,
silent : true,
output : false,
globals : {
test : test
},
exclude : ['excluded/excluded-*']
}, {
output_folder : false
}, function(err, results) {
test.ok(!('excluded-module' in results.modules));
test.done();
});
},
testRunAsync : function(test) {

@@ -78,8 +105,3 @@ test.expect(5);

});
},
tearDown : function(callback) {
// clean up
callback();
}
};

@@ -10,8 +10,9 @@ var CommandQueue = require('../../lib/queue.js');

"Testing assertions loaded" : function(test) {
'Testing assertions loaded' : function(test) {
var assertModule = require('assert');
for (var prop in assertModule) {
var prop;
for (prop in assertModule) {
test.ok(prop in this.client.api.assert);
}
for (var prop in assertModule) {
for (prop in assertModule) {
test.ok(prop in this.client.api.verify);

@@ -60,3 +61,2 @@ }

}
}
};

@@ -475,3 +475,3 @@ module.exports = {

test.equal(command.request.method, "POST");
test.equal(command.request.method, 'POST');
test.equal(command.request.path, '/wd/hub/session/1352110219202/doubleclick');

@@ -844,2 +844,16 @@ });

testKeys : function(test) {
var protocol = this.protocol;
this.client.on('selenium:session_create', function() {
var command = protocol.keys(['A', 'B'], function callback() {
test.done();
});
test.equal(command.request.method, 'POST');
test.equal(command.data, '{"value":["A","B"]}');
test.equal(command.request.path, '/wd/hub/session/1352110219202/keys');
});
},
tearDown : function(callback) {

@@ -850,2 +864,2 @@ this.client = null;

}
}
};

@@ -41,3 +41,2 @@ var CommandQueue = require('../../lib/queue.js');

}
}
};

@@ -9,4 +9,4 @@ var nightwatch = require('../../index.js');

output : false,
username : "testusername",
access_key : "123456"
username : 'testusername',
access_key : '123456'
}).start().once('error', function() {

@@ -16,16 +16,16 @@ callback();

});
callback();
},
"Test initialization with credentials" : function(test) {
'Test initialization with credentials' : function(test) {
var self = this;
this.client.on('selenium:session_create', function(sessionId, request) {
var authorization = new Buffer("testusername:123456").toString('base64');
test.equal(request.request._headers['authorization'], "Basic " + authorization, "Testing if the Authorization header is set correctly");
var authorization = new Buffer('testusername:123456').toString('base64');
test.equal(request.request._headers['authorization'], 'Basic ' + authorization, 'Testing if the Authorization header is set correctly');
test.done();
});
},
tearDown : function(callback) {

@@ -37,3 +37,2 @@ this.client.queue.reset();

}
}
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc