[MERGE] Merge parents

bzr revid: rim@openerp.com-20131230141601-vtgy638bq4d3540v
This commit is contained in:
Richard Mathot (OpenERP)
2013-12-30 15:16:01 +01:00
3 changed files with 31 additions and 15 deletions
+3 -2
View File
@@ -81,7 +81,8 @@ class WebsiteUiSuite(unittest.TestSuite):
self._options['db'] = tools.config.get('db_name', '')
# TODO Use correct key
self._options['user'] = 'admin'
self._options['password'] = tools.config.get('admin_passwd', 'admin')
self._options['admin_password'] = tools.config.get('admin_passwd', 'admin')
self._options['db_password'] = tools.config.get('db_password', 'admin')
phantom = subprocess.Popen([
'phantomjs',
@@ -139,6 +140,6 @@ class WebsiteUiSuite(unittest.TestSuite):
def load_tests(loader, base, _):
base.addTest(WebsiteUiSuite('dummy_test.js', {}))
base.addTest(WebsiteUiSuite('simple_dom_test.js', { 'action': 'website.action_website_homepage' }))
base.addTest(WebsiteUiSuite('simple_dom_test.js', { 'action': 'website.action_website_homepage' }))
base.addTest(WebsiteUiSuite('banner_tour_test.js', { 'action': 'website.action_website_homepage' }))
return base
@@ -3,13 +3,22 @@ var testRunner = require('./ui_test_runner.js');
var waitFor = testRunner.waitFor;
testRunner.run(function simpleDomTest (page) {
waitFor(function () {
waitFor(function openerpFrameworkReady () {
return page.evaluate(function () {
return window.openerp && window.openerp.website
&& window.openerp.website.TestConsole;
return window.openerp && window.openerp.website;
});
}, function () {
}, function success () {
console.log('{ "event": "success" }');
phantom.exit();
}, 20000);
}, 20000, function errorStatus () {
var status = page.evaluate(function () {
return {
href: window.location.href,
jQueryFound: (typeof window.$ === 'function'),
openerpFound: (typeof window.openerp === 'object'),
websiteFound: (typeof window.openerp.website === 'object'),
}
});
return status.href+" - jQuery: "+status.jQueryFound+" - openerp: " +status.openerpFound+ " - website: "+status.websiteFound;
});
});
@@ -1,4 +1,4 @@
function waitFor(ready, callback, timeout) {
function waitFor(ready, callback, timeout, timeoutMessageCallback) {
timeout = timeout || 10000;
var start = new Date().getTime();
var condition = ready();
@@ -7,7 +7,7 @@ function waitFor(ready, callback, timeout) {
condition = ready();
} else {
if(!condition) {
var message = "Timeout after "+timeout+" ms";
var message = timeoutMessageCallback ? timeoutMessageCallback() : "Timeout after "+timeout+" ms";
console.log('{ "event": "error", "message": "'+message+'" }');
console.log("Waiting for...\n"+ready);
phantom.exit(1);
@@ -25,12 +25,18 @@ function run (test) {
var host = options.host ? options.host : 'localhost';
var port = options.port ? ':'+options.port : '';
var path = options.path ? options.path : '/web';
var params = [];
if (options.action) params.push('action='+options.action);
if (options.db) params.push('source='+options.db);
if (options.user) params.push('login='+options.user);
if (options.password) params.push('password='+options.password);
var url = scheme+host+port+path+'#'+params.join('&');
var queryParams = [];
if (options.db) queryParams.push('db='+options.db);
var query = queryParams.length > 0 ? '?'+queryParams.join('&') : '';
var hashParams = [];
if (options.user) hashParams.push('login='+options.user);
if (options.admin_password) hashParams.push('password='+options.admin_password);
if (options.action) hashParams.push('action='+options.action);
var hash = hashParams.length > 0 ? '#'+hashParams.join('&') : '';
var url = scheme+host+port+path+query+hash;
var page = require('webpage').create();
page.viewportSize = { width: 1920, height: 1080 };
page.onError = function(message, trace) {