diff --git a/addons/web/static/tests/helpers/test_env.js b/addons/web/static/tests/helpers/test_env.js index c0020ff8308..344fb48dda9 100644 --- a/addons/web/static/tests/helpers/test_env.js +++ b/addons/web/static/tests/helpers/test_env.js @@ -5,6 +5,8 @@ odoo.define('web.test_env', async function (require) { const { buildQuery } = require('web.rpc'); const session = require('web.session'); + let qweb; + /** * Creates a test environment with the given environment object. * Any access to a key that has not been explicitly defined in the given environment object @@ -15,6 +17,11 @@ odoo.define('web.test_env', async function (require) { * @returns {Proxy} */ function makeTestEnvironment(env = {}, providedRPC = null) { + if (!qweb) { + // avoid parsing templates at every test because it takes a lot of + // time and they never change + qweb = new owl.QWeb({ templates: session.owlTemplates }); + } const database = { parameters: { code: "en_US", @@ -40,7 +47,7 @@ odoo.define('web.test_env', async function (require) { bus: env.bus || new Bus(), device: Object.assign({ isMobile: false }, env.device), isDebug: env.isDebug || (() => false), - qweb: new owl.QWeb({ templates: session.owlTemplates }), + qweb, services: Object.assign({ ajax: { rpc() {