[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#138629 X-original-commit: cdca70941dab1b20dca9bdf9d44d354327176b59 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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() {},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user