[FIX] website_livechat: fix non deterministic reaction tour
Before this PR, the `test_complete_chatbot_flow_ui` would sometimes fail when checking if the user can add a reaction to a message. There are two issues: - This step uses the `contains` helper and specify the live chat `ShadowRoot` as the target. However, the `contains` helper uses a mutation observer that observes the light DOM thus, changes in the shadow root are not correctly observed. - The target passed to the `contains` helper is the `ChatWindow` DOM element but this element can be unmounted in-between. This PR fixes this issue. fixes runbot-56670 closes odoo/odoo#153382 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -327,7 +327,7 @@ class Contains {
|
||||
this.def.reject(e); // prevents infinite loop in case of programming error
|
||||
}
|
||||
});
|
||||
this.observer.observe(document.body, {
|
||||
this.observer.observe(this.options.target, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
subtree: true,
|
||||
|
||||
@@ -49,7 +49,7 @@ registry.category("web_tour.tours").add("website_livechat_chatbot_flow_tour", {
|
||||
// the thread has been persisted in the process
|
||||
async run() {
|
||||
await contains(".o-mail-Message-actions [title='Add a Reaction']", {
|
||||
target: this.$anchor[0],
|
||||
target: this.$anchor[0].getRootNode(),
|
||||
parent: [".o-mail-Message", { text: "I want to buy the software" }],
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user