Skip to content

Commit

Permalink
[FIX] board: fix test failing every Saturdays
Browse files Browse the repository at this point in the history
Commit [1] introduced a new board test involving calendar views.
However, when this test was run on Saturday, it failed, because the
event we tried to click on wasn't displayed (wrong week).

This commit fixes the test by enforcing date values on fake records
and patching the current date.

[1] odoo/odoo@e5635c3

closes odoo#163712

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
  • Loading branch information
aab-odoo authored and willylohws committed May 1, 2024
1 parent acfda07 commit fdace9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions addons/board/static/tests/dashboard_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ odoo.define("board.dashboard_tests", function (require) {
display_name: "first record",
foo: "yop",
int_field: 3,
date_field: (new Date()).toISOString().slice(0, -5),
date_field: "2024-04-27 10:00:00",
},
{
id: 2,
display_name: "second record",
foo: "lalala",
int_field: 5,
date_field: (new Date()).toISOString().slice(0, -5),
date_field: "2024-04-27 10:00:00",
},
{
id: 4,
display_name: "aaa",
foo: "abc",
int_field: 2,
date_field: (new Date()).toISOString().slice(0, -5),
date_field: "2024-04-27 10:00:00",
},
],
},
Expand Down Expand Up @@ -1454,6 +1454,8 @@ odoo.define("board.dashboard_tests", function (require) {
QUnit.test("can have multiple calendars in dashboard", async function (assert) {
assert.expect(3);

const unpatchDate = patchDate(2024, 3, 27, 20, 0, 0);

var form = await createView({
View: BoardView,
model: "board",
Expand Down Expand Up @@ -1505,5 +1507,6 @@ odoo.define("board.dashboard_tests", function (require) {
assert.containsOnce(form, ".popover", "should only have one popover");

form.destroy();
unpatchDate();
});
});

0 comments on commit fdace9f

Please sign in to comment.