[FIX] website_livechat: fix tour failing nondeterministically

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) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
tsm-odoo
2023-10-19 14:47:30 +00:00
parent f0efa1dca8
commit 8c57d34e02
@@ -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() {},
},
],