From bbf43e311d4b30409281a93612a9c36a8837ba74 Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 17 Sep 2013 22:51:28 +0200 Subject: [PATCH 01/15] implement fs.read in loginGAE, cleanup flow_sandbox --- .../tests/casperjs/flow_importUpdateSurvey.js | 65 ++++++++++--------- Dashboard/tests/casperjs/flow_sandbox.js | 35 ++++++---- Dashboard/tests/casperjs/lib/loginGAE.js | 26 ++++++-- 3 files changed, 79 insertions(+), 47 deletions(-) diff --git a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js index bd2046bc5c..a93c9694df 100644 --- a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js +++ b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js @@ -12,17 +12,20 @@ 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 = 100000; - casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) '); + casper.options.waitTimeout = 1000000; + system.env.RAISE_ON_DEPRECATION = true; + + // 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); @@ -34,19 +37,22 @@ var url = 'http://akvoflowsandbox.appspot.com/admin/'; - casper.test.begin('Import Clean Survey Data', function suite(test) { + casper.test.begin('Import Clean Survey Data', 20, function suite(test) { // var url = 'http://uat1.akvoflow.org'; - var url = 'http://akvoflowsandbox.appspot.com/admin/'; - + var url = 'http://akvoflowsandbox.appspot.com/admin'; - casper.start(casper.cli.get("url"), function() { - console.log("Initial Akvo FLOW Login Page"); - - loginModule.login("akvoqa@gmail.com"); - }); + casper.start(url, function() { + console.log("Initial Akvo FLOW Login Page"); + // loginModule.login("akvoqa@gmail.com"); + this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); + this.fill('form#gaia_loginform', { + Email: 'akvoqa@gmail.com', + Passwd: 'R4inDr0p!' + }, true); + }); casper.then(function () { casper.capture('screenshots/NavAdmin-capture.png'); @@ -117,14 +123,15 @@ casper.then(function() { - var pElements = document.getElementsByTagName('.device'); // NodeList - + this.evaluate(function() { + var pElements = document.getElementsByTagName('.device'); // NodeList + for (var i = 0, len = pElements.length; i < len; i = i + 1) { this.echo(pElements[i], + " check this out ", PELEMENT); console.log("HelloHlllo"); }; }); - + }); casper.then(function () { this.test.assertSelectorHasText('a', 'Data cleaning'); @@ -159,23 +166,29 @@ this.evaluate( function() { var valSurveyGroup = '2164002'; + // var valSurvey = '2165002'; $('select.ember-select option').each(function(index, option) { if ($(this).text() === "Akvo QA") { $('select.ember-select:nth-of-type(1)').val(valSurveyGroup); $('select.ember-select:nth-of-type(1)').trigger('change'); console.log("Akvo Survey Group Selected" + " " + valSurveyGroup); + + // $('select.ember-select:nth-child(3)').val(valSurvey); + // $('select.ember-select:nth-child(3)').trigger('change'); + // console.log("Akvo Survey Selected" + " " + valSurvey); return false; - } + } }); }); - - this.waitForText("QA Eng Survey I", function then() { - this.test.assertVisible('select.ember-select:nth-of-type(2)'); - this.evaluate( function() { + + // this.waitForText("QA Eng Survey I", function then() { + // }); + this.test.assertVisible('select.ember-select:nth-of-type(2)'); + this.evaluate( function() { var valSurvey = '2165002'; - $('select.ember-select option').each(function(index, option) { + $('select.ember-select option').each(function(index, option) { if ($(this).text() === "QA Eng Survey I") { $('select.ember-select:nth-of-type(2)').val(valSurvey); $('select.ember-select:nth-of-type(2)').trigger('change'); @@ -184,8 +197,7 @@ } }); }); - }); - + this.wait(5000, function() { casper.capture('screenshots/DataCleaningSelect_DropDown.png'); this.test.assertVisible(ember_xpath('//*[contains(text()," Raw data report ")]'), 'Raw Data Export Visible'); @@ -231,11 +243,6 @@ -casper.test.suiteResults.getAllPasses(); - -casper.run(function() { - this.test.done(); - // casper.test.renderResults(true, 0, 'test-results.xml'); - }); - +// casper.test.suiteResults.getAllPasses(); +casper.run(); diff --git a/Dashboard/tests/casperjs/flow_sandbox.js b/Dashboard/tests/casperjs/flow_sandbox.js index 8fb1b671c8..63a7380ce2 100644 --- a/Dashboard/tests/casperjs/flow_sandbox.js +++ b/Dashboard/tests/casperjs/flow_sandbox.js @@ -21,7 +21,7 @@ PageSettings: { javascriptEnabled: true, loadImages: true, // WebPage instance will use these settings laodPlugins: false, // use these settings - userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36' + // userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36' } }); @@ -31,23 +31,36 @@ casper.start(url, function() { console.log("Initial Akvo FLOW Login Page"); this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); this.fill('form#gaia_loginform', { - Email: '', - Passwd: '' + Email: 'akvoqa@gmail.com', + Passwd: 'R4inDr0p!' }, true); }); casper.then(function() { - this.click('.navDevices a'); + this.test.assertVisible('.navSurveys', 'Survey Tab Visible'); + this.test.assertVisible('.navDevices', 'Device 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'); + + this.test.assertTruthy(casper.evaluate(function() { + return FLOW.router.location.path + }) === '/surveys/main', 'Successfully Loaded Main Surveys Page'); + + this.click('.navData a'); this.waitUntilVisible('#surveyDataTable td.EMEI', function then() { - this.capture('screenshots/devicesTable.png', { + this.capture('screenshots/sandbox/sandbox-navData.png', { top: 0, left: 0, width: 1280, height: 1024 }); }); - +}); +/* var mngdeviceLink = 'a[id="ember15890"]'; if (!this.exists(mngdeviceLink)) return; @@ -70,23 +83,23 @@ casper.then(function() { * }; * */ - +/* setInterval(function () { document.getElementById("ember15980").click();}, 1000); this.click('.btnAboveTable a'); casper.capture('screenshots/devicesManageDevices.png'); }); +*/ -asper.then(function() { +casper.then(function() { this.click('.nextBtn a'); this.waitUntilVisible('#surveyDataTable td.device', ember_xpath('//*[@id="surveyDataTable"]/tbody/tr[1]/td[3]'), function then() { casper.capture('screenshots/NavData-SurveyDataTableNext.png'); - } - ); - }); + }); + }); casper.run(); diff --git a/Dashboard/tests/casperjs/lib/loginGAE.js b/Dashboard/tests/casperjs/lib/loginGAE.js index 5331ff85e0..90c21b42ae 100644 --- a/Dashboard/tests/casperjs/lib/loginGAE.js +++ b/Dashboard/tests/casperjs/lib/loginGAE.js @@ -1,18 +1,30 @@ // login module // -//casper.options.verbose = true; +// patching phantomjs require to allow casper modules using thei full name +var require = patchRequire(require); +var fs = require('fs'); + +casper.options.verbose = true; casper.options.logLevel = "debug"; -//casper.options.javascriptEnabled = true; -//casper.options.loadImages = true; -//phantom.cookiesEnabled = true; -//casper.options.waitTimeout = 5000; +casper.options.javascriptEnabled = true; +casper.options.loadImages = true; +phantom.cookiesEnabled = true; +casper.options.waitTimeout = 5000; +casper.options.clientScripts.push("includes/jquery-1.8.2.min.js"); exports.login = function(username, password) { casper.test.comment("Login with username \"" + username + "\""); var url = 'https://akvoflowsandbox.appspot.com/admin'; + + var gmailCred = { + 'Passwd': fs.read('./lib/creds/akvoqa_gmail') + }; + + // closure to capture the file information. + casper.open(url).then(function() { this.capture('screenshots/NavLogin-GAE.png'); @@ -24,12 +36,12 @@ exports.login = function(username, password) { casper.fill('form#gaia_loginform', { Email: 'akvoqa@gmail.com', - Passwd: 'R4inDr0p!' + gmailCred }, true); //POST to GAE - this.waitForResource(this.getCurrentUrl(), function() { + return this.waitForResource(this.getCurrentUrl(), function() { casper.capture('screenshots/NavAdmin-FLOW.png'); }, function() { // page load failed after 5 seconds From 2f6d1c6125690377431fb1d7e50f29e87260e91b Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Thu, 19 Sep 2013 11:49:28 +0100 Subject: [PATCH 02/15] Issue #367 - URLDecode submitter name --- .../mapping/app/web/dto/RawDataImportRequest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GAE/src/org/waterforpeople/mapping/app/web/dto/RawDataImportRequest.java b/GAE/src/org/waterforpeople/mapping/app/web/dto/RawDataImportRequest.java index c15d20f813..1d5be3a164 100644 --- a/GAE/src/org/waterforpeople/mapping/app/web/dto/RawDataImportRequest.java +++ b/GAE/src/org/waterforpeople/mapping/app/web/dto/RawDataImportRequest.java @@ -209,7 +209,8 @@ protected void populateFields(HttpServletRequest req) throws Exception { collectionDate = IN_FMT.get().parse(colDate); } if (req.getParameter(SUBMITTER_PARAM) != null) { - setSubmitter(req.getParameter(SUBMITTER_PARAM)); + setSubmitter(URLDecoder.decode( + req.getParameter(SUBMITTER_PARAM), "UTF-8")); } if (req.getParameter(DURATION_PARAM) != null) { Double duration = Double.valueOf(req.getParameter(DURATION_PARAM)); From a1e4e97ba9abb2e8ab15f17e88995f8402857292 Mon Sep 17 00:00:00 2001 From: nehafish Date: Fri, 20 Sep 2013 00:14:44 +0200 Subject: [PATCH 03/15] Refactor Data Cleaning Dropdown --- .../tests/casperjs/flow_importUpdateSurvey.js | 34 ++++++++++++++++--- Dashboard/tests/casperjs/flow_sandbox.js | 3 +- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js index a93c9694df..88b39d9b9e 100644 --- a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js +++ b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js @@ -166,14 +166,20 @@ this.evaluate( function() { var valSurveyGroup = '2164002'; - // var valSurvey = '2165002'; + var valSurvey = '2165002'; $('select.ember-select option').each(function(index, option) { if ($(this).text() === "Akvo QA") { $('select.ember-select:nth-of-type(1)').val(valSurveyGroup); $('select.ember-select:nth-of-type(1)').trigger('change'); + console.log("Akvo Survey Group Selected" + " " + valSurveyGroup); + console.log("el id =" + $('select.ember-select:nth-of-type(1)')[0].id); + console.log("el id =" + $('select.ember-select:nth-of-type(2)')[0].id); + console.log("Akvo Survey Selected" + " " + valSurvey); + + // $('select.ember-select:nth-child(3)').val(valSurvey); // $('select.ember-select:nth-child(3)').trigger('change'); // console.log("Akvo Survey Selected" + " " + valSurvey); @@ -182,17 +188,37 @@ }); }); + casper.waitForResource("http://akvoflowsandbox.appspot.com/rest/surveys", function() { + this.echo('survey has been loaded'); + this.evaluate( function() { + var valSurvey = '2165002'; + + setTimeout(function() { + console.log("drop down=" + $('select.ember-select:nth-of-type(2)')[0].innerHTML); + $('select.ember-select:nth-of-type(2)').val(valSurvey); + $('select.ember-select:nth-of-type(2)').trigger('change'); + return false; + }, 1); + + }); + casper.capture('screenshots/Survey_DropDown.png'); + }); + // this.waitForText("QA Eng Survey I", function then() { // }); this.test.assertVisible('select.ember-select:nth-of-type(2)'); + this.evaluate( function() { - var valSurvey = '2165002'; + var valSurvey = '2165002'; - $('select.ember-select option').each(function(index, option) { + $('select.ember-select option').each(function(index, option) { if ($(this).text() === "QA Eng Survey I") { $('select.ember-select:nth-of-type(2)').val(valSurvey); $('select.ember-select:nth-of-type(2)').trigger('change'); - console.log("Akvo Survey Selected" + " " + valSurvey); + console.log("el id =" + $('select.ember-select:nth-of-type(1)')[0].id); + console.log("el id =" + $('select.ember-select:nth-of-type(2)')[0].id); + // console.log("el id =" + $('select.ember-select:nth-of-type(3)')[0].id); + // console.log("Akvo Survey Selected" + " " + valSurvey); return false; } }); diff --git a/Dashboard/tests/casperjs/flow_sandbox.js b/Dashboard/tests/casperjs/flow_sandbox.js index 63a7380ce2..df3c1dcc8f 100644 --- a/Dashboard/tests/casperjs/flow_sandbox.js +++ b/Dashboard/tests/casperjs/flow_sandbox.js @@ -7,7 +7,7 @@ var utils = require('utils'); - +var ember_xpath = require('casper').selectXPath; var casper = require('casper').create({ verbose: true, logLevel: 'debug', @@ -94,6 +94,7 @@ casper.then(function() { casper.then(function() { this.click('.nextBtn a'); + this.waitUntilVisible('#surveyDataTable td.device', ember_xpath('//*[@id="surveyDataTable"]/tbody/tr[1]/td[3]'), function then() { From 900851069fae341fa2358395216fcabf1f57f19a Mon Sep 17 00:00:00 2001 From: nehafish Date: Fri, 20 Sep 2013 00:45:34 +0200 Subject: [PATCH 04/15] test.done() --- Dashboard/tests/casperjs/flow_importUpdateSurvey.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js index 88b39d9b9e..394691308b 100644 --- a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js +++ b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js @@ -271,4 +271,7 @@ // casper.test.suiteResults.getAllPasses(); -casper.run(); +casper.run(function() { + this.test.done(); + // casper.test.renderResults(true, 0, 'test-results.xml'); +}); From 67cd14d480680e1a6fe344d0b09fd8cbf1e86053 Mon Sep 17 00:00:00 2001 From: nehafish Date: Mon, 23 Sep 2013 20:05:16 -0700 Subject: [PATCH 05/15] fix importSurveys, remove unused module references. Basic template. --- .../tests/casperjs/flow_importUpdateSurvey.js | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js index 394691308b..f8e730f203 100644 --- a/Dashboard/tests/casperjs/flow_importUpdateSurvey.js +++ b/Dashboard/tests/casperjs/flow_importUpdateSurvey.js @@ -5,13 +5,13 @@ // Test - Import Cleaned Survey Data // neha@akvo.org // - var require = patchRequire(require); + // 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 loginModule = require("./lib/loginGAE.js"); var system = require('system'); // var consoleLog = require("./lib/jsConsole.js"); @@ -22,8 +22,7 @@ casper.options.logLevel = "debug"; casper.options.loadImages = true; phantom.cookiesEnabled = true; - casper.options.waitTimeout = 1000000; - system.env.RAISE_ON_DEPRECATION = 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 @@ -35,24 +34,23 @@ this.echo("Page Error: " + msg, "ERROR"); }); - var url = 'http://akvoflowsandbox.appspot.com/admin/'; - casper.test.begin('Import Clean Survey Data', 20, function suite(test) { + casper.test.begin('Import Clean Survey Data', function suite(test) { // var url = 'http://uat1.akvoflow.org'; - var url = 'http://akvoflowsandbox.appspot.com/admin'; + var url = 'http://akvoflowsandbox.appspot.com/admin'; - casper.start(url, function() { - console.log("Initial Akvo FLOW Login Page"); + casper.start(url, function() { + console.log("Initial Akvo FLOW Login Page"); // loginModule.login("akvoqa@gmail.com"); this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); this.fill('form#gaia_loginform', { Email: 'akvoqa@gmail.com', Passwd: 'R4inDr0p!' }, true); - }); + }); casper.then(function () { casper.capture('screenshots/NavAdmin-capture.png'); @@ -97,8 +95,7 @@ // ember_xpath('//*[@id="surveyDataTable"]/tbody/tr[1]/td[3]'), function then() { casper.capture('screenshots/NavData-SurveyDataTable.png'); - } - ); + }); this.waitUntilVisible('.nextBtn a', function then() { @@ -109,7 +106,6 @@ }); - // }); casper.then(function() { this.click('.nextBtn a'); @@ -122,16 +118,6 @@ }); - casper.then(function() { - this.evaluate(function() { - var pElements = document.getElementsByTagName('.device'); // NodeList - - for (var i = 0, len = pElements.length; i < len; i = i + 1) { - this.echo(pElements[i], + " check this out ", PELEMENT); - console.log("HelloHlllo"); - }; - }); - }); casper.then(function () { this.test.assertSelectorHasText('a', 'Data cleaning'); @@ -178,8 +164,6 @@ console.log("el id =" + $('select.ember-select:nth-of-type(2)')[0].id); console.log("Akvo Survey Selected" + " " + valSurvey); - - // $('select.ember-select:nth-child(3)').val(valSurvey); // $('select.ember-select:nth-child(3)').trigger('change'); // console.log("Akvo Survey Selected" + " " + valSurvey); @@ -265,13 +249,12 @@ }); -}); - - - // casper.test.suiteResults.getAllPasses(); -casper.run(function() { - this.test.done(); - // casper.test.renderResults(true, 0, 'test-results.xml'); +// casper.run(); + + casper.run(function() { + this.test.done(); + // casper.test.renderResults(true, 0, 'test-results.xml'); + }); }); From 333c0f819d3abffa1be631a3da8d1eaf4932e7f2 Mon Sep 17 00:00:00 2001 From: nehafish Date: Mon, 23 Sep 2013 20:05:47 -0700 Subject: [PATCH 06/15] Basic template. --- Dashboard/tests/casperjs/flow_template.js | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Dashboard/tests/casperjs/flow_template.js diff --git a/Dashboard/tests/casperjs/flow_template.js b/Dashboard/tests/casperjs/flow_template.js new file mode 100644 index 0000000000..38580a26c9 --- /dev/null +++ b/Dashboard/tests/casperjs/flow_template.js @@ -0,0 +1,50 @@ +// +// Test - Import Cleaned Survey Data +// neha@akvo.org +// +// 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("akvoqa@gmail.com"); + this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); + this.fill('form#gaia_loginform', { + Email: 'akvoqa@gmail.com', + Passwd: 'R4inDr0p!' + }, true); + }); +}); + + +casper.run(); From 9850d74a77a6c85c13e2179dc926b6882020ffd3 Mon Sep 17 00:00:00 2001 From: nehafish Date: Mon, 23 Sep 2013 20:06:22 -0700 Subject: [PATCH 07/15] add flow create assignment test --- .../tests/casperjs/flow_createAssignment.js | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Dashboard/tests/casperjs/flow_createAssignment.js diff --git a/Dashboard/tests/casperjs/flow_createAssignment.js b/Dashboard/tests/casperjs/flow_createAssignment.js new file mode 100644 index 0000000000..38580a26c9 --- /dev/null +++ b/Dashboard/tests/casperjs/flow_createAssignment.js @@ -0,0 +1,50 @@ +// +// Test - Import Cleaned Survey Data +// neha@akvo.org +// +// 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("akvoqa@gmail.com"); + this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); + this.fill('form#gaia_loginform', { + Email: 'akvoqa@gmail.com', + Passwd: 'R4inDr0p!' + }, true); + }); +}); + + +casper.run(); From 1d716f97905ed50949eaad89a1bf118708c20b1b Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 24 Sep 2013 05:53:09 -0700 Subject: [PATCH 08/15] Add additional flow tests - device ID, get Case --- .../tests/casperjs/flow_createAssignment.js | 79 +++++++++++++++-- .../casperjs/flow_deviceIdentification.js | 87 +++++++++++++++++++ Dashboard/tests/casperjs/flow_sandbox.js | 4 +- Dashboard/tests/casperjs/lib/flow_getCase.js | 70 +++++++++++++++ Dashboard/tests/casperjs/lib/testrailPost.js | 19 ++-- 5 files changed, 245 insertions(+), 14 deletions(-) create mode 100644 Dashboard/tests/casperjs/flow_deviceIdentification.js create mode 100644 Dashboard/tests/casperjs/lib/flow_getCase.js diff --git a/Dashboard/tests/casperjs/flow_createAssignment.js b/Dashboard/tests/casperjs/flow_createAssignment.js index 38580a26c9..d0308d38cb 100644 --- a/Dashboard/tests/casperjs/flow_createAssignment.js +++ b/Dashboard/tests/casperjs/flow_createAssignment.js @@ -19,20 +19,22 @@ 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); -}); + this.echo('remote message caught: ' + msg); + }); casper.on("page.error", function(msg, trace) { -this.echo("Page Error: " + msg, "ERROR"); -}); + this.echo("Page Error: " + msg, "ERROR"); + }); -casper.test.begin('FLOW Test Template', function suite(test) { +casper.test.begin('FLOW Create Device Assignments', function suite(test) { var url = 'http://akvoflowsandbox.appspot.com/admin'; casper.start(url, function() { @@ -44,6 +46,73 @@ casper.test.begin('FLOW Test Template', function suite(test) { 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'); + + + }); + + + + + + }); diff --git a/Dashboard/tests/casperjs/flow_deviceIdentification.js b/Dashboard/tests/casperjs/flow_deviceIdentification.js new file mode 100644 index 0000000000..bdd46507ce --- /dev/null +++ b/Dashboard/tests/casperjs/flow_deviceIdentification.js @@ -0,0 +1,87 @@ +// +// Test - Import Cleaned Survey Data +// neha@akvo.org +// +// 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("akvoqa@gmail.com"); + this.test.assertExists('form#gaia_loginform', 'GAE Login Form is Found'); + this.fill('form#gaia_loginform', { + Email: 'akvoqa@gmail.com', + 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(); + }); + +}); + diff --git a/Dashboard/tests/casperjs/flow_sandbox.js b/Dashboard/tests/casperjs/flow_sandbox.js index df3c1dcc8f..0bc0713eb2 100644 --- a/Dashboard/tests/casperjs/flow_sandbox.js +++ b/Dashboard/tests/casperjs/flow_sandbox.js @@ -103,4 +103,6 @@ casper.then(function() { }); -casper.run(); +casper.run(function() { + this.test.done(); + }); diff --git a/Dashboard/tests/casperjs/lib/flow_getCase.js b/Dashboard/tests/casperjs/lib/flow_getCase.js new file mode 100644 index 0000000000..2c79c7b27f --- /dev/null +++ b/Dashboard/tests/casperjs/lib/flow_getCase.js @@ -0,0 +1,70 @@ +var casper = require('casper').create({ + verbose: true, + logLevel: 'debug', + pageSettings: { + userName:'devops@akvo.org', + password:'R4inDr0p!', + loadImages: true, + loadPlugins: true + } +}); + +var colorizer = require('colorizer').create('Colorizer'); + + +casper.on('resource.requested', function(request) { + this.echo(colorizer.colorize("SENDING REQUEST #" + request.id + " TO " + request.url, "PARAMETER")); + this.echo(JSON.stringify(request, null, 4)); +}); + + + +casper.on('resource.received', function(resource) { + this.echo(JSON.stringify(resource, null, 4)); +}); + + +// casper.setHttpAuth('devops','pass'); + +// encoded_userName=encodeURIComponent('devops@akvo.org'); +// console.log(encoded_userName); + +// var url = "https://devops@akvo.org:R4inDr0p!@akvo.testrail.com/index.php?/api/v2/get_case/1"; + +// var url = "https://"+encoded_userName+":R4inDr0p!@akvo.testrail.com/index.php?/api/v2/get_case/1"; + +var url = "https://akvo.testrail.com/index.php?/api/v2/get_case/1"; + +console.log(url); + +var echoCurrentPage = function() { + this.echo(colorizer.colorize("[Current Page]", "INFO") + this.getTitle() + " : " + this.getCurrentUrl()); + }; + +var headers = { + method: 'get', + headers: { 'content-type': 'application/json'} +}; + +// }).then(function(response) { +// echoCurrentPage.call(this); +// this.debugPage(); +// }); + + + +// casper.open(url, headers).then(function(response) { +// echoCurrentPage.call(this); +// this.debugPage(); +// }); + +casper.start(); +// casper.setHttpAuth('devops@akvo.org','R4inDr0p!'); + +casper.thenOpen(url, headers).then(function(response) { + echoCurrentPage.call(this); + this.debugPage(); +}); + + +casper.run(); diff --git a/Dashboard/tests/casperjs/lib/testrailPost.js b/Dashboard/tests/casperjs/lib/testrailPost.js index f7dfd36d14..8158435c7f 100644 --- a/Dashboard/tests/casperjs/lib/testrailPost.js +++ b/Dashboard/tests/casperjs/lib/testrailPost.js @@ -6,15 +6,17 @@ // -exports.postResultsTR = function(){ +// exports.postResultsTR = function(){ - var rawResults = require('utils').dump(casper.test.suiteResults.getAllPasses()); - var url = 'https://akvo.testrail.com'; +require('utils').dump(casper.test.suiteResults.getAllPasses()); +// this.echo(typeof rawResults); +casper.test.done(); + // var url = 'https://akvo.testrail.com'; - testResultsObj = JSON.parse(rawResults); + // testResultsObj = JSON.parse(rawResults); - postParams = { - foo: "case_id", + /* postParams = { + foo: "case_id", bar: testResultsObj }; @@ -24,6 +26,7 @@ exports.postResultsTR = function(){ data: postParams }) }); + */ - casper.test.done(); -}; +// casper.test.done(); +// }; From 399bc1eeb014b68d97e2f5ec65c696256a61ab2b Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 24 Sep 2013 06:11:12 -0700 Subject: [PATCH 09/15] add casper flow control diagram for docs --- .../casperjs/screenshots/evaluate-diagram.png | Bin 0 -> 7644 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Dashboard/tests/casperjs/screenshots/evaluate-diagram.png diff --git a/Dashboard/tests/casperjs/screenshots/evaluate-diagram.png b/Dashboard/tests/casperjs/screenshots/evaluate-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..aad59ea5cb41908f2e2e1dda028d7a07dddeba36 GIT binary patch literal 7644 zcmZvB2|Sct`~M7OjVZEZxzVU(4I!C9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914fcb27d7397 Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 24 Sep 2013 06:14:09 -0700 Subject: [PATCH 10/15] Update Readme.md --- Dashboard/tests/casperjs/Readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dashboard/tests/casperjs/Readme.md b/Dashboard/tests/casperjs/Readme.md index 30c80805b9..9f5f4d8414 100644 --- a/Dashboard/tests/casperjs/Readme.md +++ b/Dashboard/tests/casperjs/Readme.md @@ -3,3 +3,7 @@ CasperJS Testing Scripts for FLOW Dashboard To run: bash$ casperjs scriptName.js + +![alt tag](https://raw.github.com/nehafish/akvo-flow/develop/Dashboard/tests/casperjs/evaluate-diagram.png) + + From 64de81eb3d58b16fb059867d5cf5c5ae0fdb5d56 Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 24 Sep 2013 06:16:29 -0700 Subject: [PATCH 11/15] Update Readme.md --- Dashboard/tests/casperjs/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dashboard/tests/casperjs/Readme.md b/Dashboard/tests/casperjs/Readme.md index 9f5f4d8414..619c271198 100644 --- a/Dashboard/tests/casperjs/Readme.md +++ b/Dashboard/tests/casperjs/Readme.md @@ -4,6 +4,6 @@ To run: bash$ casperjs scriptName.js -![alt tag](https://raw.github.com/nehafish/akvo-flow/develop/Dashboard/tests/casperjs/evaluate-diagram.png) +![alt tag](https://raw.github.com/nehafish/akvo-flow/develop/Dashboard/tests/casperjs/screenshots/evaluate-diagram.png) From 1426d1ec7ea53215bb47489bf2469b525a1c683b Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 24 Sep 2013 06:18:06 -0700 Subject: [PATCH 12/15] Update Readme.md --- Dashboard/tests/casperjs/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dashboard/tests/casperjs/Readme.md b/Dashboard/tests/casperjs/Readme.md index 619c271198..aba3962725 100644 --- a/Dashboard/tests/casperjs/Readme.md +++ b/Dashboard/tests/casperjs/Readme.md @@ -4,6 +4,6 @@ To run: bash$ casperjs scriptName.js -![alt tag](https://raw.github.com/nehafish/akvo-flow/develop/Dashboard/tests/casperjs/screenshots/evaluate-diagram.png) +![alt tag](https://raw.github.com/nehafish/akvo/akvo-flow/develop/Dashboard/tests/casperjs/screenshots/evaluate-diagram.png) From 959cb67a13cda4694d28dc687049cc8791acf8cd Mon Sep 17 00:00:00 2001 From: nehafish Date: Tue, 24 Sep 2013 06:20:30 -0700 Subject: [PATCH 13/15] Update Readme.md --- Dashboard/tests/casperjs/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dashboard/tests/casperjs/Readme.md b/Dashboard/tests/casperjs/Readme.md index aba3962725..26a170b370 100644 --- a/Dashboard/tests/casperjs/Readme.md +++ b/Dashboard/tests/casperjs/Readme.md @@ -4,6 +4,6 @@ To run: bash$ casperjs scriptName.js -![alt tag](https://raw.github.com/nehafish/akvo/akvo-flow/develop/Dashboard/tests/casperjs/screenshots/evaluate-diagram.png) +![alt tag](http://docs.casperjs.org/en/latest/_images/evaluate-diagram.png) From 5403966003208ba46291ecd7aebda6cc573f2604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Perdomo?= Date: Mon, 30 Sep 2013 13:12:24 +0200 Subject: [PATCH 14/15] Fix issue #371 - Skip requests from empty cells --- .../gwt/server/surveyinstance/SurveyInstanceServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GAE/src/org/waterforpeople/mapping/app/gwt/server/surveyinstance/SurveyInstanceServiceImpl.java b/GAE/src/org/waterforpeople/mapping/app/gwt/server/surveyinstance/SurveyInstanceServiceImpl.java index 7e80b3b43b..1fa6868762 100644 --- a/GAE/src/org/waterforpeople/mapping/app/gwt/server/surveyinstance/SurveyInstanceServiceImpl.java +++ b/GAE/src/org/waterforpeople/mapping/app/gwt/server/surveyinstance/SurveyInstanceServiceImpl.java @@ -166,6 +166,9 @@ public List updateQuestions( boolean processSummaries) { List domainList = new ArrayList(); for (QuestionAnswerStoreDto dto : dtoList) { + if ("".equals(dto.getValue()) && dto.getOldValue() == null) { + continue; // empty string as value, skipping it + } QuestionAnswerStore answer = new QuestionAnswerStore(); DtoMarshaller.copyToCanonical(answer, dto); if (answer.getValue() != null) { From d67ec14c71b50a0d786a9c98fa589ca17d3569ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Perdomo?= Date: Mon, 30 Sep 2013 16:06:18 +0200 Subject: [PATCH 15/15] Fix issue #369 - Use the 12th column as UUID * The 12th column in data.txt holds the uuid of the SurveyInstance When we introduced a new column 13th (duration) that formula, length - 1 got invalidated --- GAE/src/org/waterforpeople/mapping/dao/SurveyInstanceDAO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GAE/src/org/waterforpeople/mapping/dao/SurveyInstanceDAO.java b/GAE/src/org/waterforpeople/mapping/dao/SurveyInstanceDAO.java index b5986e9737..dbc85fa210 100644 --- a/GAE/src/org/waterforpeople/mapping/dao/SurveyInstanceDAO.java +++ b/GAE/src/org/waterforpeople/mapping/dao/SurveyInstanceDAO.java @@ -173,7 +173,7 @@ public SurveyInstance save(Date collectionDate, DeviceFiles deviceFile, } si.setSurveyId(Long.parseLong(parts[0].trim())); if (parts.length >= 12) { - String uuid = parts[parts.length - 1]; + String uuid = parts[11]; if (uuid != null && uuid.trim().length() > 0) { SurveyInstance existingSi = findByUUID(uuid); if (existingSi != null) {