[IMP] web: clickbot: test all views in studio

This commit adds a step in the click all test: for each view, enter
and leave Studio, to ensure that the view doesn't crash in Studio.

With the migration of views to owl, a lot of views worked fine, but
crashed when entering Studio. Those issues have been solved now,
and we want to ensure that this no longer happens in the future.

closes odoo/odoo#107992

X-original-commit: d18310bddf0a4f741a6335e5499ab213fb046993
Related: odoo/enterprise#35054
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2022-12-20 12:33:41 +01:00
parent 9521a4b5d6
commit 0ce0f51043
@@ -21,8 +21,10 @@
const { isEnterprise } = odoo.info;
const { onWillStart } = owl;
let appsMenusOnly = false;
const isStudioInstalled = "@web_studio/studio_service" in odoo.__DEBUG__.services;
let actionCount = 0;
let viewUpdateCount = 0;
let studioCount = 0;
let appIndex;
let menuIndex;
@@ -247,6 +249,26 @@
return app;
}
/**
* Test Studio
* Click on the Studio systray item to enter Studio, and simply leave it once loaded.
*/
async function testStudio() {
if (!isStudioInstalled) {
return;
}
const studioIcon = document.querySelector(".o_web_studio_navbar_item:not(.o_disabled) a i");
if (!studioIcon) {
return;
}
// Open the filter menu dropdown
await triggerClick(studioIcon, "entering studio");
await waitForCondition(() => document.querySelector(".o_in_studio"));
await triggerClick(document.querySelector(".o_web_studio_leave"), "leaving studio");
await waitForCondition(() => document.querySelector(".o_main_navbar:not(.o_studio_navbar) .o_menu_toggle"));
studioCount++;
}
/**
* Test filters
* Click on each filter in the control pannel
@@ -329,6 +351,7 @@
await waitForCondition(() => {
return document.querySelector(`.o_switch_view.o_${viewType}.active`) !== null;
});
await testStudio();
await testFilters();
}
}
@@ -367,6 +390,11 @@
}
return startActionCount !== actionCount;
})
.then(() => {
if (!isModal) {
return testStudio();
}
})
.then(() => {
if (!isModal) {
return testFilters();
@@ -444,12 +472,15 @@
}
}
console.log("Test took", (performance.now() - startTime) / 1000, "seconds");
console.log("Successfully tested", testedApps.length, " apps");
console.log("Successfully tested", testedMenus.length - testedApps.length, "menus");
console.log(`Test took ${(performance.now() - startTime) / 1000} seconds`);
console.log(`Successfully tested ${testedApps.length} apps`);
console.log(`Successfully tested ${testedMenus.length - testedApps.length} menus`);
if (isStudioInstalled) {
console.log(`Successfully tested ${studioCount} views in Studio`);
}
console.log("test successful");
} catch (err) {
console.log("Test took", (performance.now() - startTime) / 1000, "seconds");
console.log(`Test took ${(performance.now() - startTime) / 1000} seconds`);
console.error(err || "test failed");
}
console.log(testedApps);