agent_organization_profile_test.rb 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class AgentOrganizationProfileTest < TestCase
  4. def test_org_profile
  5. # work in one browser window
  6. message = "1 #{SecureRandom.uuid}"
  7. note = "some note #{SecureRandom.uuid}"
  8. @browser = browser_instance
  9. login(
  10. username: 'admin@example.com',
  11. password: 'test',
  12. url: browser_url,
  13. )
  14. tasks_close_all
  15. # search and open org
  16. organization_open_by_search(
  17. value: 'Zammad Foundation',
  18. )
  19. verify_task(
  20. data: {
  21. title: 'Zammad Foundation',
  22. }
  23. )
  24. watch_for(
  25. css: '.active .profile-window',
  26. value: 'note',
  27. )
  28. watch_for(
  29. css: '.active .profile-window',
  30. value: 'member',
  31. )
  32. # update note
  33. set(
  34. css: '.active .profile [data-name="note"]',
  35. value: note,
  36. )
  37. empty_search
  38. sleep 2
  39. # check and change note again in edit screen
  40. click(css: '.active .js-action .icon-arrow-down', fast: true)
  41. click(css: '.active .js-action [data-type="edit"]')
  42. modal_ready
  43. watch_for(
  44. css: '.active .modal',
  45. value: note,
  46. )
  47. set(
  48. css: '.modal [name="name"]',
  49. value: 'Z2',
  50. )
  51. set(
  52. css: '.active .modal [data-name="note"]',
  53. value: 'some note abc',
  54. )
  55. click(css: '.active .modal button.js-submit')
  56. modal_disappear
  57. watch_for(
  58. css: '.active .profile-window',
  59. value: 'some note abc',
  60. )
  61. verify_task(
  62. data: {
  63. title: 'Z2',
  64. }
  65. )
  66. # change lastname back
  67. click(css: '.active .js-action .icon-arrow-down', fast: true)
  68. click(css: '.active .js-action [data-type="edit"]')
  69. modal_ready
  70. set(
  71. css: '.modal [name="name"]',
  72. value: 'Zammad Foundation',
  73. )
  74. click(css: '.active .modal button.js-submit')
  75. modal_disappear
  76. verify_task(
  77. data: {
  78. title: 'Zammad Foundation',
  79. }
  80. )
  81. # create new ticket
  82. ticket_create(
  83. data: {
  84. customer: 'nico',
  85. group: 'Users',
  86. title: "org profile check #{message}",
  87. body: "org profile check #{message}",
  88. },
  89. )
  90. # switch to org tab, verify if ticket is shown
  91. organization_open_by_search(
  92. value: 'Zammad Foundation',
  93. )
  94. watch_for(
  95. css: '.active .profile-window',
  96. value: "org profile check #{message}",
  97. )
  98. tasks_close_all
  99. # work with two browser windows
  100. message = "comment 1 #{SecureRandom.uuid}"
  101. # use current session
  102. browser1 = @browser
  103. browser2 = browser_instance
  104. login(
  105. browser: browser2,
  106. username: 'agent1@example.com',
  107. password: 'test',
  108. url: browser_url,
  109. )
  110. tasks_close_all(
  111. browser: browser2,
  112. )
  113. organization_open_by_search(
  114. browser: browser1,
  115. value: 'Zammad Foundation',
  116. )
  117. organization_open_by_search(
  118. browser: browser2,
  119. value: 'Zammad Foundation',
  120. )
  121. # update note
  122. set(
  123. browser: browser1,
  124. css: '.active .profile [data-name="note"]',
  125. slow: true,
  126. value: message,
  127. blur: true
  128. )
  129. # verify
  130. watch_for(
  131. browser: browser2,
  132. css: '.active .profile-window',
  133. value: message,
  134. )
  135. end
  136. def test_org_profile_user_active_update
  137. @browser = browser_instance
  138. login(
  139. username: 'admin@example.com',
  140. password: 'test',
  141. url: browser_url,
  142. )
  143. tasks_close_all
  144. # search and open org
  145. organization_open_by_search(
  146. value: 'Zammad Foundation',
  147. )
  148. watch_for(
  149. css: '.active .profile-window .userList-entry a.user-popover',
  150. value: 'Nicole Braun',
  151. )
  152. exists(
  153. css: '.active .profile-window .userList-entry .avatar--unique',
  154. )
  155. # open user and change status to inactive
  156. click(
  157. css: '.active .profile-window .userList-entry a.user-popover',
  158. )
  159. click(
  160. css: '.active .profile-window .dropdown #userAction',
  161. )
  162. click(
  163. css: '.active .profile-window .dropdown li[data-type="edit"]',
  164. )
  165. modal_ready
  166. select(
  167. css: '.active .modal select[name="active"]',
  168. value: 'inactive'
  169. )
  170. click(
  171. css: '.modal .js-submit',
  172. )
  173. modal_disappear
  174. # go back to the org and check for inactive status update
  175. click(
  176. css: '#navigation .nav-tab[data-key="Organization-1"]',
  177. )
  178. watch_for(
  179. css: '.active .profile-window .userList-entry .avatar--unique.avatar--inactive',
  180. )
  181. # open user and change status to active again
  182. click(
  183. css: '.active .profile-window .userList-entry a.user-popover',
  184. )
  185. click(
  186. css: '.active .profile-window .dropdown #userAction',
  187. )
  188. click(
  189. css: '.active .profile-window .dropdown li[data-type="edit"]',
  190. )
  191. modal_ready
  192. select(
  193. css: '.active .modal select[name="active"]',
  194. value: 'active'
  195. )
  196. click(
  197. css: '.modal .js-submit',
  198. )
  199. modal_disappear
  200. # go back to the org and check for active status update
  201. click(
  202. css: '#navigation .nav-tab[data-key="Organization-1"]',
  203. )
  204. watch_for(
  205. css: '.active .profile-window .userList-entry .avatar--unique',
  206. )
  207. exists_not(
  208. css: '.active .profile-window .userList-entry .avatar--unique.avatar--inactive',
  209. )
  210. end
  211. end