diff --git a/addons/im_livechat/static/src/embed/chatbot/chatbot_service.js b/addons/im_livechat/static/src/embed/chatbot/chatbot_service.js index f993a3e929a..d84499d71c8 100644 --- a/addons/im_livechat/static/src/embed/chatbot/chatbot_service.js +++ b/addons/im_livechat/static/src/embed/chatbot/chatbot_service.js @@ -14,11 +14,11 @@ import { debounce } from "@web/core/utils/timing"; const MESSAGE_DELAY = 1500; // Time between two messages coming from the bot. const STEP_DELAY = 500; -// Time to wait without user input before considering a multi line -// step as completed. -const MULTILINE_STEP_DEBOUNCE_DELAY = 10000; export class ChatBotService { + // Time to wait without user input before considering a multi line + // step as completed. + MULTILINE_STEP_DEBOUNCE_DELAY = 10_000; /** @type {import("@im_livechat/embed/chatbot/chatbot_model").Chatbot} */ chatbot; /** @type {import("@im_livechat/embed/chatbot/chatbot_step_model").ChatbotStep} */ @@ -54,7 +54,7 @@ export class ChatBotService { this.debouncedProcessUserAnswer = debounce( this._processUserAnswer.bind(this), - MULTILINE_STEP_DEBOUNCE_DELAY + this.MULTILINE_STEP_DEBOUNCE_DELAY ); if (this.livechatService.options.isTestChatbot) { this.livechatService.rule.chatbot = { 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..82b0957d876 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 @@ -10,6 +10,12 @@ registry.category("web_tour.tours").add("website_livechat_chatbot_flow_tour", { steps: () => [ { trigger: messagesContain("Hello! I'm a bot!"), + run() { + // Make chatbot faster + odoo.__WOWL_DEBUG__.root.env.services[ + "im_livechat.chatbot" + ].MULTILINE_STEP_DEBOUNCE_DELAY = 500; + }, }, { trigger: messagesContain("I help lost visitors find their way."), @@ -123,7 +129,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 +203,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() {}, }, ],