From b5306fcd1bd922e2b08260b7957ab8dfdcd9aec0 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Wed, 20 Dec 2023 08:35:25 +0100 Subject: [PATCH] [FIX] mail: fix non deterministic crosstab test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes a test that ensures the bus subscriptions are updated when a member is invited to a channel. This test waits some time before checking if the subscription is done. Sometimes, a tick is not enough and the test fails. This PR adds a deferred that resolves when the subscription is done that can be awaited to ensure the timing is always right. fixes runbot-46941 closes odoo/odoo#146848 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/tests/crosstab/crosstab_tests.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/tests/crosstab/crosstab_tests.js b/addons/mail/static/tests/crosstab/crosstab_tests.js index 758e5049d8b..a9d5366d021 100644 --- a/addons/mail/static/tests/crosstab/crosstab_tests.js +++ b/addons/mail/static/tests/crosstab/crosstab_tests.js @@ -1,6 +1,7 @@ /* @odoo-module */ import { startServer } from "@bus/../tests/helpers/mock_python_environment"; +import { waitUntilSubscribe } from "@bus/../tests/helpers/websocket_event_deferred"; import { start } from "@mail/../tests/helpers/test_utils"; @@ -122,7 +123,7 @@ QUnit.test("Channel subscription is renewed when channel is left", async (assert openDiscuss(); await click(".o-mail-DiscussSidebarChannel .btn[title='Leave this channel']"); await contains(".o-mail-DiscussSidebarChannel", { count: 0 }); - await new Promise((resolve) => setTimeout(resolve)); // update of channels is debounced + await waitUntilSubscribe(); assert.verifySteps(["update-channels"]); });