From 4fa4ff685ac6c908954ae20290c8dff9b82abbe0 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 7 Jul 2021 14:31:04 +0000 Subject: [PATCH] [FIX] web: load_state_tests: avoid undeterministic asserts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, two tests had undeterministic outcomes: they wanted to assert something in DOM was present at the same tiome as an owl rendering After this commit, the problematic asserts are removed and the tests behave deterministically. closes odoo/odoo#73379 Signed-off-by: Géry Debongnie (ged) --- .../static/tests/webclient/actions/load_state_tests.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/web/static/tests/webclient/actions/load_state_tests.js b/addons/web/static/tests/webclient/actions/load_state_tests.js index f20a847ed84..4d5743f9d53 100644 --- a/addons/web/static/tests/webclient/actions/load_state_tests.js +++ b/addons/web/static/tests/webclient/actions/load_state_tests.js @@ -972,6 +972,7 @@ QUnit.module("ActionManager", (hooks) => { class MyAction extends Component { mounted() { + assert.step("myAction mounted"); browser.location.hash = "#action=__test__client__action__&menu_id=1"; } } @@ -981,8 +982,7 @@ QUnit.module("ActionManager", (hooks) => { browser.location.hash = "#action=myAction"; const webClient = await createWebClient({ serverData }); - assert.containsOnce(webClient, ".not-here"); - assert.containsNone(webClient, ".test_client_action"); + assert.verifySteps(["myAction mounted"]); await nextTick(); assert.containsNone(webClient, ".not-here"); @@ -1001,6 +1001,7 @@ QUnit.module("ActionManager", (hooks) => { class MyAction extends Component { mounted() { + assert.step("myAction mounted"); const newURL = baseURL + "#action=__test__client__action__&menu_id=1"; // immediate triggering window.dispatchEvent(new HashChangeEvent("hashchange", { newURL })); @@ -1011,9 +1012,7 @@ QUnit.module("ActionManager", (hooks) => { browser.location.hash = "#action=myAction"; const webClient = await createWebClient({ serverData }); - - assert.containsOnce(webClient, ".not-here"); - assert.containsNone(webClient, ".test_client_action"); + assert.verifySteps(["myAction mounted"]); await nextTick(); assert.containsNone(webClient, ".not-here");