agent_navigation_and_title_test.rb 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class AgentNavigationAndTitleTest < TestCase
  4. def test_highlight_and_title
  5. @browser = browser_instance
  6. login(
  7. username: 'admin@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all
  12. # since we run the basic functionality tests via Capybara now the clues are shown
  13. # and closed after the login. This unfortunately removes the 'is-active' class from the
  14. # dashboard link causing the following tests to fail.
  15. # Because the browser tests are deprecated and there is no easy fix to change the
  16. # behavior we refresh the page and wait for it to finish loading the app as a workaround.
  17. # This will cause the 'is-active' class to be set on the menu item again
  18. reload
  19. sleep 4
  20. # dashboard after login
  21. verify_title(value: 'dashboard')
  22. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  23. exists_not(css: '#navigation .tasks .js-item.is-active')
  24. execute(js: 'App.Event.trigger("ui:rerender")')
  25. sleep 1
  26. verify_title(value: 'dashboard')
  27. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  28. exists_not(css: '#navigation .tasks .js-item.is-active')
  29. reload
  30. sleep 2
  31. verify_title(value: 'dashboard')
  32. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  33. exists_not(css: '#navigation .tasks .js-item.is-active')
  34. # ticket create screen
  35. ticket_create(
  36. data: {
  37. customer: 'nico',
  38. group: 'Users',
  39. title: 'ticket create #1',
  40. body: 'ticket create #1',
  41. },
  42. do_not_submit: true,
  43. )
  44. sleep 4
  45. verify_title(value: 'Inbound Call')
  46. verify_task(
  47. data: {
  48. title: 'Inbound Call: ticket create #1',
  49. }
  50. )
  51. exists_not(css: '#navigation .js-menu .is-active')
  52. execute(js: 'App.Event.trigger("ui:rerender")')
  53. sleep 1
  54. verify_title(value: 'Inbound Call')
  55. verify_task(
  56. data: {
  57. title: 'Inbound Call: ticket create #1',
  58. }
  59. )
  60. exists_not(css: '#navigation .js-menu .is-active')
  61. reload
  62. sleep 2
  63. verify_title(value: 'Inbound Call')
  64. verify_task(
  65. data: {
  66. title: 'Inbound Call: ticket create #1',
  67. }
  68. )
  69. exists_not(css: '#navigation .js-menu .is-active')
  70. # ticket zoom screen
  71. ticket_create(
  72. data: {
  73. customer: 'nico',
  74. group: 'Users',
  75. state: 'closed',
  76. title: 'ticket create #2',
  77. body: 'ticket create #2',
  78. },
  79. )
  80. verify_title(value: 'ticket create #2')
  81. verify_task(
  82. data: {
  83. title: 'ticket create #2',
  84. }
  85. )
  86. exists_not(css: '#navigation .js-menu .is-active')
  87. execute(js: 'App.Event.trigger("ui:rerender")')
  88. sleep 1
  89. verify_title(value: 'ticket create #2')
  90. verify_task(
  91. data: {
  92. title: 'ticket create #2',
  93. }
  94. )
  95. exists_not(css: '#navigation .js-menu .is-active')
  96. reload
  97. sleep 2
  98. verify_title(value: 'ticket create #2')
  99. verify_task(
  100. data: {
  101. title: 'ticket create #2',
  102. }
  103. )
  104. exists_not(css: '#navigation .js-menu .is-active')
  105. # dashboard again
  106. click(css: '#navigation a[href="#dashboard"]')
  107. verify_title(value: 'dashboard')
  108. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  109. exists_not(css: '#navigation .tasks .js-item.is-active')
  110. execute(js: 'App.Event.trigger("ui:rerender")')
  111. sleep 1
  112. verify_title(value: 'dashboard')
  113. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  114. exists_not(css: '#navigation .tasks .js-item.is-active')
  115. reload
  116. sleep 2
  117. verify_title(value: 'dashboard')
  118. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  119. exists_not(css: '#navigation .tasks .js-item.is-active')
  120. execute(js: 'App.Event.trigger("ui:rerender")')
  121. sleep 1
  122. verify_title(value: 'dashboard')
  123. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  124. exists_not(css: '#navigation .tasks .js-item.is-active')
  125. # click on admin
  126. click(css: 'a[href = "#manage"]')
  127. verify_title(value: 'Users')
  128. exists_not(css: '#navigation .js-menu .is-active')
  129. exists_not(css: '#navigation .tasks .js-item.is-active')
  130. execute(js: 'App.Event.trigger("ui:rerender")')
  131. sleep 1
  132. verify_title(value: 'Users')
  133. exists_not(css: '#navigation .js-menu .is-active')
  134. exists_not(css: '#navigation .tasks .js-item.is-active')
  135. reload
  136. sleep 2
  137. verify_title(value: 'Users')
  138. exists_not(css: '#navigation .js-menu .is-active')
  139. exists_not(css: '#navigation .tasks .js-item.is-active')
  140. execute(js: 'App.Event.trigger("ui:rerender")')
  141. sleep 1
  142. verify_title(value: 'Users')
  143. exists_not(css: '#navigation .js-menu .is-active')
  144. exists_not(css: '#navigation .tasks .js-item.is-active')
  145. end
  146. end