[FIX] mail: fix non deterministic crosstab test

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) <seb@odoo.com>
This commit is contained in:
tsm-odoo
2023-12-20 09:55:06 +00:00
parent ba5585fea7
commit b5306fcd1b
@@ -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"]);
});