[IMP] web: add a light mode to clickEverywhere test
The test clickEverywhere may last a very long time when all modules are installed. For that reason, it's not a standard test and we run it at night. Unfortunately, it may happen that an App menu breaks and that this failure is only spotted the next morning. With this commit, a light mode is added to the clickEverywhere test. In this mode, only the app menus are tested. Also, two python tests are added that use this mode and are launched as standard tests. closes odoo/odoo#46934 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
var testedApps;
|
||||
var testedMenus;
|
||||
var blackListedMenus = ['base.menu_theme_store', 'base.menu_third_party'];
|
||||
var appsMenusOnly = false;
|
||||
|
||||
function createWebClientHooks() {
|
||||
var AbstractController = odoo.__DEBUG__.services['web.AbstractController'];
|
||||
@@ -45,7 +46,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function clickEverywhere(menu_id){
|
||||
function clickEverywhere(menu_id, light){
|
||||
appsMenusOnly = light;
|
||||
setTimeout(_clickEverywhere, 1000, menu_id);
|
||||
}
|
||||
|
||||
@@ -104,6 +106,7 @@
|
||||
if (testedApps.indexOf(element.dataset.menuXmlid) >= 0) return Promise.resolve(); // Another infinite loop protection
|
||||
testedApps.push(element.dataset.menuXmlid);
|
||||
return testMenuItem(element).then(function () {
|
||||
if (appsMenusOnly === true) return Promise.resolve();
|
||||
var $subMenuItems;
|
||||
$subMenuItems = $('.o_menu_entry_lvl_1, .o_menu_entry_lvl_2, .o_menu_entry_lvl_3, .o_menu_entry_lvl_4');
|
||||
var testMenuPromise = Promise.resolve();
|
||||
@@ -172,6 +175,7 @@
|
||||
* the click on each of them
|
||||
*/
|
||||
function testViews() {
|
||||
if (appsMenusOnly === true) return Promise.resolve();
|
||||
var $switches = $("nav.o_cp_switch_buttons > button:not(.active):visible");
|
||||
var testSwitchPromise = Promise.resolve();
|
||||
// chainDeferred($switches, testSwitchPromise, testViewSwitch # FIXME
|
||||
@@ -210,6 +214,7 @@
|
||||
* Click on each filter in the control pannel
|
||||
*/
|
||||
function testFilters() {
|
||||
if (appsMenusOnly === true) return Promise.resolve();
|
||||
var filterProm = Promise.resolve();
|
||||
// var $filters = $('div.o_control_panel div.btn-group.o_dropdown > ul.o_filters_menu > li:not(.o_add_custom_filter)');
|
||||
var $filters = $('.o_filters_menu > .o_menu_item:not(.d-none)');
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
odoo.define('web.clickEverywhere', function (require) {
|
||||
"use strict";
|
||||
var ajax = require('web.ajax');
|
||||
function startClickEverywhere(menu_id) {
|
||||
function startClickEverywhere(menu_id, appsMenusOnly) {
|
||||
ajax.loadJS('web/static/src/js/tools/test_menus.js').then(
|
||||
function() {
|
||||
clickEverywhere(menu_id);
|
||||
clickEverywhere(menu_id, appsMenusOnly);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,3 +28,15 @@ class TestMenusDemo(odoo.tests.HttpCase):
|
||||
_logger.log(25, 'Testing %s', app['name'])
|
||||
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere'](%d);" % app['id'], "odoo.isReady === true", login="demo", timeout=300)
|
||||
self.terminate_browser()
|
||||
|
||||
@odoo.tests.tagged('post_install', '-at_install')
|
||||
class TestMenusAdminLight(odoo.tests.HttpCase):
|
||||
|
||||
def test_01_click_apps_menus_as_admin(self):
|
||||
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere'](undefined, true);", "odoo.isReady === true", login="admin", timeout=120)
|
||||
|
||||
@odoo.tests.tagged('post_install', '-at_install',)
|
||||
class TestMenusDemoLight(odoo.tests.HttpCase):
|
||||
|
||||
def test_01_click_apps_menus_as_demo(self):
|
||||
self.browser_js("/web", "odoo.__DEBUG__.services['web.clickEverywhere'](undefined, true);", "odoo.isReady === true", login="demo", timeout=120)
|
||||
|
||||
Reference in New Issue
Block a user