[IMP] web_editor: add route for Odoo Editor tests

Loading assets for Odoo Editor's tests was a problematic matter since
some were in the lib folder while others were in src. This solves that
issue by finally creating a route for these tests, like web has one for
QUnit tests.

Part-of: odoo/odoo#94516
This commit is contained in:
Antoine Guenet
2022-07-04 18:53:07 +02:00
parent 62590e7c60
commit ae7110f44e
3 changed files with 32 additions and 1 deletions
+4
View File
@@ -723,3 +723,7 @@ class Web_Editor(http.Controller):
channel = (request.db, 'editor_collaboration', model_name, field_name, int(res_id))
bus_data.update({'model_name': model_name, 'field_name': field_name, 'res_id': res_id})
request.env['bus.bus']._sendone(channel, 'editor_collaboration', bus_data)
@http.route('/web_editor/tests', type='http', auth="user")
def test_suite(self, mod=None, **kwargs):
return request.render('web_editor.tests')
+1 -1
View File
@@ -7,4 +7,4 @@ import odoo.tests
class TestOdooEditor(odoo.tests.HttpCase):
def test_odoo_editor_suite(self):
self.browser_js('/web_editor/static/src/js/editor/odoo-editor/test/editor-test.html', "", "", timeout=1800)
self.browser_js('/web_editor/tests', "", "", login='admin', timeout=1800)
+27
View File
@@ -168,4 +168,31 @@
</div>
</colorpicker>
</template>
<template id="web_editor.tests">
<t t-call="web.layout">
<t t-set="title">Odoo Editor Tests</t>
<t t-set="head">
<link rel="stylesheet" href="/web_editor/static/src/js/editor/odoo-editor/src/base_style.css"/>
<link rel="stylesheet" href="/web_editor/static/src/js/editor/odoo-editor/src/checklist.css"/>
<link rel="stylesheet" href="/web_editor/static/src/js/editor/odoo-editor/test/lib/mocha.css"/>
<style type="text/css">
b.zws {
background-color: #c00;
color: white;
border-radius: 3px;
padding: 1px 3px;
font-size: 8px;
vertical-align: middle;
}
</style>
<script src="/web_editor/static/lib/DOMPurify.js"></script>
<script src="/web_editor/static/src/js/editor/odoo-editor/test/lib/mocha.js"></script>
<script src="/web_editor/static/src/js/editor/odoo-editor/test/lib/chai.js"></script>
<script>mocha.setup('bdd').fullTrace()</script>
<script src="/web_editor/static/src/js/editor/odoo-editor/test/editor-test.js" type="module"></script>
</t>
<div id="mocha"></div>
<div id="editor-test-container"></div>
</t>
</template>
</odoo>