From 9168a8e73b0ea8a199a4ff958ee9368d679a1dc7 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Mon, 14 Nov 2022 11:22:17 +0000 Subject: [PATCH] [FIX] website_sale: make add_to_cart_snippet_tour run as expected Add a setUpClass with a dummy payment provider to ensure that at least one is always available when the tour is running, and set the company country_id to None before starting the tour to avoid any country dependant fields to block the tour during the checkout process. closes odoo/odoo#105700 X-original-commit: 779965fbf0471f2b003692f1afa541864a396651 Signed-off-by: William Braeckman (wbr) Signed-off-by: Nicolas Viseur (vin) --- .../test_website_sale_add_to_cart_snippet.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/addons/website_sale/tests/test_website_sale_add_to_cart_snippet.py b/addons/website_sale/tests/test_website_sale_add_to_cart_snippet.py index 14f11c1bd0c..05f982a54d5 100644 --- a/addons/website_sale/tests/test_website_sale_add_to_cart_snippet.py +++ b/addons/website_sale/tests/test_website_sale_add_to_cart_snippet.py @@ -5,5 +5,32 @@ from odoo.tests import HttpCase, tagged @tagged('post_install', '-at_install') class TestAddToCartSnippet(HttpCase): + + @classmethod + def setUpClass(cls): + super().setUpClass() + # Create a dummy payment provider to ensure that the tour has at least one available to it. + arch = """ +
+ + +
+ """ + redirect_form = cls.env['ir.ui.view'].create({ + 'name': "Dummy Redirect Form", + 'type': 'qweb', + 'arch': arch, + }) + cls.dummy_provider = cls.env['payment.provider'].create({ + 'name': "Dummy Provider", + 'code': 'none', + 'state': 'test', + 'is_published': True, + 'allow_tokenization': True, + 'redirect_form_view_id': redirect_form.id, + }) + def test_configure_product(self): + # Reset the company country id, which ensure that no country dependant fields are blocking the address form. + self.env.company.country_id = self.env.ref('base.us') self.start_tour("/", 'add_to_cart_snippet_tour', login="admin")