agent_ticket_merge_test.rb 3.4 KB

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