abb_one_group_test.rb 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. # Copyright (C) 2012-2022 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 .js-groupListItem[value=full]')
  54. click(
  55. css: '.modal button.btn.btn--primary',
  56. fast: true,
  57. )
  58. watch_for(
  59. css: 'body div.modal',
  60. value: 'Sending',
  61. )
  62. watch_for_disappear(
  63. css: 'body div.modal',
  64. value: 'Sending',
  65. )
  66. click(css: '#navigation a[href="#dashboard"]')
  67. click(css: '.active.content .tab[data-area="first-steps-widgets"]')
  68. watch_for(
  69. css: '.active.content',
  70. value: 'Configuration',
  71. )
  72. click(css: '.active.content .js-inviteAgent')
  73. modal_ready
  74. set(
  75. css: '.modal [name="firstname"]',
  76. value: 'Bob2',
  77. )
  78. set(
  79. css: '.modal [name="lastname"]',
  80. value: 'Smith2',
  81. )
  82. set(
  83. css: '.modal [name="email"]',
  84. value: "#{agent}2@example.com",
  85. )
  86. check(css: '.modal .js-groupListItem[value=full]')
  87. click(
  88. css: '.modal button.btn.btn--primary',
  89. fast: true,
  90. )
  91. watch_for(
  92. css: 'body div.modal',
  93. value: 'Sending',
  94. )
  95. watch_for_disappear(
  96. css: 'body div.modal',
  97. value: 'Sending',
  98. )
  99. tasks_close_all
  100. end
  101. def test_bbb_customer_ticket_create_with_one_group
  102. @browser = browser_instance
  103. login(
  104. username: 'nicole.braun@zammad.org',
  105. password: 'test',
  106. url: browser_url,
  107. )
  108. # customer ticket create
  109. click(css: 'a[href="#new"]', only_if_exists: true)
  110. click(css: 'a[href="#customer_ticket_new"]')
  111. watch_for(
  112. css: '.newTicket',
  113. value: 'New Ticket',
  114. )
  115. exists(css: '.newTicket .form-group.hide select[name="group_id"]')
  116. set(
  117. css: '.newTicket input[name="title"]',
  118. value: 'one group',
  119. )
  120. set(
  121. css: '.newTicket [data-name="body"]',
  122. value: 'one group body',
  123. )
  124. click(css: '.newTicket button.js-submit', wait: 5)
  125. # check if ticket is shown
  126. location_check(url: '#ticket/zoom/')
  127. match(
  128. css: '.active div.ticket-article',
  129. value: 'one group body',
  130. no_quote: true,
  131. )
  132. # update ticket
  133. set(
  134. css: '.active [data-name="body"]',
  135. value: 'one group - some body 1234 äöüß',
  136. no_click: true,
  137. )
  138. task_type(
  139. type: 'stayOnTab',
  140. )
  141. click(css: '.active .js-submit')
  142. watch_for(
  143. css: '.active div.ticket-article',
  144. value: 'one group - some body 1234 äöüß',
  145. )
  146. tasks_close_all
  147. end
  148. def test_ccc_agent_ticket_create_with_more_groups
  149. @browser = browser_instance
  150. login(
  151. username: 'admin@example.com',
  152. password: 'test',
  153. url: browser_url,
  154. )
  155. tasks_close_all
  156. group_create(
  157. data: {
  158. name: "some group #{SecureRandom.uuid}",
  159. member: [
  160. {
  161. login: 'admin@example.com',
  162. access: 'full',
  163. },
  164. {
  165. login: 'agent1@example.com',
  166. access: 'full',
  167. },
  168. ],
  169. },
  170. )
  171. # wait to push new group dependencies to browser (to show group selection)
  172. sleep 12
  173. # create new ticket
  174. ticket_create(
  175. data: {
  176. customer: 'nico',
  177. group: 'Users',
  178. title: 'some subject 123äöü - one group 2',
  179. body: 'some body 123äöü - one group 2',
  180. },
  181. )
  182. sleep 1
  183. # update ticket
  184. ticket_update(
  185. data: {
  186. body: 'some body 1234 äöüß - one group 2 - update',
  187. group: 'Users',
  188. },
  189. )
  190. tasks_close_all
  191. end
  192. end