agent_ticket_actions_level3_test.rb 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketActionsLevel3Test < TestCase
  4. def test_work_with_two_browser_on_same_ticket_edit
  5. message = 'message 3 äöüß ' + 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 3 <b>subject</b> 123äöü',
  31. :body => 'some level 3 <b>body</b> 123äöü',
  32. },
  33. # check ticket
  34. {
  35. :where => :instance1,
  36. :execute => 'match',
  37. :css => '.active div.article',
  38. :value => 'some level 3 <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 3 <b>body</b> 123äöü',
  104. :match_result => true,
  105. },
  106. # change edit screen in instance 1
  107. {
  108. :where => :instance1,
  109. :execute => 'set',
  110. :css => '.active .ticket-answer textarea[name="body"]',
  111. :value => 'some level 3 <b>body</b> in instance 1',
  112. },
  113. {
  114. :execute => 'wait',
  115. :value => 3,
  116. },
  117. # update ticket in instance 2
  118. {
  119. :where => :instance2,
  120. :execute => 'set',
  121. :css => '.active .ticket-answer textarea[name="body"]',
  122. :value => 'some level 3 <b>body</b> in instance 2',
  123. },
  124. {
  125. :execute => 'wait',
  126. :value => 4,
  127. },
  128. {
  129. :where => :instance2,
  130. :execute => 'match',
  131. :css => '.content_permanent.active',
  132. :value => 'Discard your unsaved changes.',
  133. :match_result => true,
  134. },
  135. {
  136. :where => :instance2,
  137. :execute => 'click',
  138. :css => '.active .edit button[type="submit"]',
  139. },
  140. {
  141. :execute => 'wait',
  142. :value => 8,
  143. },
  144. {
  145. :where => :instance2,
  146. :execute => 'match',
  147. :css => '.content_permanent.active',
  148. :value => 'Discard your unsaved changes.',
  149. :match_result => false,
  150. },
  151. # check content and edit screen in instance 1
  152. {
  153. :where => :instance1,
  154. :execute => 'match',
  155. :css => '.active div.article-view',
  156. :value => 'some level 3 <b>body</b> in instance 2',
  157. :match_result => true,
  158. },
  159. {
  160. :where => :instance1,
  161. :execute => 'match',
  162. :css => '.active .ticket-answer textarea[name="body"]',
  163. :value => 'some level 3 <b>body</b> in instance 1',
  164. :match_result => true,
  165. },
  166. {
  167. :where => :instance1,
  168. :execute => 'match',
  169. :css => '.content_permanent.active',
  170. :value => 'Discard your unsaved changes.',
  171. :match_result => true,
  172. },
  173. # check edit screen in instance 2
  174. {
  175. :where => :instance2,
  176. :execute => 'match',
  177. :css => '.active .ticket-answer textarea[name="body"]',
  178. :value => '^$',
  179. :no_quote => true,
  180. :match_result => true,
  181. },
  182. # update ticket in instance 1
  183. {
  184. :where => :instance1,
  185. :execute => 'click',
  186. :css => '.active .edit button[type="submit"]',
  187. },
  188. {
  189. :execute => 'wait',
  190. :value => 8,
  191. },
  192. # check content in instance 2
  193. {
  194. :where => :instance2,
  195. :execute => 'match',
  196. :css => '.active div.article-view',
  197. :value => 'some level 3 <b>body</b> in instance 1',
  198. :match_result => true,
  199. },
  200. {
  201. :where => :instance2,
  202. :execute => 'match',
  203. :css => '.active div.article-view',
  204. :value => 'some level 3 <b>body</b> in instance 2',
  205. :match_result => true,
  206. },
  207. # check content and edit screen in instance 1+2
  208. {
  209. :where => :instance1,
  210. :execute => 'match',
  211. :css => '.active .ticket-answer textarea[name="body"]',
  212. :value => '^$',
  213. :no_quote => true,
  214. :match_result => true,
  215. },
  216. {
  217. :where => :instance1,
  218. :execute => 'match',
  219. :css => '.content_permanent.active',
  220. :value => 'Discard your unsaved changes.',
  221. :match_result => false,
  222. },
  223. {
  224. :where => :instance2,
  225. :execute => 'match',
  226. :css => '.active .ticket-answer textarea[name="body"]',
  227. :value => '^$',
  228. :no_quote => true,
  229. :match_result => true,
  230. },
  231. {
  232. :where => :instance2,
  233. :execute => 'match',
  234. :css => '.content_permanent.active',
  235. :value => 'Discard your unsaved changes.',
  236. :match_result => false,
  237. },
  238. # reload instances, verify again
  239. {
  240. :where => :instance1,
  241. :execute => 'reload',
  242. },
  243. {
  244. :where => :instance2,
  245. :execute => 'reload',
  246. },
  247. # check content and edit screen in instance 1+2
  248. {
  249. :where => :instance1,
  250. :execute => 'match',
  251. :css => '.active .ticket-answer textarea[name="body"]',
  252. :value => '^$',
  253. :no_quote => true,
  254. :match_result => true,
  255. },
  256. {
  257. :where => :instance1,
  258. :execute => 'match',
  259. :css => '.content_permanent.active',
  260. :value => 'Discard your unsaved changes.',
  261. :match_result => false,
  262. },
  263. {
  264. :where => :instance2,
  265. :execute => 'match',
  266. :css => '.active .ticket-answer textarea[name="body"]',
  267. :value => '^$',
  268. :no_quote => true,
  269. :match_result => true,
  270. },
  271. {
  272. :where => :instance2,
  273. :execute => 'match',
  274. :css => '.content_permanent.active',
  275. :value => 'Discard your unsaved changes.',
  276. :match_result => false,
  277. },
  278. # change form of ticket in instance 2
  279. {
  280. :where => :instance2,
  281. :execute => 'set',
  282. :css => '.active .ticket-answer textarea[name="body"]',
  283. :value => '22 some level 3 <b>body</b> in instance 2',
  284. },
  285. {
  286. :execute => 'wait',
  287. :value => 4,
  288. },
  289. {
  290. :where => :instance2,
  291. :execute => 'match',
  292. :css => '.content_permanent.active',
  293. :value => 'Discard your unsaved changes.',
  294. :match_result => true,
  295. },
  296. {
  297. :where => :instance2,
  298. :execute => 'reload',
  299. },
  300. {
  301. :where => :instance2,
  302. :execute => 'match',
  303. :css => '.active .ticket-answer textarea[name="body"]',
  304. :value => '22 some level 3 <b>body</b> in instance 2',
  305. :match_result => true,
  306. },
  307. {
  308. :where => :instance2,
  309. :execute => 'match',
  310. :css => '.content_permanent.active',
  311. :value => 'Discard your unsaved changes.',
  312. :match_result => true,
  313. },
  314. {
  315. :where => :instance2,
  316. :execute => 'click',
  317. :css => '.active .edit button[type="submit"]',
  318. },
  319. {
  320. :execute => 'wait',
  321. :value => 8,
  322. },
  323. {
  324. :where => :instance2,
  325. :execute => 'match',
  326. :css => '.content_permanent.active',
  327. :value => 'Discard your unsaved changes.',
  328. :match_result => false,
  329. },
  330. {
  331. :where => :instance2,
  332. :execute => 'match',
  333. :css => '.active div.article-view',
  334. :value => '22 some level 3 <b>body</b> in instance 2',
  335. :match_result => true,
  336. },
  337. ],
  338. },
  339. ]
  340. browser_double_test(tests)
  341. end
  342. end