[FIX] website tour test + add test for shop
bzr revid: chm@openerp.com-20140130224453-e0drwj4m54vymahz
This commit is contained in:
parent
4aa8eadf5f
commit
ed45f41f9b
|
@ -169,6 +169,7 @@ website.Tour = openerp.Class.extend({
|
|||
$('.popover.tour').remove();
|
||||
},
|
||||
trigger: function (automatic) {
|
||||
this.reset();
|
||||
if (this.path) {
|
||||
this.localStorage.setItem("tour-"+this.id+"-test", 0);
|
||||
if (automatic) this.localStorage.setItem("tour-"+this.id+"-test-automatic", true);
|
||||
|
@ -206,7 +207,7 @@ website.Tour = openerp.Class.extend({
|
|||
|
||||
}
|
||||
|
||||
if ($(this.steps[index-1].template).has("button[data-role='next']")) {
|
||||
if ($(this.steps[index-1].template).has("button[data-role='next']").size()) {
|
||||
var step = {
|
||||
stepId: index,
|
||||
waitNot: '.popover.tour:visible'
|
||||
|
@ -428,6 +429,9 @@ website.Tour.waitReady = function (callback) {
|
|||
}
|
||||
});
|
||||
};
|
||||
website.Tour.runTest = function (id) {
|
||||
website.Tour.get(id).trigger(true);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,11 @@ testRunner.run(function homepageTest (page, timeout) {
|
|||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.Tour
|
||||
&& window.openerp.website.Tour.get('banner');
|
||||
&& window.openerp.website.Tour;
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.get('banner').run(true, true);
|
||||
window.openerp.website.Tour.run_test('banner');
|
||||
});
|
||||
}, timeout/5);
|
||||
});
|
||||
|
|
|
@ -7,12 +7,11 @@ testRunner.run(function blogTest (page, timeout) {
|
|||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.Tour
|
||||
&& window.openerp.website.Tour.get('blog');
|
||||
&& window.openerp.website.Tour;
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.get('blog').run(true, true);
|
||||
window.openerp.website.Tour.run_test('blog');
|
||||
});
|
||||
}, timeout/5);
|
||||
});
|
|
@ -7,12 +7,11 @@ testRunner.run(function eventTest (page, timeout) {
|
|||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.Tour
|
||||
&& window.openerp.website.Tour.get('event');
|
||||
&& window.openerp.website.Tour;
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.get('event').run(true, true);
|
||||
window.openerp.website.Tour.run_test('event');
|
||||
});
|
||||
}, timeout/5);
|
||||
});
|
||||
|
|
|
@ -141,106 +141,99 @@
|
|||
}
|
||||
});
|
||||
|
||||
// website.EditorShopTest = website.Tour.extend({
|
||||
// id: 'shop_buy_product',
|
||||
// name: "Try to buy products",
|
||||
// path: '/shop',
|
||||
// init: function (editor) {
|
||||
// var self = this;
|
||||
// self.steps = [
|
||||
// {
|
||||
// title: 'begin-test',
|
||||
// template: self.popover({ next: "Start Test"}),
|
||||
// backdrop: true,
|
||||
// },
|
||||
// {
|
||||
// element: '.oe_product_cart a:contains("iPod")',
|
||||
// trigger: {
|
||||
// url: /shop\/product\/.*/,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// element: 'input[name="product_id"]:not([checked])',
|
||||
// trigger: 'mouseup',
|
||||
// },
|
||||
// {
|
||||
// element: 'form[action="/shop/add_cart/"] button',
|
||||
// trigger: {
|
||||
// url: '/shop/mycart/',
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// element: 'form[action="/shop/add_cart/"] button:contains("Add to Cart")',
|
||||
// trigger: 'reload',
|
||||
// },
|
||||
// {
|
||||
// element: '.oe_mycart a.js_add_cart_json:eq(1)',
|
||||
// trigger: 'ajax',
|
||||
// },
|
||||
// {
|
||||
// element: '.oe_mycart a.js_add_cart_json:eq(2)',
|
||||
// trigger: 'reload',
|
||||
// },
|
||||
// {
|
||||
// element: '.oe_mycart input.js_quantity',
|
||||
// sampleText: '1',
|
||||
// trigger: 'reload',
|
||||
// },
|
||||
// {
|
||||
// element: 'a[href="/shop/checkout/"]',
|
||||
// trigger: {
|
||||
// url: '/shop/checkout/',
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// element: 'form[action="/shop/confirm_order/"] button',
|
||||
// trigger: {
|
||||
// url: '/shop/confirm_order/',
|
||||
// },
|
||||
// beforeTrigger: function (tour) {
|
||||
// $("input[name='phone']").val("");
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// element: 'form[action="/shop/confirm_order/"] button',
|
||||
// trigger: {
|
||||
// url: '/shop/payment/',
|
||||
// },
|
||||
// beforeTrigger: function (tour) {
|
||||
// if ($("input[name='name']").val() === "")
|
||||
// $("input[name='name']").val("website_sale-test-shoptest");
|
||||
// if ($("input[name='email']").val() === "")
|
||||
// $("input[name='email']").val("website_sale-test-shoptest@website_sale-test-shoptest.optenerp.com");
|
||||
// $("input[name='phone']").val("123");
|
||||
// $("input[name='street']").val("123");
|
||||
// $("input[name='city']").val("123");
|
||||
// $("input[name='zip']").val("123");
|
||||
// $("select[name='country_id']").val("21");
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// element: 'input[name="acquirer"]',
|
||||
// trigger: 'mouseup',
|
||||
// },
|
||||
// {
|
||||
// element: 'button:contains("Pay Now")',
|
||||
// trigger: {
|
||||
// url: /shop\/confirmation\//,
|
||||
// },
|
||||
// afterTrigger: function (tour) {
|
||||
// console.log('{ "event": "success" }');
|
||||
// },
|
||||
// }
|
||||
// ];
|
||||
// return this._super();
|
||||
// },
|
||||
// trigger: function () {
|
||||
// return (this.resume() && this.testUrl(/\/shop\//)) || this._super();
|
||||
// },
|
||||
// });
|
||||
// // for test without editor bar
|
||||
// $(document).ready(function () {
|
||||
// website.Tour.add(website.EditorShopTest);
|
||||
// });
|
||||
website.EditorShopTest = website.Tour.extend({
|
||||
id: 'shop_buy_product',
|
||||
name: "Try to buy products",
|
||||
path: '/shop',
|
||||
testPath: /\/shop/,
|
||||
init: function (editor) {
|
||||
var self = this;
|
||||
self.steps = [
|
||||
{
|
||||
title: 'begin-test',
|
||||
template: self.popover({ next: "Start Test"}),
|
||||
backdrop: true,
|
||||
},
|
||||
{
|
||||
title: "select ipod",
|
||||
element: '.oe_product_cart a:contains("iPod")',
|
||||
},
|
||||
{
|
||||
title: "select ipod 32Go",
|
||||
element: 'input[name="product_id"]:not([checked])',
|
||||
},
|
||||
{
|
||||
title: "click on add to cart",
|
||||
waitFor: 'input[name="product_id"]:eq(1)[checked]',
|
||||
element: 'form[action="/shop/add_cart/"] button',
|
||||
},
|
||||
{
|
||||
title: "add suggested",
|
||||
element: 'form[action="/shop/add_cart/"] button.btn-link:contains("Add to Cart")',
|
||||
},
|
||||
{
|
||||
title: "add one more iPod",
|
||||
waitFor: '.my_cart_quantity:contains(2)',
|
||||
element: '#mycart_products tr:contains("iPod: 32 Gb") a.js_add_cart_json:eq(1)',
|
||||
},
|
||||
{
|
||||
title: "remove Headphones",
|
||||
waitFor: '#mycart_products tr:contains("iPod: 32 Gb") input.js_quantity[value=2]',
|
||||
element: '#mycart_products tr:contains("Apple In-Ear Headphones") a.js_add_cart_json:first',
|
||||
},
|
||||
{
|
||||
title: "set one iPod",
|
||||
waitNot: '#mycart_products tr:contains("Apple In-Ear Headphones")',
|
||||
element: '#mycart_products input.js_quantity',
|
||||
sampleText: '1',
|
||||
},
|
||||
{
|
||||
title: "go to checkout",
|
||||
waitFor: '#mycart_products input.js_quantity[value=1]',
|
||||
element: 'a[href="/shop/checkout/"]',
|
||||
},
|
||||
{
|
||||
title: "test with input error",
|
||||
element: 'form[action="/shop/confirm_order/"] button',
|
||||
callback: function (tour) {
|
||||
$("input[name='phone']").val("");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "test without input error",
|
||||
waitFor: 'form[action="/shop/confirm_order/"] .has-error',
|
||||
element: 'form[action="/shop/confirm_order/"] button',
|
||||
callback: function (tour) {
|
||||
if ($("input[name='name']").val() === "")
|
||||
$("input[name='name']").val("website_sale-test-shoptest");
|
||||
if ($("input[name='email']").val() === "")
|
||||
$("input[name='email']").val("website_sale-test-shoptest@website_sale-test-shoptest.optenerp.com");
|
||||
$("input[name='phone']").val("123");
|
||||
$("input[name='street']").val("123");
|
||||
$("input[name='city']").val("123");
|
||||
$("input[name='zip']").val("123");
|
||||
$("select[name='country_id']").val("21");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "select acquirer",
|
||||
element: 'input[name="acquirer"]',
|
||||
},
|
||||
{
|
||||
title: "confirm",
|
||||
element: 'button:contains("Pay Now")',
|
||||
},
|
||||
{
|
||||
title: "finish",
|
||||
waitFor: '.oe_website_sale:contains("Thank you for your order")',
|
||||
}
|
||||
];
|
||||
return this._super();
|
||||
},
|
||||
});
|
||||
// for test without editor bar
|
||||
$(document).ready(function () {
|
||||
website.Tour.add(website.EditorShopTest);
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
|
@ -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.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
|
|
@ -7,12 +7,11 @@ testRunner.run(function websiteSaleTest (page, timeout) {
|
|||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.Tour
|
||||
&& window.openerp.website.Tour.get('shop');
|
||||
&& window.openerp.website.Tour;
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.get('shop').run(true, true);
|
||||
window.openerp.website.Tour.run_test('shop');
|
||||
});
|
||||
}, timeout/5);
|
||||
});
|
||||
|
|
|
@ -7,12 +7,11 @@ testRunner.run(function websiteSaleTest (page, timeout) {
|
|||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.Tour
|
||||
&& window.openerp.website.Tour.get('shop_buy_product');
|
||||
&& window.openerp.website.Tour;
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.get('shop_buy_product').run(true, true);
|
||||
window.openerp.website.Tour.run_test('shop_buy_product');
|
||||
});
|
||||
}, timeout);
|
||||
});
|
Loading…
Reference in New Issue