[IMP] website_event_sale: convert tours to use web_tour.tour
This commit is contained in:
committed by
qsm-odoo
parent
21e26f6009
commit
3fe48f7f49
@@ -1,95 +1,93 @@
|
||||
odoo.define('website_event_sale.tour', function (require) {
|
||||
'use strict';
|
||||
|
||||
var Tour = require('web.Tour');
|
||||
var base = require('web_editor.base');
|
||||
var website = require('website.website');
|
||||
var tour = require('web_tour.tour');
|
||||
|
||||
base.ready().done(function () {
|
||||
Tour.register({
|
||||
id: 'event_buy_tickets',
|
||||
name: "Buy tickets for the Conference on Business Apps",
|
||||
path: '/event',
|
||||
mode: 'test',
|
||||
steps: [
|
||||
{
|
||||
title: "Go to the `Events` page",
|
||||
element: 'a[href*="/event"]:contains("Conference on Business Apps"):first',
|
||||
tour.register('event_buy_tickets', { test: true, url: '/event' },
|
||||
[
|
||||
{
|
||||
content: "Go to the `Events` page",
|
||||
trigger: 'a[href*="/event"]:contains("Conference on Business Apps"):first',
|
||||
},
|
||||
{
|
||||
content: "Select 1 unit of `Standard` ticket type",
|
||||
extra_trigger: '#wrap:not(:has(a[href*="/event"]:contains("Conference on Business Apps")))',
|
||||
trigger: 'select:eq(0)',
|
||||
run: 'text 1',
|
||||
},
|
||||
{
|
||||
content: "Select 2 units of `VIP` ticket type",
|
||||
extra_trigger: 'select:eq(0):has(option:contains(1):propSelected)',
|
||||
trigger: 'select:eq(1)',
|
||||
run: 'text 2',
|
||||
},
|
||||
{
|
||||
content: "Click on `Order Now` button",
|
||||
extra_trigger: 'select:eq(1):has(option:contains(2):propSelected)',
|
||||
trigger: '.btn-primary:contains("Order Now")',
|
||||
},
|
||||
{
|
||||
content: "Fill attendees details",
|
||||
trigger: 'form[id="attendee_registration"] .btn:contains("Continue")',
|
||||
run: function () {
|
||||
$("input[name='1-name']").val("Att1");
|
||||
$("input[name='1-phone']").val("111 111");
|
||||
$("input[name='1-email']").val("att1@example.com");
|
||||
$("input[name='2-name']").val("Att2");
|
||||
$("input[name='2-phone']").val("222 222");
|
||||
$("input[name='2-email']").val("att2@example.com");
|
||||
$("input[name='3-name']").val("Att3");
|
||||
$("input[name='3-phone']").val("333 333");
|
||||
$("input[name='3-email']").val("att3@example.com");
|
||||
},
|
||||
{
|
||||
title: "Select 1 unit of `Standard` ticket type",
|
||||
waitNot: 'a[href*="/event"]:contains("Conference on Business Apps")',
|
||||
element: 'select:eq(0)',
|
||||
sampleText: '1',
|
||||
},
|
||||
{
|
||||
title: "Select 2 units of `VIP` ticket type",
|
||||
waitFor: 'select:eq(0) option:contains(1):propSelected',
|
||||
element: 'select:eq(1)',
|
||||
sampleText: '2',
|
||||
},
|
||||
{
|
||||
title: "Click on `Order Now` button",
|
||||
waitFor: 'select:eq(1) option:contains(2):propSelected',
|
||||
element: '.btn-primary:contains("Order Now")',
|
||||
},
|
||||
{
|
||||
title: "Fill attendees details",
|
||||
waitFor: 'form[id="attendee_registration"] .btn:contains("Continue")',
|
||||
autoComplete: function (tour) {
|
||||
$("input[name='1-name']").val("Att1");
|
||||
$("input[name='1-phone']").val("111 111");
|
||||
$("input[name='1-email']").val("att1@example.com");
|
||||
$("input[name='2-name']").val("Att2");
|
||||
$("input[name='2-phone']").val("222 222");
|
||||
$("input[name='2-email']").val("att2@example.com");
|
||||
$("input[name='3-name']").val("Att3");
|
||||
$("input[name='3-phone']").val("333 333");
|
||||
$("input[name='3-email']").val("att3@example.com");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Validate attendees details",
|
||||
waitFor: "input[name='1-name'], input[name='2-name'], input[name='3-name']",
|
||||
element: '.modal button:contains("Continue")',
|
||||
},
|
||||
{
|
||||
title: "Check that the cart contains exactly 3 elements",
|
||||
element: 'a:has(.my_cart_quantity:containsExact(3))',
|
||||
},
|
||||
{
|
||||
title: "Modify the cart to add 1 unit of `VIP` ticket type",
|
||||
waitFor: "#cart_products:contains(Standard):contains(VIP)",
|
||||
element: "#cart_products tr:contains(VIP) .fa-plus",
|
||||
},
|
||||
{
|
||||
title: "Now click on `Process Checkout`",
|
||||
waitFor: 'a:has(.my_cart_quantity):contains(4)',
|
||||
element: '.btn-primary:contains("Process Checkout")'
|
||||
},
|
||||
{
|
||||
title: "Complete the checkout",
|
||||
element: 'a[href="/shop/confirm_order"]:contains("Confirm")',
|
||||
},
|
||||
{
|
||||
title: "Check that the subtotal is 5,500.00",
|
||||
element: '#order_total_untaxed .oe_currency_value:contains("5,500.00")',
|
||||
},
|
||||
{
|
||||
title: "Select `Wire Transfer` payment method",
|
||||
element: '#payment_method label:has(img[title="Wire Transfer"]) input',
|
||||
},
|
||||
{
|
||||
title: "Pay",
|
||||
waitFor: '#payment_method label:has(input:checked):has(img[title="Wire Transfer"])',
|
||||
element: '.oe_sale_acquirer_button .btn[type="submit"]:visible',
|
||||
},
|
||||
{
|
||||
title: "Last step",
|
||||
waitFor: '.oe_website_sale:contains("Thank you for your order")',
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
},
|
||||
{
|
||||
content: "Validate attendees details",
|
||||
extra_trigger: "input[name='1-name'], input[name='2-name'], input[name='3-name']",
|
||||
trigger: 'button:contains("Continue")',
|
||||
},
|
||||
{
|
||||
content: "Check that the cart contains exactly 3 triggers",
|
||||
trigger: 'a:has(.my_cart_quantity:containsExact(3))',
|
||||
run: function () {}, // it's a check
|
||||
},
|
||||
{
|
||||
content: "go to cart",
|
||||
trigger: 'a:contains(Return to Cart)',
|
||||
},
|
||||
{
|
||||
content: "Modify the cart to add 1 unit of `VIP` ticket type",
|
||||
extra_trigger: "#cart_products:contains(Standard):contains(VIP)",
|
||||
trigger: "#cart_products tr:contains(VIP) .fa-plus",
|
||||
},
|
||||
{
|
||||
content: "Now click on `Process Checkout`",
|
||||
extra_trigger: 'a:has(.my_cart_quantity):contains(4)',
|
||||
trigger: '.btn-primary:contains("Process Checkout")'
|
||||
},
|
||||
{
|
||||
content: "Complete the checkout",
|
||||
trigger: 'a[href="/shop/confirm_order"]:contains("Confirm")',
|
||||
},
|
||||
{
|
||||
content: "Check that the subtotal is 5,500.00",
|
||||
trigger: '#order_total_untaxed .oe_currency_value:contains("5,500.00")',
|
||||
run: function () {}, // it's a check
|
||||
},
|
||||
{
|
||||
content: "Select `Wire Transfer` payment method",
|
||||
trigger: '#payment_method label:contains(Wire Transfer) input',
|
||||
},
|
||||
{
|
||||
content: "Pay",
|
||||
extra_trigger: '#payment_method label:contains(Wire Transfer) input:checked',
|
||||
trigger: '.oe_sale_acquirer_button .btn[type="submit"]:visible',
|
||||
},
|
||||
{
|
||||
content: "Last step",
|
||||
trigger: '.oe_website_sale:contains("Thank you for your order")',
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import odoo.tests
|
||||
|
||||
|
||||
@odoo.tests.common.at_install(False)
|
||||
@odoo.tests.common.post_install(True)
|
||||
class TestUi(odoo.tests.HttpCase):
|
||||
|
||||
post_install = True
|
||||
at_install = False
|
||||
|
||||
def test_admin(self):
|
||||
self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('event_buy_tickets', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.event_buy_tickets", login="admin")
|
||||
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('event_buy_tickets')", "odoo.__DEBUG__.services['web_tour.tour'].tours.event_buy_tickets.ready", login="admin")
|
||||
|
||||
def test_demo(self):
|
||||
self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('event_buy_tickets', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.event_buy_tickets", login="demo")
|
||||
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('event_buy_tickets')", "odoo.__DEBUG__.services['web_tour.tour'].tours.event_buy_tickets.ready", login="demo")
|
||||
|
||||
# TO DO - add public test with new address when convert to web.tour format.
|
||||
|
||||
Reference in New Issue
Block a user