maintenance_session_message_test.rb 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class MaintenanceSessionMessageTest < TestCase
  4. def test_message
  5. string = rand(99_999_999_999_999_999).to_s
  6. title_html = "test <b>#{string}</b>"
  7. title_text = "test <b>#{string}<\/b>"
  8. message_html = "message <b>1äöüß</b> #{string}\n\n\nhttps://zammad.org"
  9. message_text = "message <b>1äöüß</b> #{string}\n\n\nhttps://zammad.org"
  10. # check #1
  11. browser1 = browser_instance
  12. login(
  13. browser: browser1,
  14. username: 'master@example.com',
  15. password: 'test',
  16. url: browser_url,
  17. )
  18. browser2 = browser_instance
  19. login(
  20. browser: browser2,
  21. username: 'agent1@example.com',
  22. password: 'test',
  23. url: browser_url,
  24. )
  25. click(
  26. browser: browser1,
  27. css: 'a[href="#manage"]',
  28. )
  29. click(
  30. browser: browser1,
  31. css: 'a[href="#system/maintenance"]',
  32. )
  33. set(
  34. browser: browser1,
  35. css: '.content.active .js-Message input[name="head"]',
  36. value: title_html,
  37. )
  38. set(
  39. browser: browser1,
  40. css: '.content.active .js-Message .js-textarea[data-name="message"]',
  41. value: message_html,
  42. )
  43. click(
  44. browser: browser1,
  45. css: '.content.active .js-Message button.js-submit',
  46. )
  47. watch_for(
  48. browser: browser2,
  49. css: '.modal',
  50. value: title_text,
  51. )
  52. watch_for(
  53. browser: browser2,
  54. css: '.modal',
  55. value: message_text,
  56. )
  57. match_not(
  58. browser: browser1,
  59. css: 'body',
  60. value: message_text,
  61. )
  62. click(
  63. browser: browser2,
  64. css: 'div.modal-header .js-close',
  65. )
  66. # check #2
  67. click(
  68. browser: browser1,
  69. css: 'a[href="#manage"]',
  70. )
  71. click(
  72. browser: browser1,
  73. css: 'a[href="#system/maintenance"]',
  74. )
  75. set(
  76. browser: browser1,
  77. css: '.content.active .js-Message input[name="head"]',
  78. value: title_html + ' #2',
  79. )
  80. set(
  81. browser: browser1,
  82. css: '.content.active .js-Message .js-textarea[data-name="message"]',
  83. value: message_html + ' #2',
  84. )
  85. click(
  86. browser: browser1,
  87. css: '.content.active .js-Message button.js-submit',
  88. )
  89. watch_for(
  90. browser: browser2,
  91. css: '.modal',
  92. value: title_text + ' #2',
  93. )
  94. watch_for(
  95. browser: browser2,
  96. css: '.modal',
  97. value: message_text + ' #2',
  98. )
  99. match_not(
  100. browser: browser1,
  101. css: 'body',
  102. value: message_text,
  103. )
  104. click(
  105. browser: browser2,
  106. css: 'div.modal-header .js-close',
  107. )
  108. # check #3
  109. click(
  110. browser: browser1,
  111. css: 'a[href="#manage"]',
  112. )
  113. click(
  114. browser: browser1,
  115. css: 'a[href="#system/maintenance"]',
  116. )
  117. set(
  118. browser: browser1,
  119. css: '.content.active .js-Message input[name="head"]',
  120. value: title_html + ' #3',
  121. )
  122. set(
  123. browser: browser1,
  124. css: '.content.active .js-Message .js-textarea[data-name="message"]',
  125. value: message_html + ' #3',
  126. )
  127. click(
  128. browser: browser1,
  129. css: '.content.active .js-Message input[name="reload"] + .icon-checkbox.icon-unchecked',
  130. )
  131. click(
  132. browser: browser1,
  133. css: '.content.active .js-Message button.js-submit',
  134. )
  135. watch_for(
  136. browser: browser2,
  137. css: '.modal',
  138. value: title_text + ' #3',
  139. )
  140. watch_for(
  141. browser: browser2,
  142. css: '.modal',
  143. value: message_text + ' #3',
  144. )
  145. watch_for(
  146. browser: browser2,
  147. css: '.modal',
  148. value: 'Continue session',
  149. )
  150. match_not(
  151. browser: browser1,
  152. css: 'body',
  153. value: message_text,
  154. )
  155. end
  156. end