[FIX] website_livechat: fix chatbot tour race condition
In some cases, the runbot running the tour was clicking on the "restart conversation" button before we had the chance to register the click event on it. This small commit adds a "ready" class on the button when we have correctly registered the click event, and makes the tour step wait for that class before clicking to restart. closes odoo/odoo#91505 X-original-commit: 623fdb15ce9a6f3f586254dca549a72869336729 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -17,6 +17,12 @@ LivechatButton.include({
|
||||
|
||||
return this._super(...arguments);
|
||||
},
|
||||
_renderMessages: function () {
|
||||
this._super(...arguments);
|
||||
|
||||
this._chatWindow.$('.o_livechat_chatbot_main_restart')
|
||||
.addClass('ready');
|
||||
},
|
||||
/**
|
||||
* Small override that removes current messages when restarting.
|
||||
* This allows to easily check for new posted messages without having the old ones "polluting"
|
||||
@@ -118,7 +124,7 @@ tour.register('website_livechat_chatbot_flow_tour', {
|
||||
trigger: messagesContain("Ok bye!"),
|
||||
run: () => {} // last step is displayed
|
||||
}, {
|
||||
trigger: '.o_livechat_chatbot_main_restart',
|
||||
trigger: '.o_livechat_chatbot_main_restart.ready',
|
||||
run: 'click'
|
||||
}, {
|
||||
trigger: messagesContain("Restarting conversation..."),
|
||||
|
||||
Reference in New Issue
Block a user