agent_user_manage_test.rb 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. tests = [
  7. {
  8. :name => 'create customer',
  9. :action => [
  10. {
  11. :execute => 'close_all_tasks',
  12. },
  13. {
  14. :execute => 'wait',
  15. :value => 1,
  16. },
  17. {
  18. :execute => 'click',
  19. :css => 'a[href="#new"]',
  20. },
  21. {
  22. :execute => 'click',
  23. :css => 'a[href="#ticket_create/call_inbound"]',
  24. },
  25. {
  26. :execute => 'click',
  27. :css => '.active .customer_new',
  28. },
  29. {
  30. :execute => 'wait',
  31. :value => 2,
  32. },
  33. {
  34. :execute => 'set',
  35. :css => '.modal input[name="firstname"]',
  36. :value => 'Customer Firstname',
  37. },
  38. {
  39. :execute => 'set',
  40. :css => '.modal input[name="lastname"]',
  41. :value => 'Customer Lastname',
  42. },
  43. {
  44. :execute => 'set',
  45. :css => '.modal input[name="email"]',
  46. :value => customer_user_email,
  47. },
  48. {
  49. :execute => 'click',
  50. :css => '.modal button',
  51. },
  52. {
  53. :execute => 'wait',
  54. :value => 4,
  55. },
  56. # check is used is selected
  57. {
  58. :execute => 'match',
  59. :css => '.active input[name="customer_id"]',
  60. :value => '^[0-9].?$',
  61. :no_quote => true,
  62. :match_result => true,
  63. },
  64. {
  65. :execute => 'match',
  66. :css => '.active input[name="customer_id_autocompletion"]',
  67. :value => 'Customer',
  68. :no_quote => true,
  69. :match_result => true,
  70. },
  71. # call new ticket screen again
  72. {
  73. :execute => 'click',
  74. :css => '.taskbar span[data-type="close"]',
  75. },
  76. {
  77. :execute => 'wait',
  78. :value => 2,
  79. },
  80. # accept task close warning
  81. {
  82. :execute => 'click',
  83. :css => '.modal .submit',
  84. },
  85. {
  86. :execute => 'wait',
  87. :value => 1,
  88. },
  89. {
  90. :execute => 'click',
  91. :css => 'a[href="#new"]',
  92. },
  93. {
  94. :execute => 'click',
  95. :css => 'a[href="#ticket_create/call_inbound"]',
  96. },
  97. {
  98. :execute => 'wait',
  99. :value => 2,
  100. },
  101. {
  102. :execute => 'match',
  103. :css => '.active input[name="customer_id"]',
  104. :value => '^[0-9].?$',
  105. :no_quote => true,
  106. :match_result => false,
  107. },
  108. {
  109. :execute => 'match',
  110. :css => '.active input[name="customer_id_autocompletion"]',
  111. :value => 'Customer',
  112. :no_quote => true,
  113. :match_result => false,
  114. },
  115. {
  116. :execute => 'set',
  117. :css => '.active .ticket_create input[name="customer_id_autocompletion"]',
  118. :value => customer_user_email,
  119. },
  120. {
  121. :execute => 'wait',
  122. :value => 3,
  123. },
  124. {
  125. :execute => 'sendkey',
  126. :css => '.active .ticket_create input[name="customer_id_autocompletion"]',
  127. :value => :arrow_down,
  128. },
  129. {
  130. :execute => 'sendkey',
  131. :css => '.active .ticket_create input[name="customer_id_autocompletion"]',
  132. :value => :tab,
  133. },
  134. {
  135. :execute => 'wait',
  136. :value => 1,
  137. },
  138. {
  139. :execute => 'match',
  140. :css => '.active input[name="customer_id"]',
  141. :value => '^[0-9].?$',
  142. :no_quote => true,
  143. :match_result => true,
  144. },
  145. {
  146. :execute => 'match',
  147. :css => '.active input[name="customer_id_autocompletion"]',
  148. :value => 'Customer',
  149. :no_quote => true,
  150. :match_result => true,
  151. },
  152. ],
  153. },
  154. ]
  155. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  156. end
  157. end