From 6e18e7f9341e6fac9c615aaa86c7d4270889f109 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Tue, 28 Jan 2020 13:51:20 +0000 Subject: [PATCH] [FIX] website_sale: prevent race condition on tour As this race condition seems not possible to be reproduced in local, all this is an assumption based on the logs. After the checkout, the user is redirected to `/shop/confirmation` where there is RPCs fired every seconds to fetch the payment status (`/shop/payment/get_status`). As the test was considered as finished on that page, sometimes the RPC would still be processed in python while the tour was considered done and killed, thus also the cookies, session & co. From that point, the python would crash when accessing the session. In the logs, the python crash in the RPC call occurs after the test is done. closes odoo/odoo#44235 X-original-commit: 082c660071283c0475e7ce26954803701cd3d659 Signed-off-by: Romain Derie --- .../static/tests/tours/website_sale_buy.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/website_sale/static/tests/tours/website_sale_buy.js b/addons/website_sale/static/tests/tours/website_sale_buy.js index 436e99d4be3..74e4fb58cbc 100644 --- a/addons/website_sale/static/tests/tours/website_sale_buy.js +++ b/addons/website_sale/static/tests/tours/website_sale_buy.js @@ -76,8 +76,18 @@ tour.register('shop_buy_product', { { content: "finish", trigger: '.oe_website_sale:contains("Please make a payment to:")', + // Leave /shop/confirmation to prevent RPC loop to /shop/payment/get_status. + // The RPC could be handled in python while the tour is killed (and the session), leading to crashes + run: function () { + window.location.href = '/aboutus'; // Redirect in JS to avoid the RPC loop (20x1sec) + }, timeout: 30000, - } + }, + { + content: "wait page loaded", + trigger: 'h3:contains("Great products for great people")', + run: function () {}, // it's a check + }, ] );