[IMP] Banner tour automated test
bzr revid: ddm@openerp.com-20131223152503-saqpy0d8vgvg9p20
This commit is contained in:
parent
65f48d0ce7
commit
39c5b09e6e
|
@ -75,6 +75,11 @@
|
|||
<field name="url">/?tutorial.banner=true</field>
|
||||
<field name="target">self</field>
|
||||
</record>
|
||||
<record id="action_website_homepage" model="ir.actions.act_url">
|
||||
<field name="name">Website Homepage</field>
|
||||
<field name="url">/page/website.homepage</field>
|
||||
<field name="target">self</field>
|
||||
</record>
|
||||
|
||||
<record id="menu_website" model="ir.ui.menu">
|
||||
<field name="name">Website</field>
|
||||
|
|
|
@ -43,7 +43,7 @@ class WebsiteUiTest(unittest.TestCase):
|
|||
|
||||
class WebsiteUiSuite(unittest.TestSuite):
|
||||
# timeout is in seconds
|
||||
def __init__(self, testfile, timeout=10.0):
|
||||
def __init__(self, testfile, timeout=60.0):
|
||||
self.testfile = testfile
|
||||
self.timeout = timeout
|
||||
self._test = None
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var options = JSON.parse(phantom.args);
|
||||
var url = 'http://localhost:'+options.port+'/web#action=website.action_website&login=admin&password=admin';
|
||||
var url = 'http://localhost:'+options.port+'/web#action=website.action_website_homepage&login=admin&password=admin';
|
||||
|
||||
var page = require('webpage').create();
|
||||
|
||||
|
@ -9,7 +9,7 @@ page.onError = function(message, trace) {
|
|||
};
|
||||
|
||||
function waitFor(ready, callback, timeout) {
|
||||
var timeoutMillis = timeout ? Math.round(timeout*1000) : 10000;
|
||||
var timeoutMillis = timeout ? Math.round(timeout*1000) : 30000;
|
||||
var start = new Date().getTime();
|
||||
var condition = ready();
|
||||
var interval = setInterval(function() {
|
||||
|
@ -17,7 +17,7 @@ function waitFor(ready, callback, timeout) {
|
|||
condition = ready();
|
||||
} else {
|
||||
if(!condition) {
|
||||
console.log('{ "event": "error", "message": "Timeout after'+timeoutMillis+' ms" }');
|
||||
console.log('{ "event": "error", "message": "Timeout after '+timeoutMillis+' ms" }');
|
||||
phantom.exit(1);
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
|
@ -33,13 +33,30 @@ page.open(url, function (status) {
|
|||
console.log('{ "event": "failure", "message": "'+url+' failed to load"}');
|
||||
phantom.exit(1);
|
||||
} else {
|
||||
page.evaluate(function () {
|
||||
localStorage.clear();
|
||||
});
|
||||
waitFor(function () {
|
||||
return page.evaluate(function () {
|
||||
return window.openerp && window.openerp.website && window.openerp.website.TestConsole;
|
||||
return window.openerp && window.openerp.website && window.openerp.website.TestConsole && window.openerp.website.TestConsole.test('banner');
|
||||
});
|
||||
}, function () {
|
||||
console.log('{ "event": "success" }');
|
||||
phantom.exit();
|
||||
}, options.timeout);
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.test('banner').run(true);
|
||||
});
|
||||
waitFor(function () {
|
||||
return page.evaluate(function () {
|
||||
var $edit = $('button[data-action=edit]');
|
||||
var $carousel = $('#wrap [data-snippet-id=carousel]');
|
||||
var $columns = $('#wrap [data-snippet-id=three-columns]');
|
||||
return $carousel && $carousel.length === 1
|
||||
&& $columns && $columns.length === 1
|
||||
&& $('button[data-action=edit]').is(":visible");
|
||||
});
|
||||
}, function () {
|
||||
console.log('{ "event": "success" }');
|
||||
phantom.exit();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue