agent_ticket_overview_level0_test.rb 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. sleep 6 # till overview is updated
  31. click( css: '#navigation li.overviews a' )
  32. click( css: '.content.active .sidebar a[href="#ticket/view/all_unassigned"]' )
  33. sleep 4 # till overview is rendered
  34. # select both via bulk action
  35. click(
  36. css: '.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked',
  37. fast: true,
  38. )
  39. click(
  40. css: '.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked',
  41. fast: true,
  42. )
  43. exists(
  44. css: '.active table tr td input[value="' + ticket1[:id] + '"][type="checkbox"]:checked',
  45. )
  46. exists(
  47. css: '.active table tr td input[value="' + ticket2[:id] + '"][type="checkbox"]:checked',
  48. )
  49. # select close state & submit
  50. select(
  51. css: '.active .bulkAction [name="state_id"]',
  52. value: 'closed',
  53. )
  54. click(
  55. css: '.active .bulkAction .js-confirm',
  56. )
  57. click(
  58. css: '.active .bulkAction .js-submit',
  59. )
  60. sleep 6
  61. exists_not(
  62. css: '.active table tr td input[value="' + ticket1[:id] + '"]',
  63. )
  64. exists_not(
  65. css: '.active table tr td input[value="' + ticket2[:id] + '"]',
  66. )
  67. # remember current overview count
  68. overview_counter_before = overview_counter()
  69. # click options and enable number and article count
  70. click( css: '.active [data-type="settings"]' )
  71. watch_for(
  72. css: '.modal h1',
  73. value: 'Edit',
  74. )
  75. check(
  76. css: '.modal input[value="number"]',
  77. )
  78. check(
  79. css: '.modal input[value="title"]',
  80. )
  81. check(
  82. css: '.modal input[value="customer"]',
  83. )
  84. check(
  85. css: '.modal input[value="group"]',
  86. )
  87. check(
  88. css: '.modal input[value="created_at"]',
  89. )
  90. check(
  91. css: '.modal input[value="article_count"]',
  92. )
  93. click( css: '.modal .js-submit' )
  94. sleep 4
  95. # check if number and article count is shown
  96. match(
  97. css: '.active table th:nth-child(3)',
  98. value: '#',
  99. )
  100. match(
  101. css: '.active table th:nth-child(8)',
  102. value: 'Article#',
  103. )
  104. # reload browser
  105. reload()
  106. sleep 4
  107. # check if number and article count is shown
  108. match(
  109. css: '.active table th:nth-child(3)',
  110. value: '#',
  111. )
  112. match(
  113. css: '.active table th:nth-child(8)',
  114. value: 'Article#',
  115. )
  116. # disable number and article count
  117. click( css: '.active [data-type="settings"]' )
  118. watch_for(
  119. css: '.modal h1',
  120. value: 'Edit',
  121. )
  122. uncheck(
  123. css: '.modal input[value="number"]',
  124. )
  125. uncheck(
  126. css: '.modal input[value="article_count"]',
  127. )
  128. click( css: '.modal .js-submit' )
  129. sleep 4
  130. # check if number and article count is gone
  131. match_not(
  132. css: '.active table th:nth-child(3)',
  133. value: '#',
  134. )
  135. exists_not(
  136. css: '.active table th:nth-child(8)',
  137. )
  138. # create new ticket
  139. ticket3 = ticket_create(
  140. data: {
  141. customer: 'nico*',
  142. group: 'Users',
  143. title: 'overview count test #3',
  144. body: 'overview count test #3',
  145. }
  146. )
  147. sleep 8
  148. # get new overview count
  149. overview_counter_new = overview_counter()
  150. assert_equal( overview_counter_before['#ticket/view/all_unassigned'] + 1, overview_counter_new['#ticket/view/all_unassigned'] )
  151. # open ticket by search
  152. ticket_open_by_search(
  153. number: ticket3[:number],
  154. )
  155. sleep 1
  156. # close ticket
  157. ticket_update(
  158. data: {
  159. state: 'closed',
  160. }
  161. )
  162. sleep 8
  163. # get current overview count
  164. overview_counter_after = overview_counter()
  165. assert_equal( overview_counter_before['#ticket/view/all_unassigned'], overview_counter_after['#ticket/view/all_unassigned'] )
  166. # cleanup
  167. tasks_close_all()
  168. end
  169. end