agent_ticket_overview_level0_test.rb 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketOverviewLevel0Test < TestCase
  4. def test_i
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # test bulk action
  13. # create new ticket
  14. ticket1 = ticket_create(
  15. data: {
  16. customer: 'nico',
  17. group: 'Users',
  18. title: 'overview count test #1',
  19. body: 'overview count test #1',
  20. }
  21. )
  22. ticket2 = ticket_create(
  23. data: {
  24. customer: 'nico',
  25. group: 'Users',
  26. title: 'overview count test #2',
  27. body: 'overview count test #2',
  28. }
  29. )
  30. click(text: 'Overviews')
  31. # enable full overviews
  32. execute(
  33. js: '$(".content.active .sidebar").css("display", "block")',
  34. )
  35. click(text: 'Unassigned & Open')
  36. sleep 8 # till overview is rendered
  37. # select both via bulk action
  38. click(
  39. css: '.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked',
  40. fast: true,
  41. )
  42. # scroll to reply - needed for chrome
  43. scroll_to(
  44. position: 'top',
  45. css: '.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked',
  46. )
  47. click(
  48. css: '.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked',
  49. fast: true,
  50. )
  51. exists(
  52. css: '.active table tr td input[value="' + ticket1[:id] + '"][type="checkbox"]:checked',
  53. )
  54. exists(
  55. css: '.active table tr td input[value="' + ticket2[:id] + '"][type="checkbox"]:checked',
  56. )
  57. # select close state & submit
  58. select(
  59. css: '.active .bulkAction [name="state_id"]',
  60. value: 'closed',
  61. )
  62. click(
  63. css: '.active .bulkAction .js-confirm',
  64. )
  65. click(
  66. css: '.active .bulkAction .js-submit',
  67. )
  68. sleep 6
  69. exists_not(
  70. css: '.active table tr td input[value="' + ticket1[:id] + '"]',
  71. )
  72. exists_not(
  73. css: '.active table tr td input[value="' + ticket2[:id] + '"]',
  74. )
  75. # remember current overview count
  76. overview_counter_before = overview_counter()
  77. # click options and enable number and article count
  78. click(css: '.active [data-type="settings"]')
  79. watch_for(
  80. css: '.modal h1',
  81. value: 'Edit',
  82. )
  83. check(
  84. css: '.modal input[value="number"]',
  85. )
  86. check(
  87. css: '.modal input[value="title"]',
  88. )
  89. check(
  90. css: '.modal input[value="customer"]',
  91. )
  92. check(
  93. css: '.modal input[value="group"]',
  94. )
  95. check(
  96. css: '.modal input[value="created_at"]',
  97. )
  98. check(
  99. css: '.modal input[value="article_count"]',
  100. )
  101. click(css: '.modal .js-submit')
  102. sleep 6
  103. # check if number and article count is shown
  104. match(
  105. css: '.active table th:nth-child(3)',
  106. value: '#',
  107. )
  108. match(
  109. css: '.active table th:nth-child(4)',
  110. value: 'Title',
  111. )
  112. match(
  113. css: '.active table th:nth-child(7)',
  114. value: 'Article#',
  115. )
  116. # reload browser
  117. reload()
  118. sleep 4
  119. # check if number and article count is shown
  120. match(
  121. css: '.active table th:nth-child(3)',
  122. value: '#',
  123. )
  124. match(
  125. css: '.active table th:nth-child(4)',
  126. value: 'Title',
  127. )
  128. match(
  129. css: '.active table th:nth-child(7)',
  130. value: 'Article#',
  131. )
  132. # disable number and article count
  133. click(css: '.active [data-type="settings"]')
  134. watch_for(
  135. css: '.modal h1',
  136. value: 'Edit',
  137. )
  138. uncheck(
  139. css: '.modal input[value="number"]',
  140. )
  141. uncheck(
  142. css: '.modal input[value="article_count"]',
  143. )
  144. click(css: '.modal .js-submit')
  145. sleep 6
  146. # check if number and article count is gone
  147. match_not(
  148. css: '.active table th:nth-child(3)',
  149. value: '#',
  150. )
  151. match(
  152. css: '.active table th:nth-child(3)',
  153. value: 'Title',
  154. )
  155. exists_not(
  156. css: '.active table th:nth-child(8)',
  157. )
  158. # create new ticket
  159. ticket3 = ticket_create(
  160. data: {
  161. customer: 'nico',
  162. group: 'Users',
  163. title: 'overview count test #3',
  164. body: 'overview count test #3',
  165. }
  166. )
  167. sleep 6
  168. # get new overview count
  169. overview_counter_new = overview_counter()
  170. assert_equal(overview_counter_before['#ticket/view/all_unassigned'] + 1, overview_counter_new['#ticket/view/all_unassigned'])
  171. # open ticket by search
  172. ticket_open_by_search(
  173. number: ticket3[:number],
  174. )
  175. sleep 1
  176. # close ticket
  177. ticket_update(
  178. data: {
  179. state: 'closed',
  180. }
  181. )
  182. sleep 6
  183. # get current overview count
  184. overview_counter_after = overview_counter()
  185. assert_equal(overview_counter_before['#ticket/view/all_unassigned'], overview_counter_after['#ticket/view/all_unassigned'])
  186. # cleanup
  187. tasks_close_all()
  188. end
  189. end