agent_ticket_overview_level1_test.rb 4.9 KB

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