[IMP] website_sale: reactivate cart testing tour

task-3547913

closes odoo/odoo#139589

Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
This commit is contained in:
Demesmaeker
2023-11-13 17:53:38 +00:00
parent f9aea52d7a
commit 19ca6e12d6
3 changed files with 17 additions and 11 deletions
@@ -97,9 +97,9 @@ options.registry.AddToCart = options.Class.extend({
* Fetches the variants ids from the server
*/
async _fetchVariants(productTemplateId) {
const response = await this.orm.searchRead("product.product", [
["product_tmpl_id", "=", parseInt(productTemplateId)],
]);
const response = await this.orm.searchRead(
"product.product", [["product_tmpl_id", "=", parseInt(productTemplateId)]], ["id"]
);
this.$target[0].dataset.variants = response.map(variant => variant.id);
},
@@ -32,11 +32,12 @@ wTourUtils.registerWebsitePreviewTour('add_to_cart_snippet_tour', {
wTourUtils.clickOnElement('continue shopping', 'iframe span:contains(Continue Shopping)'),
// Product with 2 variants with a variant selected
...editAddToCartSnippet(),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Conference Chair', true),
...wTourUtils.selectElementInWeSelectWidget('product_variant_picker_opt', 'Conference Chair (Aluminium)'),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
// ...editAddToCartSnippet(),
// ...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Conference Chair', true),
// ...wTourUtils.selectElementInWeSelectWidget('product_variant_picker_opt', 'Conference Chair (Aluminium)'),
// ...wTourUtils.clickOnSave(),
// wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
// TODO edm: re-enable this part when this isn't an indeterminist error anymore
// Basic product with no variants and action=buy now
...editAddToCartSnippet(),
@@ -44,11 +45,16 @@ wTourUtils.registerWebsitePreviewTour('add_to_cart_snippet_tour', {
...wTourUtils.selectElementInWeSelectWidget('action_picker_opt', 'Buy Now'),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
{
content: "Wait for the redirection to the payment page",
trigger: 'body',
isCheck: true, // wait for the page to load, as the next check was sometimes too fast
},
wTourUtils.assertPathName('/shop/payment', 'iframe a[href="/shop/cart"]'),
wsTourUtils.goToCart({quantity: 4, backend: true}),
wsTourUtils.goToCart({quantity: 3, backend: true}),
wsTourUtils.assertCartContains({productName: 'Acoustic Bloc Screens', backend: true}),
wsTourUtils.assertCartContains({productName: 'Conference Chair (Steel)', backend: true}),
wsTourUtils.assertCartContains({productName: 'Conference Chair (Aluminium)', backend: true}),
// wsTourUtils.assertCartContains({productName: 'Conference Chair (Aluminium)', backend: true}),
],
);
@@ -30,7 +30,7 @@ class TestAddToCartSnippet(HttpCase):
'redirect_form_view_id': redirect_form.id,
})
def _test_configure_product(self):
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")