diff options
| author | Christophe Monniez <moc@odoo.com> | 2018-08-30 13:41:14 +0200 |
|---|---|---|
| committer | Christophe Monniez <moc@odoo.com> | 2018-08-31 14:45:25 +0200 |
| commit | 4e7fcf3e07619145d8460217b91e85709db1500d (patch) | |
| tree | ea93dfd710be49b6755a35eec00d4738b525191c | |
| parent | de1631c7174de31542fc38e29dd64dd092230995 (diff) | |
[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.
| -rw-r--r-- | addons/web/static/src/js/chrome/abstract_web_client.js | 3 | ||||
| -rw-r--r-- | addons/web/tests/test_click_everywhere.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js index 2ada433fbc8..7a8b3ce8b01 100644 --- a/addons/web/static/src/js/chrome/abstract_web_client.js +++ b/addons/web/static/src/js/chrome/abstract_web_client.js @@ -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; }); }, diff --git a/addons/web/tests/test_click_everywhere.py b/addons/web/tests/test_click_everywhere.py index 1e79104c30f..00c233a24e7 100644 --- a/addons/web/tests/test_click_everywhere.py +++ b/addons/web/tests/test_click_everywhere.py @@ -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) |
