diff --git a/addons/website_sale/static/tests/tours/website_sale_update_address.js b/addons/website_sale/static/tests/tours/website_sale_update_address.js new file mode 100644 index 00000000000..d67091ee1c2 --- /dev/null +++ b/addons/website_sale/static/tests/tours/website_sale_update_address.js @@ -0,0 +1,39 @@ +/** @odoo-module **/ + +import { registry } from "@web/core/registry"; +import tourUtils from "@website_sale/js/tours/tour_utils"; + +registry.category("web_tour.tours").add('update_billing_shipping_address', { + test: true, + url: '/shop', + steps: () => [ + ...tourUtils.addToCart({productName: "Office Chair Black TEST"}), + tourUtils.goToCart({quantity: 1}), + tourUtils.goToCheckout(), + { + content: "Edit Address", + trigger: '#shipping_and_billing a:contains("Edit")' + }, + { + content: "Edit billing address which is shipping address too", + trigger: 'a.js_edit_address' + }, + { + content: "Empty the phone field", + trigger: 'input[name="phone"]', + run: () => { + document.querySelector('input[name="phone"]').value = ""; + }, + }, + { + content: "Save address", + trigger: 'a.a-submit', + run: "click", + }, + { + content: "Check there is a warning for required field.", + trigger: 'h5.text-danger:contains("Some required fields are empty.")', + run: () => {}, + }, + ], +}); diff --git a/addons/website_sale/tests/test_sale_process.py b/addons/website_sale/tests/test_sale_process.py index 6978abbffdf..89bd225dd4a 100644 --- a/addons/website_sale/tests/test_sale_process.py +++ b/addons/website_sale/tests/test_sale_process.py @@ -147,6 +147,15 @@ class TestUi(HttpCaseWithUserDemo): self.start_tour("/shop", 'google_analytics_view_item') self.start_tour("/shop", 'google_analytics_add_to_cart') + def test_update_same_address_billing_shipping_edit(self): + ''' Phone field should be required when updating an adress for billing and shipping ''' + self.env['product.product'].create({ + 'name': 'Office Chair Black TEST', + 'list_price': 12.50, + 'is_published': True, + }) + self.start_tour("/shop", 'update_billing_shipping_address', login="admin") + @odoo.tests.tagged('post_install', '-at_install') class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo, HttpCaseWithUserPortal): @@ -399,13 +408,13 @@ class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo, HttpCaseWithUs partner = self.env['res.partner'].create({'name': 'test'}) be_address_POST, nl_address_POST = [ { - 'name': 'Test name', 'email': 'test@email.com', 'street': 'test', + 'name': 'Test name', 'email': 'test@email.com', 'street': 'test', 'phone': '+333333333333333', 'city': 'test', 'zip': '3000', 'country_id': self.env.ref('base.be').id, 'submitted': 1, 'partner_id': partner.id, 'callback': '/shop/checkout', }, { - 'name': 'Test name', 'email': 'test@email.com', 'street': 'test', + 'name': 'Test name', 'email': 'test@email.com', 'street': 'test', 'phone': '+333333333333333', 'city': 'test', 'zip': '3000', 'country_id': self.env.ref('base.nl').id, 'submitted': 1, 'partner_id': partner.id, 'callback': '/shop/checkout', diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 8576df55d07..53e33fc21a7 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -2034,6 +2034,9 @@ + + +