[ADD] website_sale_delivery: Add test for delivery 'free over'

This commit adds a tour for the condition where the delivery charges,
even though that was not added to the total charges, it was shown in the
delivery charges aside (even if the payment was over the amount where free
delivery was available). This adds a test that it should be "0.0" instead.

This was tested before the fix and after the fix.
This commit is contained in:
Saugat Pachhai
2019-05-29 11:25:22 +00:00
parent 691dc424a1
commit 9308180089
4 changed files with 60 additions and 0 deletions
@@ -0,0 +1,36 @@
odoo.define('website_sale_delivery.tour', function (require) {
'use strict';
var base = require('web_editor.base');
var tour = require("web_tour.tour");
tour.register('check_free_delivery', {
test: true,
url: '/shop?search=conference chair',
wait_for: base.ready(),
},
[
{
content: "select conference chair",
trigger: '.oe_product_cart:first a:contains("Conference Chair")',
},
{
content: "click on add to cart",
extra_trigger: 'label:contains(Steel) input:propChecked',
trigger: '#product_detail form[action^="/shop/cart/update"] .btn-primary',
},
{
content: "click in modal on 'Proceed to checkout' button",
trigger: 'button:contains("Proceed to Checkout")',
},
{
content: "go to checkout",
extra_trigger: '#cart_products input.js_quantity:propValue(1)',
trigger: 'a[href*="/shop/checkout"]',
},
{
content: "Check Free Delivery value to be zero",
trigger: "#delivery_carrier span:contains('0.0')"
},
]);
});
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_ui
@@ -0,0 +1,14 @@
import odoo.tests
# Part of Odoo. See LICENSE file for full copyright and licensing details.
@odoo.tests.tagged('post_install', '-at_install')
class TestUi(odoo.tests.HttpCase):
def test_01_free_delivery_when_exceed_threshold(self):
self.env.ref("delivery.free_delivery_carrier").write({
'fixed_price': 2,
'free_over': True,
'amount': 10,
})
self.phantom_js("/web", "odoo.__DEBUG__.services['web_tour.tour'].run('check_free_delivery')", "odoo.__DEBUG__.services['web_tour.tour'].tours.check_free_delivery.ready", login="admin")
@@ -22,6 +22,12 @@
</xpath>
</template>
<template id="assets_common" name="Website Sale Common Assets" inherit_id="web.assets_common">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_sale_delivery/static/src/js/website_free_delivery_tour.js"></script>
</xpath>
</template>
<template id="payment_delivery_methods">
<input t-att-value="delivery.id" t-att-id="'delivery_%i' % delivery.id" type="radio" name="delivery_type" t-att-checked="order.carrier_id and order.carrier_id.id == delivery.id and 'checked' or False" t-att-class="'d-none' if delivery_nb == 1 else ''"/>
<label class="label-optional" t-field="delivery.name" t-att-for="'delivery_%i' % delivery.id"/>