[FIX] UI tests imps & fixes
bzr revid: ddm@openerp.com-20140106153906-tvibq7wjrgflatd6
This commit is contained in:
@@ -6,14 +6,12 @@ testRunner.run(function homepageTest (page) {
|
||||
page.evaluate(function () { localStorage.clear(); });
|
||||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.openerp && window.openerp.website
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.TestConsole
|
||||
&& window.openerp.website.TestConsole.test
|
||||
&& window.openerp.website.TestConsole.test('banner');
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.onResourceError = function(error) {
|
||||
console.log('{ "event": "error", "message": "'+error.url+' failed to load ('+error.errorString+') "}');
|
||||
};
|
||||
var before = page.evaluate(function () {
|
||||
var result = {
|
||||
carousel: $('#wrap [data-snippet-id=carousel]').length,
|
||||
@@ -24,7 +22,7 @@ testRunner.run(function homepageTest (page) {
|
||||
});
|
||||
waitFor(function testExecuted () {
|
||||
var after = page.evaluate(function () {
|
||||
return $('button[data-action=edit]').is(":visible") && {
|
||||
return window.$ && $('button[data-action=edit]').is(":visible") && {
|
||||
carousel: $('#wrap [data-snippet-id=carousel]').length,
|
||||
columns: $('#wrap [data-snippet-id=three-columns]').length,
|
||||
};
|
||||
@@ -35,4 +33,4 @@ testRunner.run(function homepageTest (page) {
|
||||
phantom.exit();
|
||||
}, 90000);
|
||||
}, 20000);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,19 +51,33 @@ function run (test) {
|
||||
phantom.exit(1);
|
||||
};
|
||||
page.onConsoleMessage = function(message) {
|
||||
console.log(message);
|
||||
phantom.exit(1);
|
||||
// Disabled because of the 'web_hello' addon
|
||||
//console.log(message);
|
||||
//phantom.exit(1);
|
||||
};
|
||||
|
||||
page.open(url, function (status) {
|
||||
if (status !== 'success') {
|
||||
console.log('{ "event": "error", "message": "'+url+' failed to load"}');
|
||||
phantom.exit(1);
|
||||
} else {
|
||||
page.onLoadFinished = function(status) {
|
||||
test(page);
|
||||
};
|
||||
page.onCallback = function(data) {
|
||||
if (data.event && data.event === 'start') {
|
||||
test(page);
|
||||
}
|
||||
};
|
||||
|
||||
var tries = 0;
|
||||
page.open(url, function openPage (status) {
|
||||
if (status !== 'success') {
|
||||
tries++;
|
||||
if (tries < 5) {
|
||||
page.open(url, openPage);
|
||||
} else {
|
||||
console.log('{ "event": "error", "message": "'+url+' failed to load '+tries+' times ('+status+')"}');
|
||||
phantom.exit(1);
|
||||
}
|
||||
} else {
|
||||
page.evaluate(function () {
|
||||
window.callPhantom({ event: 'start' });
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user