agent_ticket_macro_test.rb 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. require 'browser_test_helper'
  2. class AgentTicketMacroTest < TestCase
  3. def test_close_and_tag_as_spam_default
  4. @browser = browser_instance
  5. login(
  6. username: 'agent1@example.com',
  7. password: 'test',
  8. url: browser_url,
  9. )
  10. tasks_close_all()
  11. ticket = ticket_create(
  12. data: {
  13. customer: 'nico',
  14. group: 'Users',
  15. title: 'macro "Close & Tag as Spam" default',
  16. body: 'some body - macro "Close & Tag as Spam" default',
  17. },
  18. )
  19. perform_macro(name: 'Close & Tag as Spam')
  20. # check redirect after perfoming macro
  21. location_check(
  22. url: "#{browser_url}/#dashboard",
  23. )
  24. # reopen ticket and verify tags
  25. ticket_open_by_search(
  26. number: ticket[:number],
  27. )
  28. tags_verify(
  29. tags: {
  30. 'spam' => true,
  31. 'tag1' => false,
  32. }
  33. )
  34. end
  35. def test_ux_flow_next_up_stay_on_tab
  36. @browser = browser_instance
  37. login(
  38. username: 'master@example.com',
  39. password: 'test',
  40. url: browser_url,
  41. )
  42. tasks_close_all()
  43. ux_flow_next_up = 'Stay on tab'
  44. macro_name = "Test #{ux_flow_next_up}"
  45. macro_create(
  46. name: macro_name,
  47. ux_flow_next_up: ux_flow_next_up,
  48. actions: {
  49. 'Tags' => {
  50. operator: 'add',
  51. value: 'spam',
  52. }
  53. }
  54. )
  55. ticket = ticket_create(
  56. data: {
  57. customer: 'nico',
  58. group: 'Users',
  59. title: "macro #{macro_name}",
  60. body: "some body - macro #{macro_name}",
  61. },
  62. )
  63. perform_macro(name: macro_name)
  64. location_check(
  65. url: "#{browser_url}/#ticket/zoom/#{ticket[:id]}",
  66. )
  67. tags_verify(
  68. tags: {
  69. 'spam' => true,
  70. 'tag1' => false,
  71. }
  72. )
  73. end
  74. def test_ux_flow_next_up_close_tab
  75. @browser = browser_instance
  76. login(
  77. username: 'master@example.com',
  78. password: 'test',
  79. url: browser_url,
  80. )
  81. tasks_close_all()
  82. ux_flow_next_up = 'Close tab'
  83. macro_name = "Test #{ux_flow_next_up}"
  84. macro_create(
  85. name: macro_name,
  86. ux_flow_next_up: ux_flow_next_up,
  87. )
  88. ticket_create(
  89. data: {
  90. customer: 'nico',
  91. group: 'Users',
  92. title: "macro #{macro_name}",
  93. body: "some body - macro #{macro_name}",
  94. },
  95. )
  96. perform_macro(name: macro_name)
  97. watch_for_disappear(
  98. css: '.tasks > a',
  99. timeout: 5,
  100. )
  101. end
  102. def test_ux_flow_next_up_advance_to_next_ticket_from_overview
  103. @browser = browser_instance
  104. login(
  105. username: 'master@example.com',
  106. password: 'test',
  107. url: browser_url,
  108. )
  109. tasks_close_all()
  110. ux_flow_next_up = 'Advance to next ticket from overview'
  111. macro_name = "Test #{ux_flow_next_up}"
  112. macro_create(
  113. name: macro_name,
  114. ux_flow_next_up: ux_flow_next_up,
  115. )
  116. title_prefix = "macro #{macro_name}"
  117. ticket1 = ticket_create(
  118. data: {
  119. customer: 'nico',
  120. group: 'Users',
  121. title: "#{title_prefix} - 1",
  122. body: "some body - macro #{macro_name}",
  123. },
  124. )
  125. ticket2 = ticket_create(
  126. data: {
  127. customer: 'nico',
  128. group: 'Users',
  129. title: "#{title_prefix} - 2",
  130. body: "some body - macro #{macro_name}",
  131. },
  132. )
  133. # we need to close all open ticket tasks because
  134. # otherwise the Zoom view won't change in "Overview"-mode
  135. # when we re-enter the Zoom view for a ticket via the overview
  136. tasks_close_all()
  137. sleep 8 # to update overview list to open correct/next ticket in overview
  138. ticket_open_by_overview(
  139. title: ticket1[:title],
  140. link: '#ticket/view/all_unassigned',
  141. )
  142. verify_task(
  143. data: {
  144. title: ticket1[:title],
  145. }
  146. )
  147. perform_macro(name: macro_name)
  148. verify_task(
  149. data: {
  150. title: ticket2[:title],
  151. }
  152. )
  153. end
  154. end