[FIX] web: wait web client to be ready before clickEverywhere test

When starting the clickEverywhere test with enterprise modules
installed, it happens that Odoo web client is not yet fully loaded.
In this situation, the test does not find any app to test.

With this commit, an attribute is added to odoo to check if the web
client is fully loaded.
This commit is contained in:
Christophe Monniez
2018-08-31 14:45:25 +02:00
parent de1631c717
commit 4e7fcf3e07
2 changed files with 5 additions and 2 deletions
@@ -88,6 +88,8 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMi
set_title_part: '_onSetTitlePart',
},
init: function (parent) {
// a flag to determine that odoo is fully loaded
odoo.isReady = false;
this.client_options = {};
this._super(parent);
ServiceProviderMixin.init.call(this);
@@ -129,6 +131,7 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMi
// Listen to 'scroll' event and propagate it on main bus
self.action_manager.$el.on('scroll', core.bus.trigger.bind(core.bus, 'scroll'));
core.bus.trigger('web_client_ready');
odoo.isReady = true;
});
},
+2 -2
View File
@@ -7,11 +7,11 @@ import odoo.tests
class TestMenusAdmin(odoo.tests.HttpCase):
def test_01_click_everywhere_as_admin(self):
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere']();", "'web.clickEverywhere' in odoo.__DEBUG__.services", login="admin", timeout=1800)
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere']();", "odoo.isReady === true", login="admin", timeout=1800)
@odoo.tests.tagged('click_all', 'post_install', '-at_install', '-standard')
class TestMenusDemo(odoo.tests.HttpCase):
def test_01_click_everywhere_as_demo(self):
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere']();", "'web.clickEverywhere' in odoo.__DEBUG__.services", login="demo", timeout=1800)
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere']();", "odoo.isReady === true", login="demo", timeout=1800)