abb_one_group_test.rb 5.0 KB

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