[FIX] test_mail: fix activity test failing randomly

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) <awa@odoo.com>
This commit is contained in:
Pierre-Yves Dufays
2023-11-14 06:43:54 +00:00
parent 644c27a784
commit 239ea215da
@@ -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({