agent_ticket_update3_test.rb 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketUpdate3Test < TestCase
  4. def test_work_with_two_browser_on_same_ticket
  5. # work on one ticket with two browsers
  6. browser1 = browser_instance
  7. login(
  8. browser: browser1,
  9. username: 'master@example.com',
  10. password: 'test',
  11. url: browser_url,
  12. )
  13. tasks_close_all(browser: browser1)
  14. browser2 = browser_instance
  15. login(
  16. browser: browser2,
  17. username: 'agent1@example.com',
  18. password: 'test',
  19. url: browser_url,
  20. )
  21. tasks_close_all(browser: browser2)
  22. # create ticket
  23. ticket1 = ticket_create(
  24. browser: browser1,
  25. data: {
  26. group: 'Users',
  27. customer: 'nicole',
  28. title: 'some level 2 <b>subject</b> 123äöü',
  29. body: 'some level 2 <b>body</b> 123äöü',
  30. }
  31. )
  32. # open ticket in second browser
  33. ticket_open_by_search(
  34. browser: browser2,
  35. number: ticket1[:number],
  36. )
  37. watch_for(
  38. browser: browser2,
  39. css: '.active div.ticket-article',
  40. value: 'some level 2 <b>body</b> 123äöü',
  41. )
  42. # set body in edit area in second
  43. ticket_update(
  44. browser: browser2,
  45. data: {
  46. body: 'some level 2 <b>body</b> in instance 2',
  47. },
  48. do_not_submit: true,
  49. )
  50. # set body in edit area in first
  51. ticket_update(
  52. browser: browser1,
  53. data: {
  54. body: 'some level 2 <b>body</b> in instance 1',
  55. },
  56. do_not_submit: true,
  57. )
  58. # change title in second browser
  59. ticket_update(
  60. browser: browser2,
  61. data: {
  62. title: 'TTTsome level 2 <b>subject</b> 123äöü',
  63. },
  64. do_not_submit: true,
  65. )
  66. sleep 2
  67. # verify title in second and first browser
  68. verify_title(
  69. browser: browser2,
  70. value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  71. )
  72. ticket_verify(
  73. browser: browser2,
  74. data: {
  75. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  76. },
  77. )
  78. verify_task(
  79. browser: browser2,
  80. data: {
  81. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  82. modified: false,
  83. }
  84. )
  85. sleep 4
  86. verify_title(
  87. browser: browser1,
  88. value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  89. )
  90. ticket_verify(
  91. browser: browser1,
  92. data: {
  93. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  94. },
  95. )
  96. verify_task(
  97. browser: browser1,
  98. data: {
  99. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  100. modified: true,
  101. }
  102. )
  103. # verify text in input body, if still exists
  104. ticket_verify(
  105. browser: browser1,
  106. data: {
  107. body: 'some level 2 <b>body</b> in instance 1',
  108. },
  109. )
  110. ticket_verify(
  111. browser: browser2,
  112. data: {
  113. body: 'some level 2 <b>body</b> in instance 2',
  114. },
  115. )
  116. # set body in edit area in second
  117. ticket_update(
  118. browser: browser1,
  119. data: {
  120. body: 'some update 4711',
  121. },
  122. )
  123. watch_for(
  124. browser: browser1,
  125. css: '.active div.ticket-article',
  126. value: 'some update 4711',
  127. )
  128. verify_task(
  129. browser: browser1,
  130. data: {
  131. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  132. modified: false,
  133. }
  134. )
  135. # verify if text in input body is now empty
  136. ticket_verify(
  137. browser: browser1,
  138. data: {
  139. body: '',
  140. },
  141. )
  142. # check if body is still in second browser
  143. ticket_verify(
  144. browser: browser2,
  145. data: {
  146. body: 'some level 2 <b>body</b> in instance 2',
  147. },
  148. )
  149. # verify task
  150. verify_task(
  151. browser: browser2,
  152. data: {
  153. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  154. modified: true,
  155. }
  156. )
  157. # reload instances, verify again
  158. reload(
  159. browser: browser1,
  160. )
  161. reload(
  162. browser: browser2,
  163. )
  164. # wait till application become ready
  165. sleep 8
  166. verify_title(
  167. browser: browser2,
  168. value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  169. )
  170. ticket_verify(
  171. browser: browser2,
  172. data: {
  173. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  174. },
  175. )
  176. verify_task(
  177. browser: browser2,
  178. data: {
  179. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  180. modified: false, # modify was muted at reload ticket tab
  181. }
  182. )
  183. verify_title(
  184. browser: browser1,
  185. value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  186. )
  187. ticket_verify(
  188. browser: browser1,
  189. data: {
  190. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  191. },
  192. )
  193. verify_task(
  194. browser: browser1,
  195. data: {
  196. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  197. modified: false,
  198. }
  199. )
  200. # verify if update is on ticket in each browser
  201. watch_for(
  202. browser: browser1,
  203. css: '.active div.ticket-article',
  204. value: 'some update 4711',
  205. )
  206. watch_for(
  207. browser: browser2,
  208. css: '.active div.ticket-article',
  209. value: 'some update 4711',
  210. )
  211. # verify if text in input body is now empty
  212. ticket_verify(
  213. browser: browser1,
  214. data: {
  215. body: '',
  216. },
  217. )
  218. # check if body is still in second browser
  219. ticket_verify(
  220. browser: browser2,
  221. data: {
  222. body: 'some level 2 <b>body</b> in instance 2',
  223. },
  224. )
  225. # modify ticket again and erase modified via mouse click on .active.content
  226. ticket_update(
  227. browser: browser1,
  228. data: {
  229. body: 'some update 4711/2',
  230. },
  231. )
  232. sleep 4
  233. verify_task(
  234. browser: browser2,
  235. data: {
  236. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  237. modified: true,
  238. }
  239. )
  240. click(
  241. browser: browser2,
  242. css: '.active.content',
  243. )
  244. sleep 4
  245. verify_task(
  246. browser: browser2,
  247. data: {
  248. title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
  249. modified: false,
  250. }
  251. )
  252. end
  253. end