agent_ticket_overview_level1_test.rb 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class AgentTicketOverviewLevel1Test < TestCase
  4. def test_i
  5. name1 = "name_low_#{SecureRandom.uuid}"
  6. name2 = "name_high_#{SecureRandom.uuid}"
  7. browser1 = browser_instance
  8. login(
  9. browser: browser1,
  10. username: 'admin@example.com',
  11. password: 'test',
  12. url: browser_url,
  13. )
  14. tasks_close_all(browser: browser1)
  15. browser2 = browser_instance
  16. login(
  17. browser: browser2,
  18. username: 'agent1@example.com',
  19. password: 'test',
  20. url: browser_url,
  21. )
  22. tasks_close_all(browser: browser2)
  23. # create new overview
  24. overview_create(
  25. browser: browser1,
  26. data: {
  27. name: name1,
  28. roles: ['Agent'],
  29. selector: {
  30. 'Priority' => '1 low',
  31. },
  32. 'order::direction' => 'descending',
  33. }
  34. )
  35. overview_create(
  36. browser: browser1,
  37. data: {
  38. name: name2,
  39. roles: ['Agent'],
  40. selector: {
  41. 'Priority' => '3 high',
  42. },
  43. 'order::direction' => 'descending',
  44. }
  45. )
  46. # create tickets
  47. ticket1 = ticket_create(
  48. browser: browser1,
  49. data: {
  50. customer: 'nico',
  51. priority: '1 low',
  52. group: 'Users',
  53. title: 'overview #1',
  54. body: 'overview #1',
  55. }
  56. )
  57. # keep connection alive
  58. click(
  59. browser: browser2,
  60. css: '.search-holder',
  61. )
  62. ticket2 = ticket_create(
  63. browser: browser1,
  64. data: {
  65. customer: 'nico',
  66. priority: '1 low',
  67. group: 'Users',
  68. title: 'overview #2',
  69. body: 'overview #2',
  70. }
  71. )
  72. ticket3 = ticket_create(
  73. browser: browser1,
  74. data: {
  75. customer: 'nico',
  76. priority: '1 low',
  77. group: 'Users',
  78. title: 'overview #3',
  79. body: 'overview #3',
  80. }
  81. )
  82. # click on #1 on overview
  83. ticket_open_by_overview(
  84. browser: browser2,
  85. number: ticket3[:number],
  86. link: "#ticket/view/#{name1}",
  87. )
  88. # use overview navigation to got to #2 & #3
  89. match(
  90. browser: browser2,
  91. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
  92. value: '1',
  93. )
  94. match(
  95. browser: browser2,
  96. css: '.active .ticketZoom-header .ticket-number',
  97. value: ticket3[:number],
  98. )
  99. click(
  100. browser: browser2,
  101. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .btn--split--last',
  102. )
  103. match(
  104. browser: browser2,
  105. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
  106. value: '2',
  107. )
  108. match(
  109. browser: browser2,
  110. css: '.active .ticketZoom-header .ticket-number',
  111. value: ticket2[:number],
  112. )
  113. click(
  114. browser: browser2,
  115. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .btn--split--last',
  116. )
  117. match(
  118. browser: browser2,
  119. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
  120. value: '3',
  121. )
  122. match(
  123. browser: browser2,
  124. css: '.active .ticketZoom-header .ticket-number',
  125. value: ticket1[:number],
  126. )
  127. # close ticket
  128. sleep 2 # needed to selenium cache issues
  129. ticket_update(
  130. browser: browser2,
  131. data: {
  132. state: 'closed',
  133. }
  134. )
  135. sleep 8
  136. match(
  137. browser: browser2,
  138. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
  139. value: '3',
  140. )
  141. match(
  142. browser: browser2,
  143. css: '.active .ticketZoom-header .ticket-number',
  144. value: ticket1[:number],
  145. )
  146. click(
  147. browser: browser2,
  148. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .btn--split--first',
  149. )
  150. match(
  151. browser: browser2,
  152. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
  153. value: '2',
  154. )
  155. match(
  156. browser: browser2,
  157. css: '.active .ticketZoom-header .ticket-number',
  158. value: ticket2[:number],
  159. )
  160. click(
  161. browser: browser2,
  162. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .btn--split--last',
  163. )
  164. match(
  165. browser: browser2,
  166. css: '.active .ticketZoom-header .ticket-number',
  167. value: ticket1[:number],
  168. )
  169. sleep 2 # needed to selenium cache issues
  170. ticket_update(
  171. browser: browser2,
  172. data: {
  173. state: 'closed',
  174. priority: '3 high',
  175. }
  176. )
  177. watch_for_disappear(
  178. browser: browser2,
  179. css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current',
  180. )
  181. match(
  182. browser: browser2,
  183. css: '.active .ticketZoom-header .ticket-number',
  184. value: ticket1[:number],
  185. )
  186. end
  187. end