summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2020-04-09 12:50:23 +0000
committerJulien Mougenot <jum@odoo.com>2020-04-09 14:59:54 +0000
commited38c2adb85a7cb62fda4c2db21a3cad9d84a420 (patch)
tree786ddd5a4b87dbc21e0ae9ac42ec2868c793e2dd
parent26570b0701cf2d184b6f36bdd8885587f7939c9d (diff)
[FIX] web: flatten t-call-assets in test assets bundle
Before this commit, the test assets were called with a `t-call-assets` and contained themselves some other `t-call-assets` to the back-end assets. According to the current specification, having nested `t-call-assets` will result in a compilation of the lower levels regardless of the current debugging mode. Now, the test bundles (desktop & mobile) have been arranged so that their `t-call-assets` are all called on the same level. closes odoo/odoo#49306 Related: odoo/enterprise#9797 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
-rw-r--r--addons/im_support/views/assets.xml8
-rw-r--r--addons/mail/views/mail_templates.xml2
-rw-r--r--addons/partner_autocomplete/views/partner_autocomplete_assets.xml2
-rw-r--r--addons/web/views/webclient_templates.xml28
-rw-r--r--doc/reference/testing.rst19
5 files changed, 35 insertions, 24 deletions
diff --git a/addons/im_support/views/assets.xml b/addons/im_support/views/assets.xml
index 1025050ad64..7886ac6e2fc 100644
--- a/addons/im_support/views/assets.xml
+++ b/addons/im_support/views/assets.xml
@@ -39,7 +39,13 @@
support_origin: 'https://something.com'
};
</script>
- <t t-call="web.js_tests_assets"/>
+ <t t-call-assets="web.assets_common" t-js="false"/>
+ <t t-call-assets="web.assets_backend" t-js="false"/>
+ <t t-call-assets="web.assets_common" t-css="false"/>
+ <t t-call-assets="web.assets_backend" t-css="false"/>
+
+ <t t-call-assets="web.tests_assets" t-js="false"/>
+ <t t-call-assets="web.tests_assets" t-css="false"/>
<script type="text/javascript" src="/im_support/static/tests/helpers/test_utils.js"></script>
<script type="text/javascript" src="/im_support/static/tests/systray_tests.js"></script>
diff --git a/addons/mail/views/mail_templates.xml b/addons/mail/views/mail_templates.xml
index 195d8e2f799..9dfdf06f608 100644
--- a/addons/mail/views/mail_templates.xml
+++ b/addons/mail/views/mail_templates.xml
@@ -103,7 +103,7 @@
</xpath>
</template>
- <template id="js_test_assets" name="mail_js_test_assets" inherit_id="web.js_tests_assets">
+ <template id="tests_assets" name="mail_tests_assets" inherit_id="web.tests_assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/mail/static/tests/helpers/mock_server.js"></script>
<script type="text/javascript" src="/mail/static/tests/helpers/test_utils.js"></script>
diff --git a/addons/partner_autocomplete/views/partner_autocomplete_assets.xml b/addons/partner_autocomplete/views/partner_autocomplete_assets.xml
index 5007b43fc87..b0926acd144 100644
--- a/addons/partner_autocomplete/views/partner_autocomplete_assets.xml
+++ b/addons/partner_autocomplete/views/partner_autocomplete_assets.xml
@@ -9,7 +9,7 @@
</xpath>
</template>
- <template id="js_tests_assets" inherit_id="web.js_tests_assets">
+ <template id="tests_assets" inherit_id="web.tests_assets">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/partner_autocomplete/static/lib/jsvat.js"/>
</xpath>
diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml
index e76049ddc6b..0a208699b9b 100644
--- a/addons/web/views/webclient_templates.xml
+++ b/addons/web/views/webclient_templates.xml
@@ -591,16 +591,8 @@
</t>
</template>
- <template id="web.css_tests_assets">
+ <template id="web.tests_assets">
<link type="text/css" rel="stylesheet" href="/web/static/lib/daterangepicker/daterangepicker.css"/>
- </template>
-
- <template id="web.js_tests_assets">
- <t t-call-assets="web.assets_common" t-js="false"/>
- <t t-call-assets="web.assets_backend" t-js="false"/>
- <t t-call-assets="web.assets_common" t-css="false"/>
- <t t-call-assets="web.assets_backend" t-css="false"/>
-
<link type="text/css" rel="stylesheet" href="/web/static/lib/qunit/qunit-2.9.1.css"/>
<script type="text/javascript" src="/web/static/lib/qunit/qunit-2.9.1.js"></script>
<script type="text/javascript" src="/web/static/tests/helpers/qunit_config.js"></script>
@@ -670,6 +662,13 @@
<t t-set="html_data" t-value="{'style': 'height: 100%;'}"/>
<t t-set="title">Web Tests</t>
<t t-set="head">
+ <t t-call-assets="web.assets_common" t-js="false"/>
+ <t t-call-assets="web.assets_backend" t-js="false"/>
+ <t t-call-assets="web.assets_common" t-css="false"/>
+ <t t-call-assets="web.assets_backend" t-css="false"/>
+
+ <t t-call-assets="web.tests_assets" t-js="false"/>
+ <t t-call-assets="web.tests_assets" t-css="false"/>
<t t-call-assets="web.qunit_suite_tests" t-js="false"/>
<t t-call-assets="web.qunit_suite_tests" t-css="false"/>
</t>
@@ -679,9 +678,6 @@
</template>
<template id="web.qunit_suite_tests">
- <t t-call="web.css_tests_assets"/>
- <t t-call="web.js_tests_assets"/>
-
<script type="text/javascript" src="/base/static/tests/base_settings_tests.js"></script>
<script type="text/javascript" src="/web/static/tests/qweb_tests.js"></script>
@@ -773,6 +769,13 @@
<t t-set="title">Web Mobile Tests</t>
<t t-set="head">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
+ <t t-call-assets="web.assets_common" t-js="false"/>
+ <t t-call-assets="web.assets_backend" t-js="false"/>
+ <t t-call-assets="web.assets_common" t-css="false"/>
+ <t t-call-assets="web.assets_backend" t-css="false"/>
+
+ <t t-call-assets="web.tests_assets" t-js="false"/>
+ <t t-call-assets="web.tests_assets" t-css="false"/>
<t t-call-assets="web.qunit_mobile_suite_tests" t-js="false"/>
<t t-call-assets="web.qunit_mobile_suite_tests" t-css="false"/>
</t>
@@ -782,7 +785,6 @@
</template>
<template id="web.qunit_mobile_suite_tests">
- <t t-call="web.js_tests_assets"/>
<script type="text/javascript" src="/web/static/lib/jquery.touchSwipe/jquery.touchSwipe.js"></script>
<script type="text/javascript" src="/web/static/tests/fields/basic_fields_mobile_tests.js"></script>
<script type="text/javascript" src="/web/static/tests/fields/relational_fields_mobile_tests.js"></script>
diff --git a/doc/reference/testing.rst b/doc/reference/testing.rst
index db447e0f41a..55c229fd041 100644
--- a/doc/reference/testing.rst
+++ b/doc/reference/testing.rst
@@ -307,13 +307,15 @@ Testing Infrastructure
Here is a high level overview of the most important parts of the testing
infrastructure:
-- there is an asset bundle named `web.js_tests_assets`_. This bundle contains
+- there is an asset bundle named `web.qunit_suite`_. This bundle contains
the main code (assets common + assets backend), some libraries, the QUnit test
- runner, and some additional helper code
+ runner and the test bundles listed below.
-- another asset bundle, `web.qunit_suite`_, contains all the tests (and the
- js_tests_assets code). Almost all the test files should be added to this
- bundle
+- a bundle named `web.tests_assets`_ includes most of the assets and utils required
+ by the test suite: custom QUnit asserts, test helpers, lazy loaded assets, etc.
+
+- another asset bundle, `web.qunit_suite_tests`_, contains all the test scripts.
+ This is typically where the test files are added to the suite.
- there is a `controller`_ in web, mapped to the route */web/tests*. This controller
simply renders the *web.qunit_suite* template.
@@ -380,7 +382,7 @@ the following:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
- <template id="qunit_suite" name="my addon tests" inherit_id="web.qunit_suite">
+ <template id="qunit_suite_tests" name="my addon tests" inherit_id="web.qunit_suite_tests">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/my_addon/static/tests/utils_tests.js"/>
</xpath>
@@ -526,8 +528,9 @@ Two new command line arguments were added since Odoo 13.0 to control this behavi
.. _qunit: https://qunitjs.com/
.. _qunit_config.js: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/static/tests/helpers/qunit_config.js#L49
-.. _web.js_tests_assets: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/views/webclient_templates.xml#L427
-.. _web.qunit_suite: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/views/webclient_templates.xml#L509
+.. _web.tests_assets: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/views/webclient_templates.xml#L594
+.. _web.qunit_suite: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/views/webclient_templates.xml#L660
+.. _web.qunit_suite_tests: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/views/webclient_templates.xml#L680
.. _controller: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/controllers/main.py#L637
.. _test_js.py: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/tests/test_js.py#L13
.. _test_utils.js: https://github.com/odoo/odoo/blob/51ee0c3cb59810449a60dae0b086b49b1ed6f946/addons/web/static/tests/helpers/test_utils.js