agent_ticket_update2_test.rb 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. require 'browser_test_helper'
  2. class AgentTicketUpdate2Test < TestCase
  3. def test_work_with_two_browser_on_same_ticket_edit
  4. browser1 = browser_instance
  5. login(
  6. browser: browser1,
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all(browser: browser1)
  12. browser2 = browser_instance
  13. login(
  14. browser: browser2,
  15. username: 'agent1@example.com',
  16. password: 'test',
  17. url: browser_url,
  18. )
  19. tasks_close_all(browser: browser2)
  20. # create ticket
  21. ticket1 = ticket_create(
  22. browser: browser1,
  23. data: {
  24. group: 'Users',
  25. customer: 'nicole',
  26. title: 'some level 3 <b>subject</b> 123äöü',
  27. body: 'some level 3 <b>body</b> 123äöü',
  28. }
  29. )
  30. # open ticket in second browser
  31. ticket_open_by_search(
  32. browser: browser2,
  33. number: ticket1[:number],
  34. )
  35. watch_for(
  36. browser: browser2,
  37. css: '.active div.ticket-article',
  38. value: 'some level 3 <b>body</b> 123äöü',
  39. )
  40. watch_for(
  41. browser: browser1,
  42. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  43. value: 'AT', # agent1
  44. )
  45. watch_for(
  46. browser: browser2,
  47. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  48. value: 'TA', # master
  49. )
  50. # change edit screen in instance 1
  51. ticket_update(
  52. browser: browser1,
  53. data: {
  54. body: 'some level 3 <b>body</b> in instance 1',
  55. },
  56. do_not_submit: true,
  57. )
  58. watch_for(
  59. browser: browser1,
  60. css: '.content.active .js-reset',
  61. value: '(Discard your unsaved changes.|Verwerfen der)',
  62. no_quote: true,
  63. )
  64. watch_for(
  65. browser: browser1,
  66. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  67. value: 'AT', # agent1
  68. )
  69. watch_for(
  70. browser: browser2,
  71. css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
  72. value: 'TA', # master
  73. )
  74. # update ticket in instance 2
  75. ticket_update(
  76. browser: browser2,
  77. data: {
  78. body: 'some level 3 <b>body</b> in instance 2',
  79. },
  80. do_not_submit: true,
  81. )
  82. watch_for(
  83. browser: browser2,
  84. css: '.content.active .js-reset',
  85. value: '(Discard your unsaved changes.|Verwerfen der)',
  86. no_quote: true,
  87. )
  88. watch_for(
  89. browser: browser1,
  90. css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
  91. value: 'AT', # agent1
  92. )
  93. watch_for(
  94. browser: browser2,
  95. css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
  96. value: 'TA', # master
  97. )
  98. click(
  99. browser: browser2,
  100. css: '.active .js-submit',
  101. )
  102. # discard changes should gone away
  103. watch_for_disappear(
  104. browser: browser2,
  105. css: '.content.active .js-reset',
  106. value: '(Discard your unsaved changes.|Verwerfen der)',
  107. no_quote: true,
  108. )
  109. ticket_verify(
  110. browser: browser2,
  111. data: {
  112. body: '',
  113. },
  114. )
  115. watch_for(
  116. browser: browser1,
  117. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  118. value: 'AT', # agent1
  119. )
  120. watch_for(
  121. browser: browser2,
  122. css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
  123. value: 'TA', # master
  124. )
  125. # check content and edit screen in instance 1
  126. watch_for(
  127. browser: browser2,
  128. css: '.active div.ticket-article',
  129. value: 'some level 3 <b>body</b> in instance 2',
  130. timeout: 1,
  131. )
  132. ticket_verify(
  133. browser: browser1,
  134. data: {
  135. body: 'some level 3 <b>body</b> in instance 1',
  136. },
  137. )
  138. # update ticket in instance 1
  139. click(
  140. browser: browser1,
  141. css: '.active .js-submit',
  142. )
  143. watch_for(
  144. browser: browser1,
  145. css: '.active div.ticket-article',
  146. value: 'some level 3 <b>body</b> in instance 2',
  147. )
  148. sleep 2
  149. match_not(
  150. browser: browser1,
  151. css: '.content.active .js-reset',
  152. value: '(Discard your unsaved changes.|Verwerfen der)',
  153. no_quote: true,
  154. )
  155. watch_for(
  156. browser: browser1,
  157. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  158. value: 'AT', # agent1
  159. )
  160. watch_for(
  161. browser: browser2,
  162. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  163. value: 'TA', # master
  164. )
  165. # check content in instance 2
  166. watch_for(
  167. browser: browser2,
  168. css: '.active div.ticket-article',
  169. value: 'some level 3 <b>body</b> in instance 1',
  170. )
  171. # check content and edit screen in instance 1+2
  172. ticket_verify(
  173. browser: browser1,
  174. data: {
  175. body: '',
  176. },
  177. )
  178. match_not(
  179. browser: browser1,
  180. css: '.content.active .js-reset',
  181. value: '(Discard your unsaved changes.|Verwerfen der)',
  182. no_quote: true,
  183. )
  184. ticket_verify(
  185. browser: browser2,
  186. data: {
  187. body: '',
  188. },
  189. )
  190. match_not(
  191. browser: browser2,
  192. css: '.content.active .js-reset',
  193. value: '(Discard your unsaved changes.|Verwerfen der)',
  194. no_quote: true,
  195. )
  196. watch_for(
  197. browser: browser1,
  198. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  199. value: 'AT', # agent1
  200. )
  201. watch_for(
  202. browser: browser2,
  203. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  204. value: 'TA', # master
  205. )
  206. # reload instances, verify again
  207. reload(
  208. browser: browser1,
  209. )
  210. reload(
  211. browser: browser2,
  212. )
  213. # check content and edit screen in instance 1+2
  214. ticket_verify(
  215. browser: browser1,
  216. data: {
  217. body: '',
  218. },
  219. )
  220. match_not(
  221. browser: browser1,
  222. css: '.content.active .js-reset',
  223. value: '(Discard your unsaved changes.|Verwerfen der)',
  224. no_quote: true,
  225. )
  226. ticket_verify(
  227. browser: browser2,
  228. data: {
  229. body: '',
  230. },
  231. )
  232. match_not(
  233. browser: browser2,
  234. css: '.content.active .js-reset',
  235. value: '(Discard your unsaved changes.|Verwerfen der)',
  236. no_quote: true,
  237. )
  238. watch_for(
  239. browser: browser1,
  240. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  241. value: 'AT', # agent1
  242. )
  243. watch_for(
  244. browser: browser2,
  245. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  246. value: 'TA', # master
  247. )
  248. # change form of ticket, reset, reload and verify in instance 2
  249. ticket_update(
  250. browser: browser2,
  251. data: {
  252. body: '22 some level 3 <b>body</b> in instance 2',
  253. },
  254. do_not_submit: true,
  255. )
  256. watch_for(
  257. browser: browser2,
  258. css: '.content.active .js-reset',
  259. value: '(Discard your unsaved changes.|Verwerfen der)',
  260. no_quote: true,
  261. )
  262. sleep 3
  263. reload(
  264. browser: browser2,
  265. )
  266. sleep 3
  267. click(
  268. css: '.content.active .js-reset',
  269. browser: browser2,
  270. )
  271. sleep 4
  272. ticket_verify(
  273. browser: browser2,
  274. data: {
  275. body: '',
  276. },
  277. )
  278. # change form of ticket in instance 2
  279. ticket_update(
  280. browser: browser2,
  281. data: {
  282. body: '22 some level 3 <b>body</b> in instance 2',
  283. },
  284. do_not_submit: true,
  285. )
  286. watch_for(
  287. browser: browser2,
  288. css: '.content.active .js-reset',
  289. value: '(Discard your unsaved changes.|Verwerfen der)',
  290. no_quote: true,
  291. )
  292. sleep 2
  293. watch_for(
  294. browser: browser1,
  295. css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
  296. value: 'AT', # agent1
  297. )
  298. watch_for(
  299. browser: browser2,
  300. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  301. value: 'TA', # master
  302. )
  303. reload(
  304. browser: browser2,
  305. )
  306. ticket_verify(
  307. browser: browser2,
  308. data: {
  309. body: '22 some level 3 <b>body</b> in instance 2',
  310. },
  311. )
  312. watch_for(
  313. browser: browser2,
  314. css: '.content.active .js-reset',
  315. value: '(Discard your unsaved changes.|Verwerfen der)',
  316. no_quote: true,
  317. )
  318. watch_for(
  319. browser: browser1,
  320. css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
  321. value: 'AT', # agent1
  322. )
  323. watch_for(
  324. browser: browser2,
  325. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  326. value: 'TA', # master
  327. )
  328. task_type(
  329. browser: browser2,
  330. type: 'stayOnTab',
  331. )
  332. click(
  333. browser: browser2,
  334. css: '.active .js-submit',
  335. )
  336. # discard changes should gone away
  337. watch_for_disappear(
  338. browser: browser2,
  339. css: '.content.active .js-reset',
  340. value: '(Discard your unsaved changes.|Verwerfen der)',
  341. no_quote: true,
  342. )
  343. watch_for(
  344. browser: browser1,
  345. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  346. value: 'AT', # agent1
  347. )
  348. watch_for(
  349. browser: browser2,
  350. css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
  351. value: 'TA', # master
  352. )
  353. # check if new article is empty
  354. ticket_verify(
  355. browser: browser2,
  356. data: {
  357. body: '',
  358. },
  359. )
  360. watch_for(
  361. browser: browser2,
  362. css: '.active div.ticket-article',
  363. value: '22 some level 3 <b>body</b> in instance 2',
  364. )
  365. end
  366. end