agent_ticket_update3_test.rb 6.0 KB

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