Skip to content
Permalink
Browse files

[FIX] web: click on home menu on next tick

Since odoo/enterprise@b830ea7, 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 #31949

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
  • Loading branch information...
d-fence committed Mar 16, 2019
1 parent 31f1995 commit e48040677382a378a7bdb2d755d0ff23e19c82ab
Showing with 12 additions and 5 deletions.
  1. +2 −0 addons/web/static/src/js/tools/debug_manager.js
  2. +10 −5 addons/web/static/src/js/tools/test_menus.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() {
@@ -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()) {

0 comments on commit e480406

Please sign in to comment.
You can’t perform that action at this time.