agent_user_manage_test.rb 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentUserManageTest < TestCase
  4. def test_agent_user
  5. customer_user_email = 'customer-test-' + rand(999999).to_s + '@example.com'
  6. firstname = 'Customer Firstname'
  7. lastname = 'Customer Lastname'
  8. fullname = "#{ firstname } #{ lastname } <#{ customer_user_email }>"
  9. tests = [
  10. {
  11. :name => 'create customer',
  12. :action => [
  13. {
  14. :execute => 'close_all_tasks',
  15. },
  16. {
  17. :execute => 'wait',
  18. :value => 1,
  19. },
  20. {
  21. :execute => 'click',
  22. :css => 'a[href="#new"]',
  23. },
  24. {
  25. :execute => 'click',
  26. :css => 'a[href="#ticket/create/call_inbound"]',
  27. },
  28. {
  29. :execute => 'click',
  30. :css => '.active .customer_new',
  31. },
  32. {
  33. :execute => 'wait',
  34. :value => 2,
  35. },
  36. {
  37. :execute => 'set',
  38. :css => '.modal input[name="firstname"]',
  39. :value => firstname,
  40. },
  41. {
  42. :execute => 'set',
  43. :css => '.modal input[name="lastname"]',
  44. :value => lastname,
  45. },
  46. {
  47. :execute => 'set',
  48. :css => '.modal input[name="email"]',
  49. :value => customer_user_email,
  50. },
  51. {
  52. :execute => 'click',
  53. :css => '.modal button.submit',
  54. },
  55. {
  56. :execute => 'wait',
  57. :value => 4,
  58. },
  59. # check is used is selected
  60. {
  61. :execute => 'match',
  62. :css => '.active input[name="customer_id"]',
  63. :value => '^[0-9].?$',
  64. :no_quote => true,
  65. :match_result => true,
  66. },
  67. {
  68. :execute => 'match',
  69. :css => '.active input[name="customer_id_autocompletion"]',
  70. :value => firstname,
  71. :no_quote => true,
  72. :match_result => true,
  73. },
  74. {
  75. :execute => 'match',
  76. :css => '.active input[name="customer_id_autocompletion"]',
  77. :value => lastname,
  78. :no_quote => true,
  79. :match_result => true,
  80. },
  81. {
  82. :execute => 'match',
  83. :css => '.active input[name="customer_id_autocompletion"]',
  84. :value => customer_user_email,
  85. :no_quote => true,
  86. :match_result => true,
  87. },
  88. {
  89. :execute => 'match',
  90. :css => '.active input[name="customer_id_autocompletion"]',
  91. :value => fullname,
  92. :no_quote => true,
  93. :match_result => true,
  94. },
  95. # call new ticket screen again
  96. {
  97. :execute => 'click',
  98. :css => '.taskbar span[data-type="close"]',
  99. },
  100. {
  101. :execute => 'wait',
  102. :value => 2,
  103. },
  104. # accept task close warning
  105. {
  106. :execute => 'click',
  107. :css => '.modal .submit',
  108. },
  109. {
  110. :execute => 'wait',
  111. :value => 1,
  112. },
  113. {
  114. :execute => 'click',
  115. :css => 'a[href="#new"]',
  116. },
  117. {
  118. :execute => 'click',
  119. :css => 'a[href="#ticket/create/call_inbound"]',
  120. },
  121. {
  122. :execute => 'wait',
  123. :value => 2,
  124. },
  125. {
  126. :execute => 'match',
  127. :css => '.active input[name="customer_id"]',
  128. :value => '^[0-9].?$',
  129. :no_quote => true,
  130. :match_result => false,
  131. },
  132. {
  133. :execute => 'match',
  134. :css => '.active input[name="customer_id_autocompletion"]',
  135. :value => firstname,
  136. :no_quote => true,
  137. :match_result => false,
  138. },
  139. {
  140. :execute => 'set',
  141. :css => '.active .ticket-create input[name="customer_id_autocompletion"]',
  142. :value => customer_user_email,
  143. },
  144. {
  145. :execute => 'wait',
  146. :value => 3,
  147. },
  148. {
  149. :execute => 'sendkey',
  150. :css => '.active .ticket-create input[name="customer_id_autocompletion"]',
  151. :value => :arrow_down,
  152. },
  153. {
  154. :execute => 'sendkey',
  155. :css => '.active .ticket-create input[name="customer_id_autocompletion"]',
  156. :value => :tab,
  157. },
  158. {
  159. :execute => 'wait',
  160. :value => 1,
  161. },
  162. {
  163. :execute => 'match',
  164. :css => '.active input[name="customer_id"]',
  165. :value => '^[0-9].?$',
  166. :no_quote => true,
  167. :match_result => true,
  168. },
  169. {
  170. :execute => 'match',
  171. :css => '.active input[name="customer_id_autocompletion"]',
  172. :value => firstname,
  173. :no_quote => true,
  174. :match_result => true,
  175. },
  176. {
  177. :execute => 'match',
  178. :css => '.active input[name="customer_id_autocompletion"]',
  179. :value => lastname,
  180. :no_quote => true,
  181. :match_result => true,
  182. },
  183. {
  184. :execute => 'match',
  185. :css => '.active input[name="customer_id_autocompletion"]',
  186. :value => fullname,
  187. :no_quote => true,
  188. :match_result => true,
  189. },
  190. ],
  191. },
  192. ]
  193. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  194. end
  195. end