[fix] website: test tour

bzr revid: chm@openerp.com-20140130215717-h211wj65wl20zfru
This commit is contained in:
Christophe Matthieu
2014-01-30 22:57:17 +01:00
parent f1204ee9c3
commit 5e10f80cd4
6 changed files with 9 additions and 63 deletions
+2 -19
View File
@@ -11,25 +11,8 @@ testRunner.run(function homepageTest (page, timeout) {
&& window.openerp.website.Tour.get('banner');
});
}, function executeTest () {
var before = page.evaluate(function () {
var result = {
carousel: $('#wrap [data-snippet-id=carousel]').length,
columns: $('#wrap [data-snippet-id=three-columns]').length,
};
window.openerp.website.Tour.get('banner').run(true, true);
return result;
page.evaluate(function () {
window.openerp.website.TestConsole.get('banner').run(true, true);
});
waitFor(function testExecuted () {
var after = page.evaluate(function () {
return window.$ && $('button[data-action=edit]').is(":visible") && {
carousel: $('#wrap [data-snippet-id=carousel]').length,
columns: $('#wrap [data-snippet-id=three-columns]').length,
};
});
return after && (after.carousel === before.carousel + 1) && (after.columns === before.columns + 1);
}, function finish () {
console.log('{ "event": "success" }');
phantom.exit();
}, 4*timeout/5);
}, timeout/5);
});
@@ -12,20 +12,7 @@ testRunner.run(function blogTest (page, timeout) {
});
}, function executeTest () {
page.evaluate(function () {
window.openerp.website.Tour.test('blog').run(true, true);
window.openerp.website.TestConsole.get('blog').run(true, true);
});
waitFor(function testExecuted () {
var after = page.evaluate(function () {
return window.$ && $('button[data-action=edit]').is(":visible") && {
image: $('#wrap [data-snippet-id=image-text]').length,
text: $('#wrap [data-snippet-id=text-block]').length,
};
});
var result = after && (after.image === 1) && (after.text === 1);
return result;
}, function finish () {
console.log('{ "event": "success" }');
phantom.exit();
}, 4*timeout/5);
}, timeout/5);
});
@@ -12,21 +12,7 @@ testRunner.run(function eventTest (page, timeout) {
});
}, function executeTest () {
page.evaluate(function () {
window.openerp.website.Tour.get('event').run(true, true)
window.openerp.website.TestConsole.get('event').run(true, true);
});
waitFor(function testExecuted () {
var after = page.evaluate(function () {
return window.$ && $('button[data-action=edit]').is(":visible") && {
banner: $('#wrap [data-snippet-id=image-text]').length,
text: $('#wrap [data-snippet-id=text-block]').length,
image: $('#wrap [data-snippet-id=three-columns]').length,
};
});
var result = after && (after.banner === 1) && (after.text === 1) && (after.image === 1);
return result;
}, function finish () {
console.log('{ "event": "success" }');
phantom.exit();
}, 4*timeout/5);
}, timeout/5);
});
+3 -3
View File
@@ -1,8 +1,8 @@
import openerp.addons.website.tests.test_ui as test_ui
def load_tests(loader, base, _):
base.addTest(test_ui.WebsiteUiSuite(test_ui.full_path(__file__,'website_sale-sale_process-test.js'),
{ 'action': 'website.action_website_homepage' }, 120.0))
# base.addTest(test_ui.WebsiteUiSuite(test_ui.full_path(__file__,'website_sale-sale_process-test-2.js'),
# base.addTest(test_ui.WebsiteUiSuite(test_ui.full_path(__file__,'website_sale-sale_process-test.js'),
# { 'action': 'website.action_website_homepage' }, 120.0))
base.addTest(test_ui.WebsiteUiSuite(test_ui.full_path(__file__,'website_sale-sale_process-test-2.js'),
{ 'action': 'website.action_website_homepage' }, 120.0))
return base
@@ -12,17 +12,7 @@ testRunner.run(function websiteSaleTest (page, timeout) {
});
}, function executeTest () {
page.evaluate(function () {
window.openerp.website.Tour.get('shop').run(true, true);
window.openerp.website.TestConsole.get('shop').run(true, true);
});
waitFor(function testExecuted () {
var after = page.evaluate(function () {
return window.$ && $('button[data-action=edit]').is(":visible") &&
$('data-snippet-id="big-picture"').length;
});
return after;
}, function finish () {
console.log('{ "event": "success" }');
phantom.exit();
}, 4*timeout/5);
}, timeout/5);
});
@@ -12,7 +12,7 @@ testRunner.run(function websiteSaleTest (page, timeout) {
});
}, function executeTest () {
page.evaluate(function () {
window.openerp.website.TestConsole.test('shop_buy_product').run(true, true);
window.openerp.website.TestConsole.get('shop_buy_product').run(true, true);
});
}, timeout);
});