[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>
This commit is contained in:
Romain Derie
2020-03-07 12:16:12 +00:00
committed by qsm-odoo
parent 05d17089c4
commit 8066001ee4
3 changed files with 32 additions and 0 deletions
@@ -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
}
]);
});
+11
View File
@@ -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'})
+1
View File
@@ -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>