[IMP] PhantomJS UI tests code cleanup
bzr revid: ddm@openerp.com-20131223144100-h8eui7szdj40e2mo
This commit is contained in:
parent
fbea33821b
commit
dbe5c06d95
|
@ -287,9 +287,6 @@
|
|||
tour.start();
|
||||
}
|
||||
});
|
||||
if (document.dispatchEvent) {
|
||||
document.dispatchEvent(new Event('ui-tests:ready', { bubbles: true, cancelable: false }));
|
||||
}
|
||||
return this._super();
|
||||
},
|
||||
registerTour: function (tour) {
|
||||
|
|
|
@ -43,7 +43,7 @@ class WebsiteUiTest(unittest.TestCase):
|
|||
|
||||
class WebsiteUiSuite(unittest.TestSuite):
|
||||
# timeout is in seconds
|
||||
def __init__(self, testfile, timeout=20):
|
||||
def __init__(self, testfile, timeout=10):
|
||||
self.testfile = testfile
|
||||
self.timeout = timeout
|
||||
self._test = None
|
||||
|
|
|
@ -8,16 +8,15 @@ page.onError = function(message, trace) {
|
|||
};
|
||||
|
||||
function waitFor(ready, timeout) {
|
||||
var maxtimeOutMillis = timeout ? timeout*1000 : 10000;
|
||||
var timeOutMillis = timeout ? timeout*1000 : 10000;
|
||||
var start = new Date().getTime();
|
||||
var condition = ready();
|
||||
var interval = setInterval(function() {
|
||||
if ((new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
|
||||
alert("TOTO")
|
||||
if ((new Date().getTime() - start < timeOutMillis) && !condition ) {
|
||||
condition = ready();
|
||||
} else {
|
||||
if(!condition) {
|
||||
console.log('{ "event": "error", "message": "Timeout after'+maxtimeOutMillis+' ms" }');
|
||||
console.log('{ "event": "error", "message": "Timeout after'+timeOutMillis+' ms" }');
|
||||
phantom.exit(1);
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
|
@ -27,6 +26,7 @@ function waitFor(ready, timeout) {
|
|||
}, 100);
|
||||
};
|
||||
|
||||
page.viewportSize = { width: 1920, height: 1080 };
|
||||
page.open(url, function (status) {
|
||||
if (status !== 'success') {
|
||||
console.log('{ "event": "failure", "message": "'+url+' failed to load"}');
|
||||
|
@ -34,7 +34,7 @@ page.open(url, function (status) {
|
|||
} else {
|
||||
waitFor(function () {
|
||||
return page.evaluate(function () {
|
||||
return window.openerp && window.openerp.website && window.openerp.website.editor;
|
||||
return window.openerp && window.openerp.website && window.openerp.website.TestConsole;
|
||||
});
|
||||
}, options.timeout);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue