Added nightwatch starrynight scaffold folder
This commit is contained in:
parent
2ea9eae0aa
commit
d2ab42e11c
1
LesionTracker/tests/nightwatch/.npmignore
Normal file
1
LesionTracker/tests/nightwatch/.npmignore
Normal file
@ -0,0 +1 @@
|
||||
reports
|
||||
@ -0,0 +1,4 @@
|
||||
exports.assertion = function() {
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
@ -0,0 +1,4 @@
|
||||
exports.command = function() {
|
||||
|
||||
return this;
|
||||
};
|
||||
@ -0,0 +1,15 @@
|
||||
exports.command = function(username, password) {
|
||||
this
|
||||
.waitForElementVisible('#entrySignIn', 1000)
|
||||
.verify.elementPresent("#signInPageTitle")
|
||||
.verify.elementPresent("#signInPageMessage")
|
||||
.verify.elementPresent("#signInPageEmailInput")
|
||||
.verify.elementPresent("#signInPagePasswordInput")
|
||||
.verify.elementPresent("#signInToAppButton")
|
||||
.verify.elementPresent("#needAnAccountButton")
|
||||
|
||||
.verify.containsText("#signInPageTitle", "Sign In")
|
||||
.verify.containsText("#signInPageMessage", "Improve your clincal practice with checklists.")
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
@ -0,0 +1,11 @@
|
||||
exports.command = function(username, password) {
|
||||
this
|
||||
.waitForElementVisible('#entrySignUp', 1000)
|
||||
.verify.elementPresent("#signUpPageEmailInput")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPagePasswordConfirmInput")
|
||||
|
||||
.verify.elementPresent("#signUpPageJoinNowButton")
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
14
LesionTracker/tests/nightwatch/commands/api/entry/signIn.js
Normal file
14
LesionTracker/tests/nightwatch/commands/api/entry/signIn.js
Normal file
@ -0,0 +1,14 @@
|
||||
exports.command = function(username, password) {
|
||||
|
||||
this
|
||||
.waitForElementVisible('#entrySignIn', 1000)
|
||||
.verify.elementPresent("#signInPageEmailInput")
|
||||
.verify.elementPresent("#signInPagePasswordInput")
|
||||
|
||||
.setValue("#signInPageEmailInput", username)
|
||||
.setValue("#signInPagePasswordInput", password)
|
||||
|
||||
.click("#signInToAppButton").pause(1000)
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
@ -0,0 +1,8 @@
|
||||
exports.command = function(email, password) {
|
||||
|
||||
this
|
||||
.verify.elementPresent("#logoutButton")
|
||||
.click("#logoutButton").pause(500)
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
23
LesionTracker/tests/nightwatch/commands/api/entry/signUp.js
Normal file
23
LesionTracker/tests/nightwatch/commands/api/entry/signUp.js
Normal file
@ -0,0 +1,23 @@
|
||||
exports.command = function(email, password) {
|
||||
|
||||
this
|
||||
.waitForElementVisible('#entrySignUp', 1000)
|
||||
.verify.elementPresent("#signUpPageEmailInput")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPagePasswordConfirmInput")
|
||||
|
||||
.clearValue("#signUpPageEmailInput")
|
||||
.clearValue("#signUpPagePasswordInput")
|
||||
.clearValue("#signUpPagePasswordConfirmInput")
|
||||
|
||||
// .setValue("#signUpPageUsernameInput", "Jane Doe")
|
||||
.setValue("#signUpPageEmailInput", email)
|
||||
.setValue("#signUpPagePasswordInput", password)
|
||||
.setValue("#signUpPagePasswordConfirmInput", password)
|
||||
|
||||
.click("#signUpPageJoinNowButton").pause(200)
|
||||
|
||||
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
@ -0,0 +1,21 @@
|
||||
// async version calls method on the server
|
||||
exports.command = function(methodName, timeout) {
|
||||
var client = this;
|
||||
if (!timeout) {
|
||||
timeout = 5000;
|
||||
}
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(timeout)
|
||||
.executeAsync(function(data, meteorCallback){
|
||||
//return HipaaLogger.logEventObject(data);
|
||||
Meteor.call(methodName, data, function(meteorError, meteorResult){
|
||||
var response = (meteorError ? { error: meteorError } : { result: meteorResult });
|
||||
meteorCallback(response);
|
||||
})
|
||||
}, [hipaaEvent], function(result){
|
||||
console.log("result.value", result.value);
|
||||
client.assert.ok(result.value);
|
||||
}).pause(1000)
|
||||
return this;
|
||||
};
|
||||
@ -0,0 +1,40 @@
|
||||
/*exports.command = function(sessionName, expectedValue, timeout, callback) {
|
||||
|
||||
var self = this;
|
||||
if (!timeout) {
|
||||
timeout = 5000;
|
||||
}
|
||||
|
||||
var glassOpacity = false;
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(timeout)
|
||||
.executeAsync(function (data, callback) {
|
||||
return Session.get('glassOpacity');
|
||||
}, [''], function (response) { // you need to pass an ARRAY of ONE argument, must be a bug
|
||||
if (response.value.error) {
|
||||
throw 'Meteor apply (call) returned an error: ' + response.value.error;
|
||||
} else if (typeof callback === 'function') {
|
||||
callback.call(self);
|
||||
}
|
||||
})
|
||||
return this;
|
||||
};*/
|
||||
|
||||
|
||||
|
||||
|
||||
// syncrhonous version; only works for checking javascript objects on client
|
||||
exports.command = function(sessionVarName, expectedValue) {
|
||||
var client = this;
|
||||
this
|
||||
.execute(function(data){
|
||||
return Session.get(data);
|
||||
}, [sessionVarName], function(result){
|
||||
client.assert.ok(result.value);
|
||||
if(expectedValue){
|
||||
client.assert.equal(result.value, expectedValue);
|
||||
}
|
||||
}).pause(1000)
|
||||
return this;
|
||||
};
|
||||
@ -0,0 +1,10 @@
|
||||
exports.command = function(username, password) {
|
||||
this
|
||||
.verify.elementPresent("#appBody")
|
||||
.verify.elementPresent("#navbarHeader")
|
||||
.verify.elementPresent("#contentContainer")
|
||||
.verify.elementPresent("#contentContainer .content-scrollable")
|
||||
.verify.elementPresent("#navbarFooter")
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
// async version calls method on the server
|
||||
exports.command = function(methodName, timeout) {
|
||||
/*var client = this;
|
||||
if (!timeout) {
|
||||
timeout = 5000;
|
||||
}
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(timeout)
|
||||
.executeAsync(function(data, meteorCallback){
|
||||
//return HipaaLogger.logEventObject(data);
|
||||
Meteor.call(methodName, data, function(meteorError, meteorResult){
|
||||
var response = (meteorError ? { error: meteorError } : { result: meteorResult });
|
||||
meteorCallback(response);
|
||||
})
|
||||
}, [hipaaEvent], function(result){
|
||||
console.log("result.value", result.value);
|
||||
client.assert.ok(result.value);
|
||||
}).pause(1000)
|
||||
return this;*/
|
||||
return this;
|
||||
};
|
||||
9
LesionTracker/tests/nightwatch/commands/sectionBreak.js
Normal file
9
LesionTracker/tests/nightwatch/commands/sectionBreak.js
Normal file
@ -0,0 +1,9 @@
|
||||
exports.command = function(input, callback) {
|
||||
|
||||
this
|
||||
.frame(null)
|
||||
.waitForElementVisible("body", 1000, "=============================================================")
|
||||
.verify.elementPresent("body", "== " + input)
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
7
LesionTracker/tests/nightwatch/commands/waitForPage.js
Normal file
7
LesionTracker/tests/nightwatch/commands/waitForPage.js
Normal file
@ -0,0 +1,7 @@
|
||||
exports.command = function(pageId) {
|
||||
|
||||
this
|
||||
.waitForElementVisible(pageId, 3000)
|
||||
|
||||
return this; // allows the command to be chained.
|
||||
};
|
||||
8
LesionTracker/tests/nightwatch/globals.json
Normal file
8
LesionTracker/tests/nightwatch/globals.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"default" : {
|
||||
"myGlobal" : 1
|
||||
},
|
||||
"test_env" : {
|
||||
"myGlobal" : 2
|
||||
}
|
||||
}
|
||||
1
LesionTracker/tests/nightwatch/logs/selenium-debug.log
Normal file
1
LesionTracker/tests/nightwatch/logs/selenium-debug.log
Normal file
@ -0,0 +1 @@
|
||||
hh:mm:ss.sss INFO - Initializing debug log
|
||||
34
LesionTracker/tests/nightwatch/unittests/foo.js
Normal file
34
LesionTracker/tests/nightwatch/unittests/foo.js
Normal file
@ -0,0 +1,34 @@
|
||||
//var Utils = require('lib/util/utils.js');
|
||||
module.exports = {
|
||||
testTrue: function(client){
|
||||
client.assert.equal(true, true);
|
||||
}
|
||||
/*testFormatElapsedTime : function(client) {
|
||||
var test = client.assert;
|
||||
|
||||
var resultMs = Utils.formatElapsedTime(999);
|
||||
var resultSec = Utils.formatElapsedTime(1999);
|
||||
var resultMin = Utils.formatElapsedTime(122299, true);
|
||||
|
||||
test.equal(resultMs, '999ms');
|
||||
test.equal(resultSec, '1.999s');
|
||||
test.equal(resultMin, '2m 2s / 122299ms');
|
||||
},
|
||||
|
||||
testMakeFnAsync : function(client) {
|
||||
function asynFn(done) {
|
||||
done();
|
||||
}
|
||||
|
||||
function syncFn() {}
|
||||
|
||||
var test = client.assert;
|
||||
|
||||
test.equal(Utils.makeFnAsync(1, asynFn), asynFn);
|
||||
|
||||
var convertedFn = Utils.makeFnAsync(1, syncFn);
|
||||
convertedFn(function() {
|
||||
test.ok('converted fn called');
|
||||
});
|
||||
}*/
|
||||
};
|
||||
14
LesionTracker/tests/nightwatch/walkthroughs/appLayout.js
Normal file
14
LesionTracker/tests/nightwatch/walkthroughs/appLayout.js
Normal file
@ -0,0 +1,14 @@
|
||||
// add tests to this file using the Nightwatch.js API
|
||||
// http://nightwatchjs.org/api
|
||||
|
||||
module.exports = {
|
||||
"Layout & Static Pages" : function (client) {
|
||||
client
|
||||
.url("http://localhost:3000")
|
||||
.resizeWindow(1024, 768)
|
||||
.verify.elementPresent("body")
|
||||
|
||||
|
||||
.end();
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user