abb_one_group_test.rb 4.9 KB

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