agent_navigation_and_title_test.rb 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. # dashboard after login
  12. verify_title(value: 'dashboard')
  13. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  14. exists_not(css: '#navigation .tasks .js-item.is-active')
  15. execute(js: 'App.Event.trigger("ui:rerender")')
  16. sleep 1
  17. verify_title(value: 'dashboard')
  18. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  19. exists_not(css: '#navigation .tasks .js-item.is-active')
  20. reload()
  21. sleep 2
  22. verify_title(value: 'dashboard')
  23. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  24. exists_not(css: '#navigation .tasks .js-item.is-active')
  25. # ticket create screen
  26. ticket_create(
  27. data: {
  28. customer: 'nico',
  29. group: 'Users',
  30. title: 'ticket create #1',
  31. body: 'ticket create #1',
  32. },
  33. do_not_submit: true,
  34. )
  35. sleep 4
  36. verify_title(value: 'Call Inbound')
  37. verify_task(
  38. data: {
  39. title: 'Call Inbound: ticket create #1',
  40. }
  41. )
  42. exists_not(css: '#navigation .js-menu .is-active')
  43. execute(js: 'App.Event.trigger("ui:rerender")')
  44. sleep 1
  45. verify_title(value: 'Call Inbound')
  46. verify_task(
  47. data: {
  48. title: 'Call Inbound: ticket create #1',
  49. }
  50. )
  51. exists_not(css: '#navigation .js-menu .is-active')
  52. reload()
  53. sleep 2
  54. verify_title(value: 'Call Inbound')
  55. verify_task(
  56. data: {
  57. title: 'Call Inbound: ticket create #1',
  58. }
  59. )
  60. exists_not(css: '#navigation .js-menu .is-active')
  61. # ticket zoom screen
  62. ticket_create(
  63. data: {
  64. customer: 'nico',
  65. group: 'Users',
  66. state: 'closed',
  67. title: 'ticket create #2',
  68. body: 'ticket create #2',
  69. },
  70. )
  71. verify_title(value: 'ticket create #2')
  72. verify_task(
  73. data: {
  74. title: 'ticket create #2',
  75. }
  76. )
  77. exists_not(css: '#navigation .js-menu .is-active')
  78. execute(js: 'App.Event.trigger("ui:rerender")')
  79. sleep 1
  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. reload()
  88. sleep 2
  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. # dashboard again
  97. click(css: '#navigation a[href="#dashboard"]')
  98. verify_title(value: 'dashboard')
  99. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  100. exists_not(css: '#navigation .tasks .js-item.is-active')
  101. execute(js: 'App.Event.trigger("ui:rerender")')
  102. sleep 1
  103. verify_title(value: 'dashboard')
  104. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  105. exists_not(css: '#navigation .tasks .js-item.is-active')
  106. reload()
  107. sleep 2
  108. verify_title(value: 'dashboard')
  109. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  110. exists_not(css: '#navigation .tasks .js-item.is-active')
  111. execute(js: 'App.Event.trigger("ui:rerender")')
  112. sleep 1
  113. verify_title(value: 'dashboard')
  114. exists(css: '#navigation .js-menu .js-dashboardMenuItem.is-active')
  115. exists_not(css: '#navigation .tasks .js-item.is-active')
  116. # click on admin
  117. click(css: 'a[href = "#manage"]')
  118. verify_title(value: 'Users')
  119. exists_not(css: '#navigation .js-menu .is-active')
  120. exists_not(css: '#navigation .tasks .js-item.is-active')
  121. execute(js: 'App.Event.trigger("ui:rerender")')
  122. sleep 1
  123. verify_title(value: 'Users')
  124. exists_not(css: '#navigation .js-menu .is-active')
  125. exists_not(css: '#navigation .tasks .js-item.is-active')
  126. reload()
  127. sleep 2
  128. verify_title(value: 'Users')
  129. exists_not(css: '#navigation .js-menu .is-active')
  130. exists_not(css: '#navigation .tasks .js-item.is-active')
  131. execute(js: 'App.Event.trigger("ui:rerender")')
  132. sleep 1
  133. verify_title(value: 'Users')
  134. exists_not(css: '#navigation .js-menu .is-active')
  135. exists_not(css: '#navigation .tasks .js-item.is-active')
  136. end
  137. end