agent_ticket_actions_level2_test.rb 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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.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 .ticket-zoom small',
  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 => 1,
  70. },
  71. {
  72. :where => :instance2,
  73. :execute => 'js',
  74. :value => '$("#global-search").val("")',
  75. },
  76. {
  77. :where => :instance2,
  78. :execute => 'js',
  79. :value => '$("#global-search").focus()',
  80. },
  81. {
  82. :execute => 'wait',
  83. :value => 1,
  84. },
  85. {
  86. :where => :instance2,
  87. :execute => 'js',
  88. :value => '$("#global-search").blur()',
  89. },
  90. {
  91. :where => :instance2,
  92. :execute => 'js',
  93. :value => '$("#global-search").parent().parent().removeClass("open")',
  94. },
  95. {
  96. :execute => 'wait',
  97. :value => 3,
  98. },
  99. {
  100. :where => :instance2,
  101. :execute => 'match',
  102. :css => '.active div.article',
  103. :value => 'some level 2 <b>body</b> 123äöü',
  104. :match_result => true,
  105. },
  106. # change title in second browser
  107. # {
  108. # :where => :instance2,
  109. # :execute => 'sendkey',
  110. # :css => '.active .ticket-title-update',
  111. # :value => 'TTT',
  112. # },
  113. # {
  114. # :where => :instance2,
  115. # :execute => 'sendkey',
  116. # :css => '.active .ticket-title-update',
  117. # :value => :tab,
  118. # },
  119. {
  120. :where => :instance2,
  121. :execute => 'js',
  122. :value => '$(".active .ticket-title .ticket-title-update").focus()',
  123. },
  124. {
  125. :where => :instance2,
  126. :execute => 'js',
  127. :value => '$(".active .ticket-title .ticket-title-update").html("TTTsome level 2 &lt;b&gt;subject&lt;/b&gt; 123äöü")',
  128. },
  129. {
  130. :where => :instance2,
  131. :execute => 'js',
  132. :value => '$(".active .ticket-title .ticket-title-update").blur()',
  133. },
  134. {
  135. :where => :instance2,
  136. :execute => 'js',
  137. :value => '$(".active .ticket-title .ticket-title-update").trigger("blur")',
  138. },
  139. {
  140. :execute => 'wait',
  141. :value => 5,
  142. },
  143. # set body in edit area
  144. {
  145. :where => :instance2,
  146. :execute => 'set',
  147. :css => '.active .ticket-answer textarea[name="body"]',
  148. :value => 'some level 2 <b>body</b> in instance 2',
  149. },
  150. {
  151. :where => :instance1,
  152. :execute => 'set',
  153. :css => '.active .ticket-answer textarea[name="body"]',
  154. :value => 'some level 2 <b>body</b> in instance 1',
  155. },
  156. # change task and page title in second browser
  157. {
  158. :where => :instance2,
  159. :execute => 'match',
  160. :css => '.taskbar .active .task',
  161. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  162. :match_result => true,
  163. },
  164. {
  165. :where => :instance2,
  166. :element => :title,
  167. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  168. },
  169. # change task and page title in first browser
  170. {
  171. :execute => 'wait',
  172. :value => 10,
  173. },
  174. {
  175. :where => :instance1,
  176. :execute => 'match',
  177. :css => '.active .ticket-title-update',
  178. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  179. :match_result => true,
  180. },
  181. {
  182. :where => :instance2,
  183. :execute => 'match',
  184. :css => '.taskbar .active .task',
  185. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  186. :match_result => true,
  187. },
  188. {
  189. :where => :instance1,
  190. :element => :title,
  191. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  192. },
  193. {
  194. :where => :instance2,
  195. :element => :title,
  196. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  197. },
  198. # verify text in input body
  199. {
  200. :where => :instance1,
  201. :execute => 'match',
  202. :css => '.active .ticket-answer textarea[name="body"]',
  203. :value => 'some level 2 <b>body</b> in instance 1',
  204. :match_result => true,
  205. },
  206. {
  207. :where => :instance2,
  208. :execute => 'match',
  209. :css => '.active .ticket-answer textarea[name="body"]',
  210. :value => 'some level 2 <b>body</b> in instance 2',
  211. :match_result => true,
  212. },
  213. # add new article
  214. {
  215. :where => :instance1,
  216. :execute => 'select',
  217. :css => '.active .ticket-answer select[name="ticket_article_type_id"]',
  218. :value => 'note',
  219. },
  220. {
  221. :where => :instance1,
  222. :execute => 'set',
  223. :css => '.active .ticket-answer textarea[name="body"]',
  224. :value => 'some update 4711',
  225. },
  226. {
  227. :where => :instance1,
  228. :execute => 'click',
  229. :css => '.active button',
  230. },
  231. {
  232. :where => :instance1,
  233. :execute => 'watch_for',
  234. :area => 'body',
  235. :value => 'some update 4711',
  236. },
  237. # verify empty text in input body
  238. {
  239. :where => :instance1,
  240. :execute => 'match',
  241. :css => '.active .ticket-answer textarea[name="body"]',
  242. :value => '',
  243. :match_result => true,
  244. },
  245. {
  246. :where => :instance2,
  247. :execute => 'match',
  248. :css => '.active .ticket-answer textarea[name="body"]',
  249. :value => 'some level 2 <b>body</b> in instance 2',
  250. :match_result => true,
  251. },
  252. # reload instances, verify again
  253. {
  254. :where => :instance1,
  255. :execute => 'reload',
  256. },
  257. {
  258. :where => :instance2,
  259. :execute => 'reload',
  260. },
  261. # wait till application become ready
  262. {
  263. :execute => 'wait',
  264. :value => 8,
  265. },
  266. {
  267. :where => :instance1,
  268. :execute => 'match',
  269. :css => '.active .ticket-title-update',
  270. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  271. :match_result => true,
  272. },
  273. {
  274. :where => :instance2,
  275. :execute => 'match',
  276. :css => '.taskbar .active .task',
  277. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  278. :match_result => true,
  279. },
  280. {
  281. :where => :instance1,
  282. :element => :title,
  283. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  284. },
  285. {
  286. :where => :instance2,
  287. :element => :title,
  288. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  289. },
  290. # verify update
  291. {
  292. :where => :instance1,
  293. :execute => 'match',
  294. :css => 'body',
  295. :value => 'some update 4711',
  296. :match_result => true,
  297. },
  298. {
  299. :where => :instance2,
  300. :execute => 'match',
  301. :css => 'body',
  302. :value => 'some update 4711',
  303. :match_result => true,
  304. },
  305. # verify empty text in input body
  306. {
  307. :where => :instance1,
  308. :execute => 'match',
  309. :css => '.active .ticket-answer textarea[name="body"]',
  310. :value => '',
  311. :match_result => true,
  312. },
  313. {
  314. :where => :instance2,
  315. :execute => 'match',
  316. :css => '.active .ticket-answer textarea[name="body"]',
  317. :value => 'some level 2 <b>body</b> in instance 2',
  318. :match_result => true,
  319. },
  320. ],
  321. },
  322. ]
  323. browser_double_test(tests)
  324. end
  325. end