diff options
| author | Christophe Monniez <moc@odoo.com> | 2019-03-16 17:38:01 +0000 |
|---|---|---|
| committer | Christophe Monniez <moc@odoo.com> | 2019-03-21 12:15:30 +0000 |
| commit | e48040677382a378a7bdb2d755d0ff23e19c82ab (patch) | |
| tree | 697c00c62646ecf4c65e59ac2838d9d7e14cde27 /addons/web/static/src/js | |
| parent | 31f199597fc0dbefc6b875dc5a196fbe132e1c4d (diff) | |
[FIX] web: click on home menu on next tick
Since odoo/enterprise@b830ea7ed2a, the enterprise home menu is asynchrnonous.
Because of that, the clientActionCount variable is updated too late and
this counter is screwed up, making the test fail.
With this commit a setTimeout 0 is used to click on home menu in the
next tick and then update the current action count.
Also
* the test is adapted to stop immediately when an error is catched.
* the initial click on home menu is moved into debug manager because
the python test launcher uses the correct location already.
Thanks to @VincentSchippefilt and @aab-odoo
closes odoo/odoo#31949
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/tools/debug_manager.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/tools/test_menus.js | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/addons/web/static/src/js/tools/debug_manager.js b/addons/web/static/src/js/tools/debug_manager.js index 172148e03ef..54e98bbb87e 100644 --- a/addons/web/static/src/js/tools/debug_manager.js +++ b/addons/web/static/src/js/tools/debug_manager.js @@ -213,6 +213,8 @@ var DebugManager = Widget.extend({ }); }, perform_click_everywhere_test: function () { + var $homeMenu = $("nav.o_main_navbar > a.o_menu_toggle.fa-th"); + $homeMenu.click(); startClickEverywhere(); }, split_assets: function() { diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/js/tools/test_menus.js index d950d5d56ee..52891357e5d 100644 --- a/addons/web/static/src/js/tools/test_menus.js +++ b/addons/web/static/src/js/tools/test_menus.js @@ -24,7 +24,7 @@ AbstractController.include({ start: function(){ this.$el.attr('data-view-type', this.viewType); - return this._super(); + return this._super.apply(this, arguments); }, update: function(params, options) { return this._super(params, options).then(function (){ @@ -36,7 +36,7 @@ if (Discuss) { Discuss.include({ _fetchAndRenderThread: function() { - return this._super().then(function (){ + return this._super.apply(this, arguments).then(function (){ viewUpdateCount++; }); }, @@ -56,8 +56,6 @@ var $listOfAppMenuItems; if (isEnterprise) { console.log("Odoo flavor: Enterprise"); - var $homeMenu = $("nav.o_main_navbar > a.o_menu_toggle.fa-th"); - $homeMenu.click(); $listOfAppMenuItems = $(".o_app, .o_menuitem"); } else { console.log("Odoo flavor: Community"); @@ -74,6 +72,7 @@ console.log("Test took ", (performance.now() - startTime) / 1000, " seconds"); }).catch(function () { console.log("Test took ", (performance.now() - startTime) / 1000, " seconds"); + console.error('test failed') console.error("Error !"); }); } @@ -102,6 +101,11 @@ // no effect in community var $homeMenu = $("nav.o_main_navbar > a.o_menu_toggle.fa-th"); $homeMenu.click(); + return new Promise(function(resolve){ + setTimeout(function(){ + resolve(); + }, 0); + }); }); } @@ -140,6 +144,7 @@ } }).catch(function () { console.error("Error while testing", element); + return Promise.reject(); }); }; @@ -232,7 +237,7 @@ function waitForCondition(stopCondition) { var prom = new Promise(function (resolve, reject) { var interval = 250; - var timeLimit = 15000; + var timeLimit = 5000; function checkCondition() { if (stopCondition()) { |
