+1








0573acae23
This commit is the first phase of the conversion of the web/ JS codebase to the owl framework. The impact of this commit is two-fold. First, it rewrites the framework part of web with a new system of services and registries. Services allow to execute code (e.g. do rpcs, setup things) before launching the application. They can also expose an API to be used by other parts of the application (e.g. a notification service would expose a function to display notifications). Services are often a good extension point for external modules that want to execute code at webclient startup. Registries offer another way to extend the application. They provide well designed extension points to add elements/behaviors from the outside (for instance, to add a systray item, an error handler...). Second, this commit initiates the conversion of the webclient to owl with a top-down approach, around those notions of services and registries. The root of the web application is now an owl application. Among others, the WebClient, ActionManager, Navbar, UserMenu, DebugManager, Dialogs, services (e.g. notification, ajax...) have been converted to the new framework/architecture. Legacy views and client actions are still supported (and used). They will be converted in the next months, and at some point, the support will be dropped. Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Bruno Boi <boi@odoo.com> Co-authored-by: Géry Debongnie <ged@odoo.com> Co-authored-by: Samuel Degueldre <sad@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Simon Genin (ges) <ges@odoo.com> Co-authored-by: Francois (fge) <fge@odoo.com> Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import re
|
|
import odoo.tests
|
|
|
|
RE_ONLY = re.compile(r'QUnit\.(only|debug)\(')
|
|
|
|
|
|
@odoo.tests.tagged('post_install', '-at_install')
|
|
class WebSuite(odoo.tests.HttpCase):
|
|
|
|
def test_js(self):
|
|
# webclient desktop test suite
|
|
self.browser_js('/web/tests?mod=web&failfast', "", "", login='admin', timeout=1800)
|
|
|
|
def test_check_suite(self):
|
|
# verify no js test is using `QUnit.only` as it forbid any other test to be executed
|
|
self._check_only_call('web.qunit_suite_tests')
|
|
self._check_only_call('web.qunit_mobile_suite_tests')
|
|
|
|
def _check_only_call(self, suite):
|
|
# As we currently aren't in a request context, we can't render `web.layout`.
|
|
# redefinied it as a minimal proxy template.
|
|
self.env.ref('web.layout').write({'arch_db': '<t t-name="web.layout"><head><meta charset="utf-8"/><t t-esc="head"/></head></t>'})
|
|
|
|
assets = self.env['ir.qweb']._get_asset_content(suite, options={})[0]
|
|
if len(assets) == 0:
|
|
self.fail("No assets found in the given test suite")
|
|
|
|
for asset in assets:
|
|
filename = asset['filename']
|
|
if not filename or asset['atype'] != 'text/javascript':
|
|
continue
|
|
with open(filename, 'rb') as fp:
|
|
if RE_ONLY.search(fp.read().decode('utf-8')):
|
|
self.fail("`QUnit.only()` or `QUnit.debug()` used in file %r" % asset['url'])
|
|
|
|
|
|
@odoo.tests.tagged('post_install', '-at_install')
|
|
class MobileWebSuite(odoo.tests.HttpCase):
|
|
browser_size = '375x667'
|
|
|
|
def test_mobile_js(self):
|
|
# webclient mobile test suite
|
|
self.browser_js('/web/tests/mobile?mod=web&failfast', "", "", login='admin', timeout=1800)
|