summaryrefslogtreecommitdiff
path: root/addons/website_livechat/static/tests/tours/website_livechat_request.js
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/static/tests/tours/website_livechat_request.js
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/static/tests/tours/website_livechat_request.js')
-rw-r--r--addons/website_livechat/static/tests/tours/website_livechat_request.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/addons/website_livechat/static/tests/tours/website_livechat_request.js b/addons/website_livechat/static/tests/tours/website_livechat_request.js
new file mode 100644
index 00000000000..8c4042e3821
--- /dev/null
+++ b/addons/website_livechat/static/tests/tours/website_livechat_request.js
@@ -0,0 +1,46 @@
+odoo.define('website_livechat.chat_request_tour', function(require) {
+'use strict';
+
+var commonSteps = require("website_livechat.tour_common");
+var tour = require("web_tour.tour");
+
+
+var stepWithChatRequestStep = [{
+ content: "Answer the chat request!",
+ trigger: "input.o_composer_text_field",
+ run: "text Hi ! What a coincidence! I need your help indeed."
+}, {
+ content: "Send the message",
+ trigger: "input.o_composer_text_field",
+ run: function() {
+ $('input.o_composer_text_field').trigger($.Event('keydown', {which: $.ui.keyCode.ENTER}));
+ }
+}, {
+ content: "Verify your message has been typed",
+ trigger: "div.o_thread_message_content>p:contains('Hi ! What a coincidence! I need your help indeed.')"
+}, {
+ content: "Verify there is no duplicates",
+ trigger: "body",
+ run: function () {
+ if ($("div.o_thread_message_content p:contains('Hi ! What a coincidence! I need your help indeed.')").length === 1) {
+ $('body').addClass('no_duplicated_message');
+ }
+ }
+}, {
+ content: "Is your message correctly sent ?",
+ trigger: 'body.no_duplicated_message'
+}];
+
+
+tour.register('website_livechat_chat_request_part_1_no_close_tour', {
+ test: true,
+ url: '/',
+}, [].concat(stepWithChatRequestStep));
+
+tour.register('website_livechat_chat_request_part_2_end_session_tour', {
+ test: true,
+ url: '/',
+}, [].concat(commonSteps.endDiscussionStep, commonSteps.okRatingStep, commonSteps.feedbackStep, commonSteps.transcriptStep, commonSteps.closeStep));
+
+return {};
+});