agent_ticket_actions_level2_test.rb 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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 => 'check',
  20. :css => '#login',
  21. :result => false,
  22. },
  23. {
  24. :where => :instance2,
  25. :execute => 'check',
  26. :css => '#login',
  27. :result => false,
  28. },
  29. {
  30. :execute => 'wait',
  31. :value => 1,
  32. },
  33. {
  34. :where => :instance1,
  35. :execute => 'close_all_tasks',
  36. },
  37. {
  38. :where => :instance2,
  39. :execute => 'close_all_tasks',
  40. },
  41. # create ticket
  42. {
  43. :where => :instance1,
  44. :execute => 'click',
  45. :css => 'a[href="#new"]',
  46. },
  47. {
  48. :where => :instance1,
  49. :execute => 'click',
  50. :css => 'a[href="#ticket_create/call_inbound"]',
  51. },
  52. {
  53. :execute => 'wait',
  54. :value => 5,
  55. },
  56. {
  57. :where => :instance1,
  58. :execute => 'check',
  59. :css => '.active .ticket_create',
  60. :result => true,
  61. },
  62. {
  63. :execute => 'wait',
  64. :value => 1,
  65. },
  66. {
  67. :where => :instance1,
  68. :execute => 'set',
  69. :css => '.active .ticket_create input[name="customer_id_autocompletion"]',
  70. :value => 'ma',
  71. },
  72. {
  73. :execute => 'wait',
  74. :value => 4,
  75. },
  76. {
  77. :where => :instance1,
  78. :execute => 'sendkey',
  79. :css => '.active .ticket_create input[name="customer_id_autocompletion"]',
  80. :value => :arrow_down,
  81. },
  82. {
  83. :where => :instance1,
  84. :execute => 'sendkey',
  85. :css => '.active .ticket_create input[name="customer_id_autocompletion"]',
  86. :value => :tab,
  87. },
  88. {
  89. :where => :instance1,
  90. :execute => 'select',
  91. :css => '.active .ticket_create select[name="group_id"]',
  92. :value => 'Users',
  93. },
  94. {
  95. :where => :instance1,
  96. :execute => 'set',
  97. :css => '.active .ticket_create input[name="subject"]',
  98. :value => 'some level 2 <b>subject</b> 123äöü',
  99. },
  100. {
  101. :where => :instance1,
  102. :execute => 'set',
  103. :css => '.active .ticket_create textarea[name="body"]',
  104. :value => 'some level 2 <b>body</b> 123äöü',
  105. },
  106. {
  107. :where => :instance1,
  108. :execute => 'click',
  109. :css => '.active .form-actions button[type="submit"]',
  110. },
  111. {
  112. :execute => 'wait',
  113. :value => 5,
  114. },
  115. {
  116. :where => :instance1,
  117. :execute => 'check',
  118. :css => '#login',
  119. :result => false,
  120. },
  121. {
  122. :where => :instance1,
  123. :execute => 'check',
  124. :element => :url,
  125. :result => '#ticket/zoom/',
  126. },
  127. # check ticket
  128. {
  129. :where => :instance1,
  130. :execute => 'match',
  131. :css => '.active div.article',
  132. :value => 'some level 2 <b>body</b> 123äöü',
  133. :match_result => true,
  134. },
  135. # remember old ticket where we want to merge to
  136. {
  137. :where => :instance1,
  138. :execute => 'match',
  139. :css => '.active .ticket-zoom small',
  140. :value => '^(.*)$',
  141. :no_quote => true,
  142. :match_result => true,
  143. },
  144. # open ticket in second browser
  145. {
  146. :where => :instance2,
  147. :execute => 'set',
  148. :css => '#global-search',
  149. :value => '###stack###',
  150. },
  151. {
  152. :execute => 'wait',
  153. :value => 3,
  154. },
  155. {
  156. :where => :instance2,
  157. :execute => 'click',
  158. :link => '###stack###',
  159. # :css => 'a:contains(\'###stack###\')',
  160. },
  161. {
  162. :execute => 'wait',
  163. :value => 1,
  164. },
  165. {
  166. :where => :instance2,
  167. :execute => 'js',
  168. :value => '$("#global-search").val("")',
  169. },
  170. {
  171. :where => :instance2,
  172. :execute => 'js',
  173. :value => '$("#global-search").focus()',
  174. },
  175. {
  176. :execute => 'wait',
  177. :value => 1,
  178. },
  179. {
  180. :where => :instance2,
  181. :execute => 'js',
  182. :value => '$("#global-search").blur()',
  183. },
  184. {
  185. :where => :instance2,
  186. :execute => 'js',
  187. :value => '$("#global-search").parent().parent().removeClass("open")',
  188. },
  189. {
  190. :execute => 'wait',
  191. :value => 3,
  192. },
  193. {
  194. :where => :instance2,
  195. :execute => 'match',
  196. :css => '.active div.article',
  197. :value => 'some level 2 <b>body</b> 123äöü',
  198. :match_result => true,
  199. },
  200. # change title in second browser
  201. # {
  202. # :where => :instance2,
  203. # :execute => 'sendkey',
  204. # :css => '.active .ticket-title-update',
  205. # :value => 'TTT',
  206. # },
  207. # {
  208. # :where => :instance2,
  209. # :execute => 'sendkey',
  210. # :css => '.active .ticket-title-update',
  211. # :value => :tab,
  212. # },
  213. {
  214. :where => :instance2,
  215. :execute => 'js',
  216. :value => '$(".active .ticket-title .ticket-title-update").focus()',
  217. },
  218. {
  219. :where => :instance2,
  220. :execute => 'js',
  221. :value => '$(".active .ticket-title .ticket-title-update").html("TTTsome level 2 &lt;b&gt;subject&lt;/b&gt; 123äöü")',
  222. },
  223. {
  224. :where => :instance2,
  225. :execute => 'js',
  226. :value => '$(".active .ticket-title .ticket-title-update").blur()',
  227. },
  228. {
  229. :execute => 'wait',
  230. :value => 1,
  231. },
  232. # set body in edit area
  233. {
  234. :where => :instance2,
  235. :execute => 'set',
  236. :css => '.active .ticket-answer textarea[name="body"]',
  237. :value => 'some level 2 <b>body</b> in instance 2',
  238. },
  239. {
  240. :where => :instance1,
  241. :execute => 'set',
  242. :css => '.active .ticket-answer textarea[name="body"]',
  243. :value => 'some level 2 <b>body</b> in instance 1',
  244. },
  245. # change task and page title in second browser
  246. {
  247. :where => :instance2,
  248. :execute => 'match',
  249. :css => '.taskbar .active .task',
  250. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  251. :match_result => true,
  252. },
  253. {
  254. :where => :instance2,
  255. :element => :title,
  256. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  257. },
  258. # change task and page title in first browser
  259. {
  260. :execute => 'wait',
  261. :value => 10,
  262. },
  263. {
  264. :where => :instance1,
  265. :execute => 'match',
  266. :css => '.active .ticket-title-update',
  267. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  268. :match_result => true,
  269. },
  270. {
  271. :where => :instance2,
  272. :execute => 'match',
  273. :css => '.taskbar .active .task',
  274. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  275. :match_result => true,
  276. },
  277. {
  278. :where => :instance1,
  279. :element => :title,
  280. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  281. },
  282. {
  283. :where => :instance2,
  284. :element => :title,
  285. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  286. },
  287. # verify text in input body
  288. {
  289. :where => :instance1,
  290. :execute => 'match',
  291. :css => '.active .ticket-answer textarea[name="body"]',
  292. :value => 'some level 2 <b>body</b> in instance 1',
  293. :match_result => true,
  294. },
  295. {
  296. :where => :instance2,
  297. :execute => 'match',
  298. :css => '.active .ticket-answer textarea[name="body"]',
  299. :value => 'some level 2 <b>body</b> in instance 2',
  300. :match_result => true,
  301. },
  302. # add new article
  303. {
  304. :where => :instance1,
  305. :execute => 'select',
  306. :css => '.active .ticket-answer select[name="ticket_article_type_id"]',
  307. :value => 'note',
  308. },
  309. {
  310. :where => :instance1,
  311. :execute => 'set',
  312. :css => '.active .ticket-answer textarea[name="body"]',
  313. :value => 'some update 4711',
  314. },
  315. {
  316. :where => :instance1,
  317. :execute => 'click',
  318. :css => '.active button',
  319. },
  320. {
  321. :execute => 'wait',
  322. :value => 4,
  323. },
  324. {
  325. :where => :instance1,
  326. :execute => 'match',
  327. :css => 'body',
  328. :value => 'some update 4711',
  329. :match_result => true,
  330. },
  331. # verify empty text in input body
  332. {
  333. :where => :instance1,
  334. :execute => 'match',
  335. :css => '.active .ticket-answer textarea[name="body"]',
  336. :value => '',
  337. :match_result => true,
  338. },
  339. {
  340. :where => :instance2,
  341. :execute => 'match',
  342. :css => '.active .ticket-answer textarea[name="body"]',
  343. :value => 'some level 2 <b>body</b> in instance 2',
  344. :match_result => true,
  345. },
  346. # reload instances, verify again
  347. {
  348. :where => :instance1,
  349. :execute => 'reload',
  350. },
  351. {
  352. :where => :instance2,
  353. :execute => 'reload',
  354. },
  355. # wait till application become ready
  356. {
  357. :execute => 'wait',
  358. :value => 8,
  359. },
  360. {
  361. :where => :instance1,
  362. :execute => 'match',
  363. :css => '.active .ticket-title-update',
  364. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  365. :match_result => true,
  366. },
  367. {
  368. :where => :instance2,
  369. :execute => 'match',
  370. :css => '.taskbar .active .task',
  371. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  372. :match_result => true,
  373. },
  374. {
  375. :where => :instance1,
  376. :element => :title,
  377. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  378. },
  379. {
  380. :where => :instance2,
  381. :element => :title,
  382. :value => 'TTTsome level 2 <b>subject</b> 123äöü',
  383. },
  384. # verify update
  385. {
  386. :where => :instance1,
  387. :execute => 'match',
  388. :css => 'body',
  389. :value => 'some update 4711',
  390. :match_result => true,
  391. },
  392. {
  393. :where => :instance2,
  394. :execute => 'match',
  395. :css => 'body',
  396. :value => 'some update 4711',
  397. :match_result => true,
  398. },
  399. # verify empty text in input body
  400. {
  401. :where => :instance1,
  402. :execute => 'match',
  403. :css => '.active .ticket-answer textarea[name="body"]',
  404. :value => '',
  405. :match_result => true,
  406. },
  407. {
  408. :where => :instance2,
  409. :execute => 'match',
  410. :css => '.active .ticket-answer textarea[name="body"]',
  411. :value => 'some level 2 <b>body</b> in instance 2',
  412. :match_result => true,
  413. },
  414. ],
  415. },
  416. ]
  417. browser_double_test(tests)
  418. end
  419. end