summaryrefslogtreecommitdiff
path: root/addons/website_livechat/controllers
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2019-11-06 16:27:36 +0000
committerDavid Beguin <dbe@odoo.com>2020-03-17 12:21:48 +0000
commit190dab8144b5dd46bb2492093d0d8d3abafb19b4 (patch)
tree9c1b6cbeb5d54ba170ab50042d1be967303ff3a6 /addons/website_livechat/controllers
parent69b1e1a05228f05b4cd5f2934167260e51101dce (diff)
[IMP] website_livechat : add various tests on livechat and visitors
Adds Python tests and javascripts tours on livechat (website and visitor integration). Because breaking livechat every two days in rush periods (or even not) is getting quite annoying. Those tests are testing : - The client side flow (open livechat, send messages, send rating and close the livechat session) - The channel and message author naming, visitor page view history - Chat request flow (complete chat request flow, open empty operator's chat request and cancel due to visitor's new chat session) Task ID : 2079087 PR #40052 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website_livechat/controllers')
-rw-r--r--addons/website_livechat/controllers/__init__.py1
-rw-r--r--addons/website_livechat/controllers/test.py19
2 files changed, 20 insertions, 0 deletions
diff --git a/addons/website_livechat/controllers/__init__.py b/addons/website_livechat/controllers/__init__.py
index 757b12a1f17..29bc11c7183 100644
--- a/addons/website_livechat/controllers/__init__.py
+++ b/addons/website_livechat/controllers/__init__.py
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from . import main
+from . import test
diff --git a/addons/website_livechat/controllers/test.py b/addons/website_livechat/controllers/test.py
new file mode 100644
index 00000000000..0ecabd66690
--- /dev/null
+++ b/addons/website_livechat/controllers/test.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo.http import Controller, request, route
+
+
+class TestBusController(Controller):
+ """
+ This controller is only useful for test purpose. Bus is unavailable in test mode, but there is no way to know,
+ at client side, if we are running in test mode or not. This route can be called while running tours to mock
+ some behaviour in function of the test mode status (activated or not).
+
+ E.g. : To test the livechat and to check there is no duplicates in message displayed in the chatter,
+ in test mode, we need to mock a 'message added' notification that is normally triggered by the bus.
+ In Normal mode, the bus triggers itself the notification.
+ """
+ @route('/bus/test_mode_activated', type="json", auth="public")
+ def is_test_mode_activated(self):
+ return request.registry.in_test_mode()