agent_organization_profile_test.rb 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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)}"
  6. note = "some note #{rand(99_999_999)}"
  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)}"
  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. slow: true,
  125. value: message,
  126. )
  127. empty_search(
  128. browser: browser1,
  129. )
  130. # verify
  131. watch_for(
  132. browser: browser2,
  133. css: '.active .profile-window',
  134. value: message,
  135. )
  136. end
  137. def test_org_profile_user_active_update
  138. @browser = browser_instance
  139. login(
  140. username: 'master@example.com',
  141. password: 'test',
  142. url: browser_url,
  143. )
  144. tasks_close_all()
  145. # search and open org
  146. organization_open_by_search(
  147. value: 'Zammad Foundation',
  148. )
  149. watch_for(
  150. css: '.active .profile-window .userList-entry a.user-popover',
  151. value: 'Nicole Braun',
  152. )
  153. exists(
  154. css: '.active .profile-window .userList-entry .avatar--unique',
  155. )
  156. # open user and change status to inactive
  157. click(
  158. css: '.active .profile-window .userList-entry a.user-popover',
  159. )
  160. click(
  161. css: '.active .profile-window .dropdown #userAction',
  162. )
  163. click(
  164. css: '.active .profile-window .dropdown li[data-type="edit"]',
  165. )
  166. modal_ready()
  167. select(
  168. css: '.active .modal select[name="active"]',
  169. value: 'inactive'
  170. )
  171. click(
  172. css: '.modal .js-submit',
  173. )
  174. modal_disappear()
  175. # go back to the org and check for inactive status update
  176. click(
  177. css: '#navigation .nav-tab[data-key="Organization-1"]',
  178. )
  179. watch_for(
  180. css: '.active .profile-window .userList-entry .avatar--unique.avatar--inactive',
  181. )
  182. # open user and change status to active again
  183. click(
  184. css: '.active .profile-window .userList-entry a.user-popover',
  185. )
  186. click(
  187. css: '.active .profile-window .dropdown #userAction',
  188. )
  189. click(
  190. css: '.active .profile-window .dropdown li[data-type="edit"]',
  191. )
  192. modal_ready()
  193. select(
  194. css: '.active .modal select[name="active"]',
  195. value: 'active'
  196. )
  197. click(
  198. css: '.modal .js-submit',
  199. )
  200. modal_disappear()
  201. # go back to the org and check for active status update
  202. click(
  203. css: '#navigation .nav-tab[data-key="Organization-1"]',
  204. )
  205. watch_for(
  206. css: '.active .profile-window .userList-entry .avatar--unique',
  207. )
  208. exists_not(
  209. css: '.active .profile-window .userList-entry .avatar--unique.avatar--inactive',
  210. )
  211. end
  212. end