abb_one_group_test.rb 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. require 'browser_test_helper'
  2. class AgentTicketActionLevel0Test < TestCase
  3. def test_aaa_agent_ticket_create_with_one_group
  4. agent = "bob.smith_one_group#{rand(99_999_999)}"
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # create new ticket
  13. ticket_create(
  14. data: {
  15. customer: 'nico',
  16. group: '-NONE-',
  17. title: 'some subject 123äöü - one group 1',
  18. body: 'some body 123äöü - one group 1',
  19. },
  20. )
  21. sleep 1
  22. # update ticket
  23. ticket_update(
  24. data: {
  25. state: 'closed',
  26. group: '-NONE-',
  27. body: 'some body 1234 äöüß - one group 1 - update',
  28. },
  29. )
  30. tasks_close_all()
  31. # invite agent (with one group)
  32. click(css: '#navigation a[href="#dashboard"]')
  33. click(css: '.active.content .tab[data-area="first-steps-widgets"]')
  34. watch_for(
  35. css: '.active.content',
  36. value: 'Configuration',
  37. )
  38. click(css: '.active.content .js-inviteAgent')
  39. modal_ready()
  40. set(
  41. css: '.modal [name="firstname"]',
  42. value: 'Bob',
  43. )
  44. set(
  45. css: '.modal [name="lastname"]',
  46. value: 'Smith',
  47. )
  48. set(
  49. css: '.modal [name="email"]',
  50. value: "#{agent}@example.com",
  51. )
  52. exists(
  53. displayed: false,
  54. css: '.modal .js-groupList',
  55. )
  56. exists(
  57. css: '.modal .js-groupListItem[value=full]:checked',
  58. )
  59. click(
  60. css: '.modal button.btn.btn--primary',
  61. fast: true,
  62. )
  63. watch_for(
  64. css: 'body div.modal',
  65. value: 'Sending',
  66. )
  67. watch_for_disappear(
  68. css: 'body div.modal',
  69. value: 'Sending',
  70. )
  71. click(css: '#navigation a[href="#dashboard"]')
  72. click(css: '.active.content .tab[data-area="first-steps-widgets"]')
  73. watch_for(
  74. css: '.active.content',
  75. value: 'Configuration',
  76. )
  77. click(css: '.active.content .js-inviteAgent')
  78. modal_ready()
  79. set(
  80. css: '.modal [name="firstname"]',
  81. value: 'Bob2',
  82. )
  83. set(
  84. css: '.modal [name="lastname"]',
  85. value: 'Smith2',
  86. )
  87. set(
  88. css: '.modal [name="email"]',
  89. value: "#{agent}2@example.com",
  90. )
  91. # disable agent role
  92. uncheck(
  93. css: '.modal [name="role_ids"][value=2]',
  94. )
  95. exists(
  96. displayed: false,
  97. css: '.modal .js-groupList',
  98. )
  99. exists_not(
  100. css: '.modal .js-groupListItem[value=full]:checked',
  101. )
  102. # enable agent role
  103. check(
  104. css: '.modal [name="role_ids"][value=2]',
  105. )
  106. exists(
  107. displayed: false,
  108. css: '.modal .js-groupList',
  109. )
  110. exists(
  111. css: '.modal .js-groupListItem[value=full]:checked',
  112. )
  113. click(
  114. css: '.modal button.btn.btn--primary',
  115. fast: true,
  116. )
  117. watch_for(
  118. css: 'body div.modal',
  119. value: 'Sending',
  120. )
  121. watch_for_disappear(
  122. css: 'body div.modal',
  123. value: 'Sending',
  124. )
  125. tasks_close_all()
  126. end
  127. def test_bbb_customer_ticket_create_with_one_group
  128. @browser = browser_instance
  129. login(
  130. username: 'nicole.braun@zammad.org',
  131. password: 'test',
  132. url: browser_url,
  133. )
  134. # customer ticket create
  135. click(css: 'a[href="#new"]', only_if_exists: true)
  136. click(css: 'a[href="#customer_ticket_new"]')
  137. watch_for(
  138. css: '.newTicket',
  139. value: 'New Ticket',
  140. )
  141. exists_not(css: '.newTicket select[name="group_id"]')
  142. set(
  143. css: '.newTicket input[name="title"]',
  144. value: 'one group',
  145. )
  146. set(
  147. css: '.newTicket [data-name="body"]',
  148. value: 'one group body',
  149. )
  150. click(css: '.newTicket button.js-submit', wait: 5)
  151. # check if ticket is shown
  152. location_check(url: '#ticket/zoom/')
  153. match(
  154. css: '.active div.ticket-article',
  155. value: 'one group body',
  156. no_quote: true,
  157. )
  158. # update ticket
  159. set(
  160. css: '.active [data-name="body"]',
  161. value: 'one group - some body 1234 äöüß',
  162. no_click: true,
  163. )
  164. task_type(
  165. type: 'stayOnTab',
  166. )
  167. click(css: '.active .js-submit')
  168. watch_for(
  169. css: '.active div.ticket-article',
  170. value: 'one group - some body 1234 äöüß',
  171. )
  172. tasks_close_all()
  173. end
  174. def test_ccc_agent_ticket_create_with_more_groups
  175. @browser = browser_instance
  176. login(
  177. username: 'master@example.com',
  178. password: 'test',
  179. url: browser_url,
  180. )
  181. tasks_close_all()
  182. group_create(
  183. data: {
  184. name: "some group #{rand(999_999_999)}",
  185. member: [
  186. {
  187. login: 'master@example.com',
  188. access: 'full',
  189. },
  190. {
  191. login: 'agent1@example.com',
  192. access: 'full',
  193. },
  194. ],
  195. },
  196. )
  197. # wait to push new group dependencies to browser (to show group selection)
  198. sleep 12
  199. # create new ticket
  200. ticket_create(
  201. data: {
  202. customer: 'nico',
  203. group: 'Users',
  204. title: 'some subject 123äöü - one group 2',
  205. body: 'some body 123äöü - one group 2',
  206. },
  207. )
  208. sleep 1
  209. # update ticket
  210. ticket_update(
  211. data: {
  212. body: 'some body 1234 äöüß - one group 2 - update',
  213. group: 'Users',
  214. },
  215. )
  216. tasks_close_all()
  217. end
  218. end