abb_one_group_test.rb 5.1 KB

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