diff options
| author | Romain Derie <rde@odoo.com> | 2020-03-05 11:44:00 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-03-07 12:16:12 +0000 |
| commit | 8066001ee4e1e38805f4b3564fcfae411e4856ea (patch) | |
| tree | 9e73f7f22e44f6e03fd7c5e9d9e71a1177cd4126 /addons | |
| parent | 05d17089c4a604cb49f1a263b68f39aeffecccda (diff) | |
[FIX] website: add test for 5ac269d722f
5ac269d722f fixed 7e2b0ebe799 that prevented the website menu to actually be
visible, since the JS in charge of displaying the menu was 'crashing'.
A test was missing to avoid that issue to appear ever again, since it is quite
a critical problem.
Note that it might look strange that breaking such a mechanism does not make
the runbot red, but since the menus are actually considered visible, the tests
are able to 'see' it in DOM and click on it.
They are actually hidden through an opacity 0 & height 0 while the JS process
them.
task-2093679
closes odoo/odoo#47138
X-original-commit: 0dc00a252dfe7fee658579a60dc7b1b1ca71a661
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website/static/tests/tours/website_navbar_menu.js | 20 | ||||
| -rw-r--r-- | addons/website/tests/test_ui.py | 11 | ||||
| -rw-r--r-- | addons/website/views/assets.xml | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/addons/website/static/tests/tours/website_navbar_menu.js b/addons/website/static/tests/tours/website_navbar_menu.js new file mode 100644 index 00000000000..e3523f69076 --- /dev/null +++ b/addons/website/static/tests/tours/website_navbar_menu.js @@ -0,0 +1,20 @@ +odoo.define("website.tour.website_navbar_menu", function (require) { +"use strict"; + +var tour = require("web_tour.tour"); + +tour.register("website_navbar_menu", { + test: true, + url: "/", +}, [ + { + content: "Ensure menus are in DOM", + trigger: '#top_menu .nav-item a:contains("Test Tour Menu")', + run: function () {}, // it's a check + }, { + content: "Ensure menus loading is done (so they are actually visible)", + trigger: 'body:not(:has(.o_menu_loading))', + run: function () {}, // it's a check + } +]); +}); diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index 92f0796fc9b..d739ed877b6 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -110,6 +110,17 @@ class TestUi(odoo.tests.HttpCase): def test_03_backend_dashboard(self): self.start_tour("/", 'backend_dashboard', login='admin') + def test_04_website_navbar_menu(self): + website = self.env['website'].search([], limit=1) + self.env['website.menu'].create({ + 'name': 'Test Tour Menu', + 'url': '/test-tour-menu', + 'parent_id': website.menu_id.id, + 'sequence': 0, + 'website_id': website.id, + }) + self.start_tour("/", 'website_navbar_menu') + def test_05_specific_website_editor(self): website_default = self.env['website'].search([], limit=1) new_website = self.env['website'].create({'name': 'New Website'}) diff --git a/addons/website/views/assets.xml b/addons/website/views/assets.xml index a0d00feb356..1015427043b 100644 --- a/addons/website/views/assets.xml +++ b/addons/website/views/assets.xml @@ -25,6 +25,7 @@ <script type="text/javascript" src="/website/static/tests/tours/restricted_editor.js"/> <script type="text/javascript" src="/website/static/tests/tours/dashboard_tour.js"/> <script type="text/javascript" src="/website/static/tests/tours/specific_website_editor.js"/> + <script type="text/javascript" src="/website/static/tests/tours/website_navbar_menu.js"/> </xpath> </template> |
