-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
457 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// | ||
// Test - Import Cleaned Survey Data | ||
// [email protected] | ||
// | ||
// var require = patchRequire(require); | ||
|
||
//casperjs convention - call utils for phantom extension | ||
|
||
var utils = require('utils'); | ||
var ember_xpath = require('casper').selectXPath; | ||
// var loginModule = require('./lib/loginGAE.js'); | ||
var system = require('system'); | ||
|
||
// var consoleLog = require("./lib/jsConsole.js"); | ||
// var testrailModule = require("./lib/testrailPostResults.js"); | ||
|
||
casper.options.verbose = true; | ||
casper.options.javascriptEnabled = true; | ||
casper.options.logLevel = "debug"; | ||
casper.options.loadImages = true; | ||
phantom.cookiesEnabled = true; | ||
|
||
// casper.options.waitTimeout = 1000000; | ||
|
||
// casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) '); | ||
// print out all the messages in the headless browser context | ||
|
||
casper.on('remote.message', function(msg) { | ||
this.echo('remote message caught: ' + msg); | ||
}); | ||
|
||
casper.on("page.error", function(msg, trace) { | ||
this.echo("Page Error: " + msg, "ERROR"); | ||
}); | ||
|
||
|
||
casper.test.begin('FLOW Create Device Assignments', function suite(test) { | ||
var url = 'http://akvoflowsandbox.appspot.com/admin'; | ||
|
||
casper.start(url, function() { | ||
console.log("Initial Akvo FLOW Login Page"); | ||
// loginModule.login("[email protected]"); | ||
this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); | ||
this.fill('form#gaia_loginform', { | ||
Email: '[email protected]', | ||
Passwd: 'R4inDr0p!' | ||
}, true); | ||
}); | ||
|
||
casper.then(function () { | ||
casper.capture('screenshots/createAssign/postLogin.png'); | ||
|
||
this.test.assertVisible('.navSurveys', 'Surveys Tab Visible'); | ||
this.test.assertVisible('.navDevices', 'Devices Tab Visible'); | ||
this.test.assertVisible('.navData', 'Data Tab Visible'); | ||
this.test.assertVisible('.navReports', 'Reports Tab Visible'); | ||
this.test.assertVisible('.navMaps', 'Maps Tab Visible'); | ||
this.test.assertVisible('.navUsers', 'Users Tab Visible'); | ||
this.test.assertVisible('.navMessages', 'Messages Tab Visible'); | ||
|
||
}); | ||
|
||
casper.then(function () { | ||
this.thenClick('.navDevices a', function() { | ||
console.log("Navigate to 'root.navDevices.index' Event"); | ||
}); | ||
|
||
this.waitUntilVisible('#surveyDataTable tbody td', function | ||
then() { | ||
this.test.assertTruthy(casper.evaluate(function() { | ||
return FLOW.router.location.path | ||
}) === '/devices', 'Navigated to Devices Page'); | ||
}); | ||
|
||
this.capture('screenshots/createAssign/navDevices.png'); | ||
|
||
}); | ||
|
||
casper.then(function () { | ||
this.thenClick('#tabs ul li:nth-child(2) a', function() { | ||
console.log("Click Assignments List Tab"); | ||
}); | ||
|
||
|
||
}); | ||
|
||
casper.then(function () { | ||
this.test.assertVisible('#deviceDataTable td', 'Devices List Visible'); | ||
this.thenClick('.btnAboveTable'); | ||
casper.waitForResource("http://akvoflowsandbox.appspot.com/rest/survey_groups", | ||
function() { | ||
this.capture('screenshots/createAssign/surveyAssignmentsLoaded.png'); | ||
} | ||
); | ||
|
||
var date =new Date(); | ||
var tomorrow = new Date(date.getTime() + 24 * 60 * 60 * 1000); | ||
var today = new Date(date.getTime() +0 * 60 * 60 * 1000); | ||
|
||
this.fill('#assignSurveys form', { | ||
assignmentName: 'BlahBlah', | ||
from_date: today, | ||
to_date: tomorrow, | ||
}, true); | ||
|
||
this.capture('screenshots/createAssign/assignForm.png'); | ||
|
||
|
||
}); | ||
|
||
|
||
|
||
|
||
|
||
|
||
}); | ||
|
||
|
||
casper.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// Test - Import Cleaned Survey Data | ||
// [email protected] | ||
// | ||
// var require = patchRequire(require); | ||
|
||
//casperjs convention - call utils for phantom extension | ||
|
||
var utils = require('utils'); | ||
var ember_xpath = require('casper').selectXPath; | ||
// var loginModule = require('./lib/loginGAE.js'); | ||
var system = require('system'); | ||
|
||
// var consoleLog = require("./lib/jsConsole.js"); | ||
// var testrailModule = require("./lib/testrailPostResults.js"); | ||
|
||
casper.options.verbose = true; | ||
casper.options.javascriptEnabled = true; | ||
casper.options.logLevel = "debug"; | ||
casper.options.loadImages = true; | ||
phantom.cookiesEnabled = true; | ||
// casper.options.waitTimeout = 1000000; | ||
|
||
// casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) '); | ||
// print out all the messages in the headless browser context | ||
casper.on('remote.message', function(msg) { | ||
this.echo('remote message caught: ' + msg); | ||
}); | ||
|
||
casper.on("page.error", function(msg, trace) { | ||
this.echo("Page Error: " + msg, "ERROR"); | ||
}); | ||
|
||
casper.test.begin('FLOW Test Template', function suite(test) { | ||
var url = 'http://akvoflowsandbox.appspot.com/admin'; | ||
|
||
casper.start(url, function() { | ||
console.log("Initial Akvo FLOW Login Page"); | ||
// loginModule.login("[email protected]"); | ||
this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); | ||
this.fill('form#gaia_loginform', { | ||
Email: '[email protected]', | ||
Passwd: 'R4inDr0p!' | ||
}, true); | ||
}); | ||
|
||
|
||
// click devices tab | ||
casper.then(function() { | ||
this.thenClick('.navDevices a', function() { | ||
console.log("Navigate to 'root.navDevicesa.index' Event"); | ||
}); | ||
}); | ||
|
||
|
||
// wait till table is rendered | ||
casper.then(function(){ | ||
this.waitUntilVisible('#surveyDataTable tbody td', function then() { | ||
console.log('+++ devices table is rendered'); | ||
casper.capture('screenshots/device.png'); | ||
}); | ||
}); | ||
|
||
// count devices of version [versionNo] | ||
casper.then(function(){ | ||
this.evaluate( function() { | ||
versionNo='1.11.1'; | ||
deviceCount=0; | ||
|
||
$('#surveyDataTable tbody tr').each(function(){ | ||
//console.log($(this).find('.version').text()); | ||
if ( $(this).find('.version').text()==versionNo){ | ||
deviceCount++; | ||
} | ||
}) | ||
console.log('+++ Number of rows in devices table: '+$('#surveyDataTable tbody tr').length); | ||
console.log('+++ Number devices with version '+versionNo+': '+deviceCount); | ||
|
||
}); | ||
}); | ||
|
||
casper.run(function() { | ||
test.done(); | ||
}); | ||
|
||
}); | ||
|
Oops, something went wrong.