agent_organization_profile_test.rb 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. require 'browser_test_helper'
  2. class AgentOrganizationProfileTest < TestCase
  3. def test_org_profile
  4. # work in one browser window
  5. message = '1 ' + rand(99_999_999).to_s
  6. note = 'some note ' + rand(99_999_999).to_s
  7. @browser = browser_instance
  8. login(
  9. username: 'master@example.com',
  10. password: 'test',
  11. url: browser_url,
  12. )
  13. tasks_close_all()
  14. # search and open org
  15. organization_open_by_search(
  16. value: 'Zammad Foundation',
  17. )
  18. verify_task(
  19. data: {
  20. title: 'Zammad Foundation',
  21. }
  22. )
  23. watch_for(
  24. css: '.active .profile-window',
  25. value: 'note',
  26. )
  27. watch_for(
  28. css: '.active .profile-window',
  29. value: 'member',
  30. )
  31. # update note
  32. set(
  33. css: '.active .profile [data-name="note"]',
  34. value: note,
  35. )
  36. empty_search()
  37. sleep 2
  38. # check and change note again in edit screen
  39. click(css: '.active .js-action .icon-arrow-down', fast: true)
  40. click(css: '.active .js-action [data-type="edit"]')
  41. modal_ready()
  42. watch_for(
  43. css: '.active .modal',
  44. value: note,
  45. )
  46. set(
  47. css: '.modal [name="name"]',
  48. value: 'Z2',
  49. )
  50. set(
  51. css: '.active .modal [data-name="note"]',
  52. value: 'some note abc',
  53. )
  54. click(css: '.active .modal button.js-submit')
  55. modal_disappear()
  56. watch_for(
  57. css: '.active .profile-window',
  58. value: 'some note abc',
  59. )
  60. verify_task(
  61. data: {
  62. title: 'Z2',
  63. }
  64. )
  65. # change lastname back
  66. click(css: '.active .js-action .icon-arrow-down', fast: true)
  67. click(css: '.active .js-action [data-type="edit"]')
  68. modal_ready()
  69. set(
  70. css: '.modal [name="name"]',
  71. value: 'Zammad Foundation',
  72. )
  73. click(css: '.active .modal button.js-submit')
  74. modal_disappear()
  75. verify_task(
  76. data: {
  77. title: 'Zammad Foundation',
  78. }
  79. )
  80. # create new ticket
  81. ticket_create(
  82. data: {
  83. customer: 'nico',
  84. group: 'Users',
  85. title: 'org profile check ' + message,
  86. body: 'org profile check ' + message,
  87. },
  88. )
  89. # switch to org tab, verify if ticket is shown
  90. organization_open_by_search(
  91. value: 'Zammad Foundation',
  92. )
  93. watch_for(
  94. css: '.active .profile-window',
  95. value: 'org profile check ' + message,
  96. )
  97. tasks_close_all()
  98. # work with two browser windows
  99. message = 'comment 1 ' + rand(99_999_999_999_999_999).to_s
  100. # use current session
  101. browser1 = @browser
  102. browser2 = browser_instance
  103. login(
  104. browser: browser2,
  105. username: 'agent1@example.com',
  106. password: 'test',
  107. url: browser_url,
  108. )
  109. tasks_close_all(
  110. browser: browser2,
  111. )
  112. organization_open_by_search(
  113. browser: browser1,
  114. value: 'Zammad Foundation',
  115. )
  116. organization_open_by_search(
  117. browser: browser2,
  118. value: 'Zammad Foundation',
  119. )
  120. # update note
  121. set(
  122. browser: browser1,
  123. css: '.active .profile [data-name="note"]',
  124. value: message,
  125. )
  126. empty_search(
  127. browser: browser1,
  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: 'master@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