website_livechat_request.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. odoo.define('website_livechat.chat_request_tour', function(require) {
  2. 'use strict';
  3. var commonSteps = require("website_livechat.tour_common");
  4. var tour = require("web_tour.tour");
  5. var stepWithChatRequestStep = [{
  6. content: "Answer the chat request!",
  7. trigger: "input.o_composer_text_field",
  8. run: "text Hi ! What a coincidence! I need your help indeed."
  9. }, {
  10. content: "Send the message",
  11. trigger: "input.o_composer_text_field",
  12. run: function() {
  13. $('input.o_composer_text_field').trigger($.Event('keydown', {which: $.ui.keyCode.ENTER}));
  14. }
  15. }, {
  16. content: "Verify your message has been typed",
  17. trigger: "div.o_thread_message_content>p:contains('Hi ! What a coincidence! I need your help indeed.')"
  18. }, {
  19. content: "Verify there is no duplicates",
  20. trigger: "body",
  21. run: function () {
  22. if ($("div.o_thread_message_content p:contains('Hi ! What a coincidence! I need your help indeed.')").length === 1) {
  23. $('body').addClass('no_duplicated_message');
  24. }
  25. }
  26. }, {
  27. content: "Is your message correctly sent ?",
  28. trigger: 'body.no_duplicated_message'
  29. }];
  30. tour.register('website_livechat_chat_request_part_1_no_close_tour', {
  31. test: true,
  32. url: '/',
  33. }, [].concat(stepWithChatRequestStep));
  34. tour.register('website_livechat_chat_request_part_2_end_session_tour', {
  35. test: true,
  36. url: '/',
  37. }, [].concat(commonSteps.endDiscussionStep, commonSteps.okRatingStep, commonSteps.feedbackStep, commonSteps.transcriptStep, commonSteps.closeStep));
  38. return {};
  39. });