From 239ea215dab1f9fbbd0053c65269e56c1ed030e6 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Dufays Date: Mon, 13 Nov 2023 12:40:44 +0100 Subject: [PATCH] [FIX] test_mail: fix activity test failing randomly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each failing of the test "activity menu widget: activity menu with 2 models" was close to midnight. And that was actually the cause of the error. Actually, when executing that test very close to midnight, the test activities are set up for a day and the check happens the day after (actually a few second after). As we check in this test "overdue", "planned" and "today" activities, the tested value are not inline anymore with the test setup when switching from a day to the next (passing midnight). For example, "today" activities become "overdue" activities. To avoid that we patch the date to be far from midnight. Task-3592798 closes odoo/odoo#141762 Signed-off-by: Warnon Aurélien (awa) --- .../static/tests/systray_activity_menu_tests.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/test_mail/static/tests/systray_activity_menu_tests.js b/addons/test_mail/static/tests/systray_activity_menu_tests.js index 0cae1b4c8b9..0c70c2918ec 100644 --- a/addons/test_mail/static/tests/systray_activity_menu_tests.js +++ b/addons/test_mail/static/tests/systray_activity_menu_tests.js @@ -6,10 +6,15 @@ import { start } from "@mail/../tests/helpers/test_utils"; import { serializeDate, today } from "@web/core/l10n/dates"; import { session } from "@web/session"; -import { patchWithCleanup } from "@web/../tests/helpers/utils"; +import { patchDate, patchWithCleanup } from "@web/../tests/helpers/utils"; import { click, contains } from "@web/../tests/utils"; -QUnit.module("activity menu"); +QUnit.module("activity menu", { + beforeEach() { + // Avoid problem around midnight (Ex.: tomorrow activities become today activities when reaching midnight) + patchDate(2023, 11, 13, 8, 0, 0); + }, +}); QUnit.test("menu with no records", async () => { await start({