From 8c57d34e021d67579c845390e5adc1f4cb659739 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Thu, 19 Oct 2023 09:49:09 +0200 Subject: [PATCH] [FIX] website_livechat: fix tour failing nondeterministically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the `website_livechat_chatbot_flow_tour` that was failing in a nondeterministc way. This is due to the tour sometimes taking more than `60` seconds which is the default timeout for python tours. Most of the time is consumed waiting for the user to finish its multiline input. This issue is solved by shortening the delay to consider the multiline input as done: from `10`s to `500`ms. fixes runbot-24557 closes odoo/odoo#139034 X-original-commit: 7788f2f1879dda2381a7d2e93e8a0472f4621d14 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Alexandre Kühn (aku) --- .../tests/tours/website_livechat_chatbot_flow.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js b/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js index 27099df4d2b..ab41f3cc946 100644 --- a/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js +++ b/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js @@ -1,6 +1,7 @@ /** @odoo-module */ import { registry } from "@web/core/registry"; +import { debounce } from "@web/core/utils/timing"; const messagesContain = (text) => `.o-mail-Message:contains("${text}")`; @@ -10,6 +11,14 @@ registry.category("web_tour.tours").add("website_livechat_chatbot_flow_tour", { steps: () => [ { trigger: messagesContain("Hello! I'm a bot!"), + run: () => { + // make chat bot faster for this tour + const chatbotService = odoo.__WOWL_DEBUG__.root.env.services["im_livechat.chatbot"]; + chatbotService.debouncedProcessUserAnswer = debounce( + chatbotService._processUserAnswer.bind(chatbotService), + 500 + ); + }, }, { trigger: messagesContain("I help lost visitors find their way."), @@ -123,7 +132,6 @@ registry.category("web_tour.tours").add("website_livechat_chatbot_flow_tour", { }, { trigger: messagesContain("Ok bye!"), - timeout: 15000, // multiline step, so we need to wait a bit longer run: () => {}, // last step is displayed }, { @@ -198,7 +206,6 @@ registry.category("web_tour.tours").add("website_livechat_chatbot_flow_tour", { { // wait for chatbot script to finish. trigger: ".o-mail-ChatWindow-command[title='Restart Conversation']", - timeout: 15000, // multiline step, so we need to wait a bit longer run() {}, }, ],