agent_ticket_update2_test.rb 9.3 KB

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