agent_ticket_merge_test.rb 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. require 'browser_test_helper'
  2. class AgentTicketMergeTest < TestCase
  3. def test_agent_ticket_merge_closed_tab
  4. # merge ticket with closed tab
  5. @browser = browser_instance
  6. login(
  7. username: 'agent1@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # create new ticket
  13. ticket1 = ticket_create(
  14. data: {
  15. customer: 'nico',
  16. group: 'Users',
  17. title: 'some subject 123äöü - with closed tab',
  18. body: 'some body 123äöü - with closed tab',
  19. },
  20. )
  21. sleep 1
  22. # update ticket
  23. ticket_update(
  24. data: {
  25. body: 'some body 1234 äöüß - with closed tab',
  26. },
  27. )
  28. tasks_close_all()
  29. # create second ticket to merge
  30. ticket_create(
  31. data: {
  32. customer: 'nico',
  33. group: 'Users',
  34. title: 'test to merge - with closed tab',
  35. body: 'some body 123äöü 222 - test to merge - with closed tab',
  36. },
  37. )
  38. ticket_update(
  39. data: {
  40. body: 'some body 1234 äöüß 333 - with closed tab',
  41. },
  42. )
  43. # check if task is shown
  44. match(
  45. css: '.tasks',
  46. value: 'test to merge - with closed tab',
  47. )
  48. # merge tickets
  49. click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' )
  50. click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' )
  51. modal_ready()
  52. set(
  53. css: '.modal input[name="master_ticket_number"]',
  54. value: ticket1[:number],
  55. )
  56. click( css: '.modal button[type="submit"]' )
  57. # check if merged to ticket is shown now
  58. watch_for(
  59. css: '.active .ticketZoom-header .ticket-number',
  60. value: ticket1[:number],
  61. )
  62. watch_for(
  63. css: '.active .ticket-article',
  64. value: 'test to merge - with closed tab',
  65. )
  66. # check if task is now gone
  67. match_not(
  68. css: '.tasks',
  69. value: 'test to merge',
  70. )
  71. match(
  72. css: '.tasks',
  73. value: 'some subject 123äöü - with closed tab',
  74. )
  75. # close task/cleanup
  76. tasks_close_all()
  77. # merge ticket with open tabs
  78. ticket3 = ticket_create(
  79. data: {
  80. customer: 'nico',
  81. group: 'Users',
  82. title: 'some subject 123äöü - with open tab',
  83. body: 'some body 123äöü - with open tab',
  84. },
  85. )
  86. ticket_create(
  87. data: {
  88. customer: 'nico',
  89. group: 'Users',
  90. title: 'test to merge - with open tab',
  91. body: 'some body 123äöü 222 - test to merge - with open tab',
  92. },
  93. )
  94. # merge tickets
  95. click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' )
  96. click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' )
  97. modal_ready()
  98. set(
  99. css: '.modal input[name="master_ticket_number"]',
  100. value: ticket3[:number],
  101. )
  102. click( css: '.modal button[type="submit"]' )
  103. # check if merged to ticket is shown now
  104. watch_for(
  105. css: '.active .ticketZoom-header .ticket-number',
  106. value: ticket3[:number],
  107. )
  108. watch_for(
  109. css: '.active .ticket-article',
  110. value: 'test to merge - with open tab',
  111. )
  112. # check if task is now gone
  113. match_not(
  114. css: '.tasks',
  115. value: 'test to merge',
  116. )
  117. match(
  118. css: '.tasks',
  119. value: 'some subject 123äöü - with open tab',
  120. )
  121. end
  122. end