agent_ticket_actions_level3_test.rb 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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 .page-header .ticket-number',
  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_ticket_attributes',
  86. :body => 'some level 3 <b>body</b> in instance 1',
  87. },
  88. {
  89. :execute => 'wait',
  90. :value => 3,
  91. },
  92. # update ticket in instance 2
  93. {
  94. :where => :instance2,
  95. :execute => 'set_ticket_attributes',
  96. :body => 'some level 3 <b>body</b> in instance 2',
  97. },
  98. {
  99. :execute => 'wait',
  100. :value => 5,
  101. },
  102. {
  103. :where => :instance2,
  104. :execute => 'match',
  105. :css => '.content.active .js-reset',
  106. :value => '(Discard your unsaved changes.|Verwerfen der)',
  107. :no_quote => true,
  108. :match_result => true,
  109. },
  110. {
  111. :where => :instance2,
  112. :execute => 'click',
  113. :css => '.active button.js-submit',
  114. },
  115. {
  116. :execute => 'wait',
  117. :value => 12,
  118. },
  119. {
  120. :where => :instance2,
  121. :execute => 'match',
  122. :css => '.content.active .js-reset',
  123. :value => '(Discard your unsaved changes.|Verwerfen der)',
  124. :no_quote => true,
  125. :match_result => false,
  126. },
  127. # check content and edit screen in instance 1
  128. {
  129. :where => :instance1,
  130. :execute => 'match',
  131. :css => '.active div.ticket-article-view',
  132. :value => 'some level 3 <b>body</b> in instance 2',
  133. :match_result => true,
  134. },
  135. {
  136. :where => :instance1,
  137. :execute => 'verify_ticket_attributes',
  138. :body => 'some level 3 <b>body</b> in instance 1',
  139. },
  140. {
  141. :where => :instance1,
  142. :execute => 'match',
  143. :css => '.content.active .js-reset',
  144. :value => '(Discard your unsaved changes.|Verwerfen der)',
  145. :no_quote => true,
  146. :match_result => true,
  147. },
  148. # check edit screen in instance 2
  149. {
  150. :where => :instance2,
  151. :execute => 'verify_ticket_attributes',
  152. :bdoy => '',
  153. },
  154. # update ticket in instance 1
  155. {
  156. :where => :instance1,
  157. :execute => 'click',
  158. :css => '.active button.js-submit',
  159. },
  160. {
  161. :execute => 'wait',
  162. :value => 16,
  163. },
  164. # check content in instance 2
  165. {
  166. :where => :instance2,
  167. :execute => 'match',
  168. :css => '.active div.ticket-article-view',
  169. :value => 'some level 3 <b>body</b> in instance 1',
  170. :match_result => true,
  171. },
  172. {
  173. :where => :instance2,
  174. :execute => 'match',
  175. :css => '.active div.ticket-article-view',
  176. :value => 'some level 3 <b>body</b> in instance 2',
  177. :match_result => true,
  178. },
  179. # check content and edit screen in instance 1+2
  180. {
  181. :where => :instance1,
  182. :execute => 'verify_ticket_attributes',
  183. :body => '',
  184. },
  185. {
  186. :where => :instance1,
  187. :execute => 'match',
  188. :css => '.content.active .js-reset',
  189. :value => '(Discard your unsaved changes.|Verwerfen der)',
  190. :no_quote => true,
  191. :match_result => false,
  192. },
  193. {
  194. :where => :instance2,
  195. :execute => 'verify_ticket_attributes',
  196. :body => '',
  197. },
  198. {
  199. :where => :instance2,
  200. :execute => 'match',
  201. :css => '.content.active .js-reset',
  202. :value => '(Discard your unsaved changes.|Verwerfen der)',
  203. :no_quote => true,
  204. :match_result => false,
  205. },
  206. # reload instances, verify again
  207. {
  208. :where => :instance1,
  209. :execute => 'reload',
  210. },
  211. {
  212. :where => :instance2,
  213. :execute => 'reload',
  214. },
  215. # check content and edit screen in instance 1+2
  216. {
  217. :where => :instance1,
  218. :execute => 'verify_ticket_attributes',
  219. :body => '',
  220. },
  221. {
  222. :where => :instance1,
  223. :execute => 'match',
  224. :css => '.content.active .js-reset',
  225. :value => '(Discard your unsaved changes.|Verwerfen der)',
  226. :no_quote => true,
  227. :match_result => false,
  228. },
  229. {
  230. :where => :instance2,
  231. :execute => 'verify_ticket_attributes',
  232. :body => '',
  233. },
  234. {
  235. :where => :instance2,
  236. :execute => 'match',
  237. :css => '.content.active .js-reset',
  238. :value => '(Discard your unsaved changes.|Verwerfen der)',
  239. :no_quote => true,
  240. :match_result => false,
  241. },
  242. # change form of ticket in instance 2
  243. {
  244. :where => :instance2,
  245. :execute => 'set_ticket_attributes',
  246. :body => '22 some level 3 <b>body</b> in instance 2',
  247. },
  248. {
  249. :execute => 'wait',
  250. :value => 4,
  251. },
  252. {
  253. :where => :instance2,
  254. :execute => 'match',
  255. :css => '.content.active .js-reset',
  256. :value => '(Discard your unsaved changes.|Verwerfen der)',
  257. :no_quote => true,
  258. :match_result => true,
  259. },
  260. {
  261. :where => :instance2,
  262. :execute => 'reload',
  263. },
  264. {
  265. :where => :instance2,
  266. :execute => 'verify_ticket_attributes',
  267. :body => '22 some level 3 <b>body</b> in instance 2',
  268. },
  269. {
  270. :where => :instance2,
  271. :execute => 'match',
  272. :css => '.content.active .js-reset',
  273. :value => '(Discard your unsaved changes.|Verwerfen der)',
  274. :no_quote => true,
  275. :match_result => true,
  276. },
  277. {
  278. :where => :instance2,
  279. :execute => 'click',
  280. :css => '.active button.js-submit',
  281. },
  282. {
  283. :execute => 'wait',
  284. :value => 8,
  285. },
  286. {
  287. :where => :instance2,
  288. :execute => 'match',
  289. :css => '.content_permanent.active',
  290. :css => '.content.active .js-reset',
  291. :value => '(Discard your unsaved changes.|Verwerfen der)',
  292. :no_quote => true,
  293. :match_result => false,
  294. },
  295. {
  296. :where => :instance2,
  297. :execute => 'match',
  298. :css => '.active div.ticket-article-view',
  299. :value => '22 some level 3 <b>body</b> in instance 2',
  300. :match_result => true,
  301. },
  302. ],
  303. },
  304. ]
  305. browser_double_test(tests)
  306. end
  307. end