From b6ef017f645ea107d6b9ce06671e51142781eaee Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 5 Oct 2021 07:26:50 +0000 Subject: [PATCH] [FIX] web: make test more robust Before this commit, the changed test sometimes failed on runbot (rarely though), because it might happen that the debounce released before the promise returned by the click helper resolved (e.g. if the server was overloaded, or was garbage collecting...). That promise waited for a setTimeout, and then for a nextAnimationFrame. In this scenario, there's no need to wait so long, as there is no rendering to wait for. Example of failing build: https://runbot.odoo.com/runbot/build/10360554 X-original-commit: 880c4683698c987f212e4a113b374230566001f1 Part-of: odoo/odoo#78698 --- addons/web/static/tests/legacy/views/kanban_tests.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/web/static/tests/legacy/views/kanban_tests.js b/addons/web/static/tests/legacy/views/kanban_tests.js index aaa9b3c04a4..9a1cf7d52ed 100644 --- a/addons/web/static/tests/legacy/views/kanban_tests.js +++ b/addons/web/static/tests/legacy/views/kanban_tests.js @@ -5512,10 +5512,12 @@ QUnit.module('Views', { count++; event.data.on_closed(); }); - await testUtils.dom.click($('button[data-name="a1"]').first()); + testUtils.dom.click($('button[data-name="a1"]').first()); + await new Promise(r => setTimeout(r)); assert.strictEqual(count, 1, "should have triggered a execute action"); - await testUtils.dom.click($('button[data-name="a1"]').first()); + testUtils.dom.click($('button[data-name="a1"]').first()); + await new Promise(r => setTimeout(r)); assert.strictEqual(count, 1, "double-click on kanban actions should be debounced"); assert.verifySteps([