[FIX] website_sale: activate test tour

bzr revid: chm@openerp.com-20140129175038-663iuxiv0os6f9xt
This commit is contained in:
Christophe Matthieu 2014-01-29 18:50:38 +01:00
parent 255fe082bd
commit 55fdaf0dd0
5 changed files with 35 additions and 6 deletions

View File

@ -215,8 +215,8 @@
website.EditorShopTest = website.Test.extend({
id: 'shoptest',
name: "Try to by products",
id: 'shop_buy_product',
name: "Try to buy products",
path: '/shop',
init: function (editor) {
var self = this;

View File

@ -1,2 +1 @@
#TODO : fix test runing
#import test_ui
import test_ui

View File

@ -3,4 +3,6 @@ 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'),
{ 'action': 'website.action_website_homepage' }, 120.0))
return base

View File

@ -0,0 +1,28 @@
var testRunner = require('../../../website/tests/ui_suite/ui_test_runner.js');
var waitFor = testRunner.waitFor;
testRunner.run(function websiteSaleTest (page, timeout) {
page.evaluate(function () { localStorage.clear(); });
waitFor(function clientReady () {
return page.evaluate(function () {
return window.$ && window.openerp && window.openerp.website
&& window.openerp.website.TestConsole
&& window.openerp.website.TestConsole.test('shop');
});
}, function executeTest () {
page.evaluate(function () {
window.openerp.website.TestConsole.test('shop').run(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);
});

View File

@ -8,11 +8,11 @@ testRunner.run(function websiteSaleTest (page, timeout) {
return page.evaluate(function () {
return window.$ && window.openerp && window.openerp.website
&& window.openerp.website.TestConsole
&& window.openerp.website.TestConsole.test('shoptest');
&& window.openerp.website.TestConsole.test('shop_buy_product');
});
}, function executeTest () {
page.evaluate(function () {
window.openerp.website.TestConsole.test('shoptest').run(true);
window.openerp.website.TestConsole.test('shop_buy_product').run(true);
});
}, timeout);
});