diff --git a/e2e/tests/01-spp-starter-spmis.spec.ts b/e2e/tests/01-spp-starter-spmis.spec.ts index 02aa98328..0c946ba5f 100644 --- a/e2e/tests/01-spp-starter-spmis.spec.ts +++ b/e2e/tests/01-spp-starter-spmis.spec.ts @@ -30,11 +30,14 @@ // (200_individuals.xlsx) and confirms the pager reflects the new count // 23 - Imports 200 group registrants in bulk via the Import records wizard // (200_groups.xlsx) and confirms the pager reflects the new count +// 24 - Opens the backend with the test assets loaded (?debug=tests) and confirms Odoo's +// JavaScript module loader reports no errors, since one bad import in any installed +// module's web.assets_tests fails every backend tour // // All tests run in order and share a single browser session (test.describe.serial). // A fresh Docker stack is spun up in beforeAll so every run starts from a clean database. -import {test, expect, Page, Browser} from "@playwright/test"; +import {test, expect, Page, Browser, ConsoleMessage} from "@playwright/test"; import {resetStack} from "./helpers"; import * as path from "path"; @@ -1374,4 +1377,66 @@ test.describe.serial("OpenSPP Starter SP-MIS", () => { await logout(page); console.log("✅ Admin logged out"); }); + + test("24 - backend test assets load without JavaScript module errors", async () => { + // Odoo's module loader (web/static/src/module_loader.js) logs these console + // errors when a module imports something no loaded file defines, e.g. an + // import path from an older Odoo version. The tour runner fails on any + // console error, so one bad import in web.assets_tests breaks every tour. + const moduleLoaderError = + /needed by other modules but have not been defined|failed to load because of an error|form a dependency cycle|have unmet dependencies/; + const loaderErrors: Promise[] = []; + const onConsole = (msg: ConsoleMessage) => { + if (msg.type() === "error" && moduleLoaderError.test(msg.text())) { + // The module names are in the array argument, not in msg.text(). + loaderErrors.push( + Promise.all(msg.args().map((arg) => arg.jsonValue())).then((args) => + JSON.stringify(args) + ) + ); + } + }; + // An uncaught exception from a test asset (a script that throws outside + // odoo.define) also fails the tour runner, without a loader message. + const pageErrors: string[] = []; + const onPageError = (error: Error) => { + pageErrors.push(error.message); + }; + + await login(page); + console.log("✅ Logged in as admin"); + + page.on("console", onConsole); + page.on("pageerror", onPageError); + try { + await page.goto("/odoo?debug=tests"); + await expect(page.locator(".o_main_navbar")).toBeVisible({timeout: 30_000}); + // Not "networkidle": the bus websocket worker request never finishes. + // Wait until the loader has defined a module from web.assets_tests and + // run its error check, which logs any errors synchronously. + await page.waitForFunction( + () => { + const loader = (window as any).odoo.loader; + return ( + loader.factories.has("@web/../tests/legacy/utils") && + loader.checkErrorProm === null + ); + }, + null, + {timeout: 30_000} + ); + + expect(await Promise.all(loaderErrors)).toEqual([]); + expect(pageErrors).toEqual([]); + // In debug mode the loader also injects this style as a red page banner. + await expect(page.locator("style.o_module_error_banner")).toHaveCount(0); + console.log("✅ Test assets loaded with no module loader errors"); + } finally { + page.off("console", onConsole); + page.off("pageerror", onPageError); + } + + await logout(page); + console.log("✅ Admin logged out"); + }); }); diff --git a/spp_cel_widget/README.rst b/spp_cel_widget/README.rst index 4c2faad66..807a9ad0c 100644 --- a/spp_cel_widget/README.rst +++ b/spp_cel_widget/README.rst @@ -154,6 +154,14 @@ Dependencies Changelog ========= +19.0.2.0.1 +~~~~~~~~~~ + +- fix: import the tours' stepUtils from the Odoo 19 path + @web_tour/tour_utils and drop the pre-18 ``test`` tour key that Odoo + 19 rejects, so web.assets_tests loads without module loader errors and + no longer fails every backend tour (#551) + 19.0.2.0.0 ~~~~~~~~~~ diff --git a/spp_cel_widget/__manifest__.py b/spp_cel_widget/__manifest__.py index 63cca8f6b..942a97853 100644 --- a/spp_cel_widget/__manifest__.py +++ b/spp_cel_widget/__manifest__.py @@ -1,6 +1,6 @@ { "name": "OpenSPP CEL Expression Widget", - "version": "19.0.2.0.0", + "version": "19.0.2.0.1", "category": "OpenSPP", "summary": "Reusable CEL expression editor with syntax highlighting and autocomplete", "author": "OpenSPP.org, OpenSPP", diff --git a/spp_cel_widget/readme/HISTORY.md b/spp_cel_widget/readme/HISTORY.md index 4aaf9afef..1acfa6e32 100644 --- a/spp_cel_widget/readme/HISTORY.md +++ b/spp_cel_widget/readme/HISTORY.md @@ -1,3 +1,9 @@ +### 19.0.2.0.1 + +- fix: import the tours' stepUtils from the Odoo 19 path @web_tour/tour_utils and drop the pre-18 + `test` tour key that Odoo 19 rejects, so web.assets_tests loads without module loader errors and + no longer fails every backend tour (#551) + ### 19.0.2.0.0 - Initial migration to OpenSPP2 diff --git a/spp_cel_widget/static/description/index.html b/spp_cel_widget/static/description/index.html index e7a4f20bd..27fd31aaa 100644 --- a/spp_cel_widget/static/description/index.html +++ b/spp_cel_widget/static/description/index.html @@ -532,6 +532,15 @@

Changelog

+

19.0.2.0.1

+ +
+

19.0.2.0.0