agent_ticket_actions_level3_test.rb 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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.ticket-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_info h3',
  46. :value => '^#(.*)$',
  47. :no_quote => true,
  48. :match_result => true,
  49. },
  50. # open ticket in second browser
  51. {
  52. :execute => 'wait',
  53. :value => 1,
  54. },
  55. {
  56. :where => :instance2,
  57. :execute => 'set',
  58. :css => '#global-search',
  59. :value => '###stack###',
  60. },
  61. {
  62. :execute => 'wait',
  63. :value => 3,
  64. },
  65. {
  66. :where => :instance2,
  67. :execute => 'click',
  68. :link => '###stack###',
  69. # :css => 'a:contains(\'###stack###\')',
  70. },
  71. {
  72. :execute => 'wait',
  73. :value => 3,
  74. },
  75. {
  76. :where => :instance2,
  77. :execute => 'match',
  78. :css => '.active div.ticket-article',
  79. :value => 'some level 3 <b>body</b> 123äöü',
  80. :match_result => true,
  81. },
  82. # change edit screen in instance 1
  83. {
  84. :where => :instance1,
  85. :execute => 'set',
  86. :css => '.active .ticket-answer textarea[name="body"]',
  87. :value => 'some level 3 <b>body</b> in instance 1',
  88. },
  89. {
  90. :execute => 'wait',
  91. :value => 3,
  92. },
  93. # update ticket in instance 2
  94. {
  95. :where => :instance2,
  96. :execute => 'set',
  97. :css => '.active .ticket-answer textarea[name="body"]',
  98. :value => 'some level 3 <b>body</b> in instance 2',
  99. },
  100. {
  101. :execute => 'wait',
  102. :value => 5,
  103. },
  104. {
  105. :where => :instance2,
  106. :execute => 'match',
  107. :css => '.content_permanent.active .reset-message',
  108. :value => '(Discard your unsaved changes.|Verwerfen der)',
  109. :no_quote => true,
  110. :match_result => true,
  111. },
  112. {
  113. :where => :instance2,
  114. :execute => 'click',
  115. :css => '.active .edit button[type="submit"]',
  116. },
  117. {
  118. :execute => 'wait',
  119. :value => 12,
  120. },
  121. {
  122. :where => :instance2,
  123. :execute => 'match',
  124. :css => '.content_permanent.active .reset-message',
  125. :value => '(Discard your unsaved changes.|Verwerfen der)',
  126. :no_quote => true,
  127. :match_result => false,
  128. },
  129. # check content and edit screen in instance 1
  130. {
  131. :where => :instance1,
  132. :execute => 'match',
  133. :css => '.active div.ticket-article-view',
  134. :value => 'some level 3 <b>body</b> in instance 2',
  135. :match_result => true,
  136. },
  137. {
  138. :where => :instance1,
  139. :execute => 'match',
  140. :css => '.active .ticket-answer textarea[name="body"]',
  141. :value => 'some level 3 <b>body</b> in instance 1',
  142. :match_result => true,
  143. },
  144. {
  145. :where => :instance1,
  146. :execute => 'match',
  147. :css => '.content_permanent.active .reset-message',
  148. :value => '(Discard your unsaved changes.|Verwerfen der)',
  149. :no_quote => true,
  150. :match_result => true,
  151. },
  152. # check edit screen in instance 2
  153. {
  154. :where => :instance2,
  155. :execute => 'match',
  156. :css => '.active .ticket-answer textarea[name="body"]',
  157. :value => '^$',
  158. :no_quote => true,
  159. :match_result => true,
  160. },
  161. # update ticket in instance 1
  162. {
  163. :where => :instance1,
  164. :execute => 'click',
  165. :css => '.active .edit button[type="submit"]',
  166. },
  167. {
  168. :execute => 'wait',
  169. :value => 16,
  170. },
  171. # check content in instance 2
  172. {
  173. :where => :instance2,
  174. :execute => 'match',
  175. :css => '.active div.ticket-article-view',
  176. :value => 'some level 3 <b>body</b> in instance 1',
  177. :match_result => true,
  178. },
  179. {
  180. :where => :instance2,
  181. :execute => 'match',
  182. :css => '.active div.ticket-article-view',
  183. :value => 'some level 3 <b>body</b> in instance 2',
  184. :match_result => true,
  185. },
  186. # check content and edit screen in instance 1+2
  187. {
  188. :where => :instance1,
  189. :execute => 'match',
  190. :css => '.active .ticket-answer textarea[name="body"]',
  191. :value => '^$',
  192. :no_quote => true,
  193. :match_result => true,
  194. },
  195. {
  196. :where => :instance1,
  197. :execute => 'match',
  198. :css => '.content_permanent.active .reset-message',
  199. :value => '(Discard your unsaved changes.|Verwerfen der)',
  200. :no_quote => true,
  201. :match_result => false,
  202. },
  203. {
  204. :where => :instance2,
  205. :execute => 'match',
  206. :css => '.active .ticket-answer textarea[name="body"]',
  207. :value => '^$',
  208. :no_quote => true,
  209. :match_result => true,
  210. },
  211. {
  212. :where => :instance2,
  213. :execute => 'match',
  214. :css => '.content_permanent.active .reset-message',
  215. :value => '(Discard your unsaved changes.|Verwerfen der)',
  216. :no_quote => true,
  217. :match_result => false,
  218. },
  219. # reload instances, verify again
  220. {
  221. :where => :instance1,
  222. :execute => 'reload',
  223. },
  224. {
  225. :where => :instance2,
  226. :execute => 'reload',
  227. },
  228. # check content and edit screen in instance 1+2
  229. {
  230. :where => :instance1,
  231. :execute => 'match',
  232. :css => '.active .ticket-answer textarea[name="body"]',
  233. :value => '^$',
  234. :no_quote => true,
  235. :match_result => true,
  236. },
  237. {
  238. :where => :instance1,
  239. :execute => 'match',
  240. :css => '.content_permanent.active .reset-message',
  241. :value => '(Discard your unsaved changes.|Verwerfen der)',
  242. :no_quote => true,
  243. :match_result => false,
  244. },
  245. {
  246. :where => :instance2,
  247. :execute => 'match',
  248. :css => '.active .ticket-answer textarea[name="body"]',
  249. :value => '^$',
  250. :no_quote => true,
  251. :match_result => true,
  252. },
  253. {
  254. :where => :instance2,
  255. :execute => 'match',
  256. :css => '.content_permanent.active .reset-message',
  257. :value => '(Discard your unsaved changes.|Verwerfen der)',
  258. :no_quote => true,
  259. :match_result => false,
  260. },
  261. # change form of ticket in instance 2
  262. {
  263. :where => :instance2,
  264. :execute => 'set',
  265. :css => '.active .ticket-answer textarea[name="body"]',
  266. :value => '22 some level 3 <b>body</b> in instance 2',
  267. },
  268. {
  269. :execute => 'wait',
  270. :value => 4,
  271. },
  272. {
  273. :where => :instance2,
  274. :execute => 'match',
  275. :css => '.content_permanent.active .reset-message',
  276. :value => '(Discard your unsaved changes.|Verwerfen der)',
  277. :no_quote => true,
  278. :match_result => true,
  279. },
  280. {
  281. :where => :instance2,
  282. :execute => 'reload',
  283. },
  284. {
  285. :where => :instance2,
  286. :execute => 'match',
  287. :css => '.active .ticket-answer textarea[name="body"]',
  288. :value => '22 some level 3 <b>body</b> in instance 2',
  289. :match_result => true,
  290. },
  291. {
  292. :where => :instance2,
  293. :execute => 'match',
  294. :css => '.content_permanent.active .reset-message',
  295. :value => '(Discard your unsaved changes.|Verwerfen der)',
  296. :no_quote => true,
  297. :match_result => true,
  298. },
  299. {
  300. :where => :instance2,
  301. :execute => 'click',
  302. :css => '.active .edit button[type="submit"]',
  303. },
  304. {
  305. :execute => 'wait',
  306. :value => 8,
  307. },
  308. {
  309. :where => :instance2,
  310. :execute => 'match',
  311. :css => '.content_permanent.active',
  312. :css => '.content_permanent.active .reset-message',
  313. :value => '(Discard your unsaved changes.|Verwerfen der)',
  314. :no_quote => true,
  315. :match_result => false,
  316. },
  317. {
  318. :where => :instance2,
  319. :execute => 'match',
  320. :css => '.active div.ticket-article-view',
  321. :value => '22 some level 3 <b>body</b> in instance 2',
  322. :match_result => true,
  323. },
  324. ],
  325. },
  326. ]
  327. browser_double_test(tests)
  328. end
  329. end