agent_navigation_and_title_test.rb 4.8 KB

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