This commit is contained in:
ddm
2013-12-23 17:57:08 +01:00
parent 2648d55033
commit 7c695446b8
3 changed files with 4 additions and 14 deletions
+1 -1
View File
@@ -140,4 +140,4 @@ class WebsiteUiSuite(unittest.TestSuite):
def load_tests(loader, base, _):
base.addTest(WebsiteUiSuite('dummy_test.js', {}))
base.addTest(WebsiteUiSuite('banner_tour_test.js', { 'path': '/web#action=website.action_website_homepage&login=admin&password=admin' }))
return base
return base
@@ -1,8 +1,7 @@
var testTemplate = require('./ui_test_template.js');
var waitFor = testTemplate.waitFor;
function test (page) {
testTemplate.runTest(function testBannerTour (page) {
var waitFor = testTemplate.waitFor;
page.evaluate(function () {
localStorage.clear();
});
@@ -28,6 +27,4 @@ function test (page) {
phantom.exit();
});
});
}
testTemplate.runTest(test);
});
@@ -1,5 +1,3 @@
function waitFor(ready, callback, timeout) {
var timeoutMillis = timeout ? Math.round(timeout*1000) : 30000;
var start = new Date().getTime();
@@ -19,22 +17,17 @@ function waitFor(ready, callback, timeout) {
}, 100);
};
function runTest (test) {
var options = JSON.parse(phantom.args);
var port = options.port ? ':'+options.port : '';
var path = options.path ? options.path : '';
var url = 'http://localhost'+port+path;
var page = require('webpage').create();
page.viewportSize = { width: 1920, height: 1080 };
page.onError = function(message, trace) {
console.log('{ "event": "error", "message": "'+message+'"}');
phantom.exit(1);
};
page.open(url, function (status) {
if (status !== 'success') {
console.log('{ "event": "failure", "message": "'+url+' failed to load"}');