agent_ticket_actions_level2_test.rb 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketActionsLevel2Test < TestCase
  4. def test_work_with_two_browser_on_same_ticket
  5. message = 'message 1äöüß ' + rand(99999999999999999).to_s
  6. tests = [
  7. {
  8. :name => 'start',
  9. :instance1 => browser_instance,
  10. :instance2 => browser_instance,
  11. :instance1_username => 'master@example.com',
  12. :instance1_password => 'test',
  13. :instance2_username => 'agent1@example.com',
  14. :instance2_password => 'test',
  15. :url => browser_url,
  16. :action => [
  17. {
  18. :where => :instance1,
  19. :execute => 'close_all_tasks',
  20. },
  21. {
  22. :where => :instance2,
  23. :execute => 'close_all_tasks',
  24. },
  25. # create ticket
  26. {
  27. :where => :instance1,
  28. :execute => 'create_ticket',
  29. :group => 'Users',
  30. :subject => 'some level 2 <b>subject</b> 123äöü',
  31. :body => 'some level 2 <b>body</b> 123äöü',
  32. },
  33. # check ticket
  34. {
  35. :where => :instance1,
  36. :execute => 'match',
  37. :css => '.active div.ticket-article',
  38. :value => 'some level 2 <b>body</b> 123äöü',
  39. :match_result => true,
  40. },
  41. # remember old ticket where we want to merge to
  42. {
  43. :where => :instance1,
  44. :execute => 'match',
  45. :css => '.active .page-header .ticket-number',
  46. :value => '^(.*)$',
  47. :no_quote => true,
  48. :match_result => true,
  49. },
  50. # open ticket in second browser
  51. {
  52. :where => :instance2,
  53. :execute => 'set',
  54. :css => '#global-search',
  55. :value => '###stack###',
  56. },
  57. {
  58. :execute => 'wait',
  59. :value => 3,
  60. },
  61. {
  62. :where => :instance2,
  63. :execute => 'click',
  64. :link => '###stack###',
  65. # :css => 'a:contains(\'###stack###\')',
  66. },
  67. {
  68. :execute => 'wait',
  69. :value => 3,
  70. },
  71. {
  72. :where => :instance2,
  73. :execute => 'match',
  74. :css => '.active div.ticket-article',
  75. :value => 'some level 2 <b>body</b> 123äöü',
  76. :match_result => true,
  77. },
  78. # change title in second browser
  79. {
  80. :where => :instance2,
  81. :execute => 'set_ticket_attributes',
  82. :title => 'TTTsome level 2 <b>subject</b> 123äöü',
  83. },
  84. # set body in edit area
  85. {
  86. :where => :instance2,
  87. :execute => 'set_ticket_attributes',
  88. :body => 'some level 2 <b>body</b> in instance 2',
  89. },
  90. {
  91. :where => :instance1,
  92. :execute => 'set_ticket_attributes',
  93. :body => 'some level 2 <b>body</b> in instance 1',
  94. },
  95. # change task and page title in second browser
  96. {
  97. :where => :instance2,
  98. :execute => 'verify_task_attributes',
  99. :title => 'TTTsome level 2 <b>subject</b> 123äöü',
  100. },
  101. {
  102. :where => :instance2,
  103. :element => :title,
  104. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  105. },
  106. # change task and page title in first browser
  107. {
  108. :execute => 'wait',
  109. :value => 10,
  110. },
  111. {
  112. :where => :instance1,
  113. :execute => 'verify_ticket_attributes',
  114. :title => 'TTTsome level 2 <b>subject</b> 123äöü',
  115. },
  116. {
  117. :where => :instance2,
  118. :execute => 'verify_task_attributes',
  119. :title => 'TTTsome level 2 <b>subject</b> 123äöü',
  120. },
  121. {
  122. :where => :instance1,
  123. :element => :title,
  124. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  125. },
  126. {
  127. :where => :instance2,
  128. :element => :title,
  129. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  130. },
  131. # verify text in input body
  132. {
  133. :where => :instance1,
  134. :execute => 'verify_ticket_attributes',
  135. :body => 'some level 2 <b>body</b> in instance 1',
  136. },
  137. {
  138. :where => :instance2,
  139. :execute => 'verify_ticket_attributes',
  140. :body => 'some level 2 <b>body</b> in instance 2',
  141. },
  142. # add new article
  143. #{
  144. # :where => :instance1,
  145. # :execute => 'select',
  146. # :css => '.active .ticket-edit select[name="type_id"]',
  147. # :value => 'note',
  148. #},
  149. {
  150. :where => :instance1,
  151. :execute => 'set_ticket_attributes',
  152. :body => 'some update 4711',
  153. },
  154. {
  155. :where => :instance1,
  156. :execute => 'click',
  157. :css => '.content.active button.js-submit',
  158. },
  159. {
  160. :where => :instance1,
  161. :execute => 'watch_for',
  162. :area => 'body',
  163. :value => 'some update 4711',
  164. },
  165. # verify empty text in input body
  166. {
  167. :where => :instance1,
  168. :execute => 'verify_ticket_attributes',
  169. :body => '',
  170. },
  171. {
  172. :where => :instance2,
  173. :execute => 'verify_ticket_attributes',
  174. :body => 'some level 2 <b>body</b> in instance 2',
  175. },
  176. # reload instances, verify again
  177. {
  178. :where => :instance1,
  179. :execute => 'reload',
  180. },
  181. {
  182. :where => :instance2,
  183. :execute => 'reload',
  184. },
  185. # wait till application become ready
  186. {
  187. :execute => 'wait',
  188. :value => 8,
  189. },
  190. {
  191. :where => :instance1,
  192. :execute => 'verify_ticket_attributes',
  193. :title => 'TTTsome level 2 <b>subject</b> 123äöü',
  194. },
  195. {
  196. :where => :instance2,
  197. :execute => 'verify_task_attributes',
  198. :title => 'TTTsome level 2 <b>subject</b> 123äöü',
  199. },
  200. {
  201. :where => :instance1,
  202. :element => :title,
  203. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  204. },
  205. {
  206. :where => :instance2,
  207. :element => :title,
  208. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  209. },
  210. # verify update
  211. {
  212. :where => :instance1,
  213. :execute => 'match',
  214. :css => 'body',
  215. :value => 'some update 4711',
  216. :match_result => true,
  217. },
  218. {
  219. :where => :instance2,
  220. :execute => 'match',
  221. :css => 'body',
  222. :value => 'some update 4711',
  223. :match_result => true,
  224. },
  225. # verify empty text in input body
  226. {
  227. :where => :instance1,
  228. :execute => 'verify_ticket_attributes',
  229. :body => '',
  230. },
  231. {
  232. :where => :instance2,
  233. :execute => 'verify_ticket_attributes',
  234. :body => 'some level 2 <b>body</b> in instance 2',
  235. },
  236. ],
  237. },
  238. ]
  239. browser_double_test(tests)
  240. end
  241. end