manage_test.rb 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class ManageTest < TestCase
  4. def test_user
  5. random = 'manage-test-' + rand(999999).to_s
  6. user_email = random + '@example.com'
  7. # user
  8. tests = [
  9. {
  10. :name => 'user',
  11. :action => [
  12. {
  13. :execute => 'click',
  14. :css => 'a[href="#manage"]',
  15. },
  16. {
  17. :execute => 'click',
  18. :css => 'a[href="#manage/users"]',
  19. },
  20. {
  21. :execute => 'create_user',
  22. :login => 'some login' + random,
  23. :firstname => 'Manage Firstname' + random,
  24. :lastname => 'Manage Lastname' + random,
  25. :email => user_email,
  26. :password => 'some-pass',
  27. },
  28. {
  29. :execute => 'set',
  30. :css => '.content .js-search',
  31. :value => user_email,
  32. },
  33. {
  34. :execute => 'watch_for',
  35. :area => 'body',
  36. :value => random,
  37. },
  38. {
  39. :execute => 'click',
  40. :css => '.table-overview tr:last-child td',
  41. },
  42. {
  43. :execute => 'wait',
  44. :value => 2,
  45. },
  46. {
  47. :execute => 'set',
  48. :css => '.modal input[name="lastname"]',
  49. :value => '2Manage Lastname' + random,
  50. },
  51. {
  52. :execute => 'click',
  53. :css => '.modal button.js-submit',
  54. },
  55. {
  56. :execute => 'watch_for',
  57. :area => 'body',
  58. :value => '2Manage Lastname' + random,
  59. },
  60. {
  61. :execute => 'wait',
  62. :value => 1,
  63. },
  64. ],
  65. },
  66. {
  67. :name => 'sla',
  68. :action => [
  69. {
  70. :execute => 'click',
  71. :css => 'a[href="#manage"]',
  72. },
  73. {
  74. :execute => 'click',
  75. :css => 'a[href="#manage/slas"]',
  76. },
  77. {
  78. :execute => 'wait',
  79. :value => 2,
  80. },
  81. {
  82. :execute => 'click',
  83. :css => 'a[data-type="new"]',
  84. },
  85. {
  86. :execute => 'wait',
  87. :value => 2,
  88. },
  89. {
  90. :execute => 'set',
  91. :css => '.modal input[name=name]',
  92. :value => 'some sla' + random,
  93. },
  94. {
  95. :execute => 'set',
  96. :css => '.modal input[name="first_response_time"]',
  97. :value => 61,
  98. },
  99. {
  100. :execute => 'click',
  101. :css => '.modal button.js-submit',
  102. },
  103. {
  104. :execute => 'watch_for',
  105. :area => 'body',
  106. :value => random,
  107. },
  108. {
  109. :execute => 'wait',
  110. :value => 3,
  111. },
  112. {
  113. :execute => 'click',
  114. :css => '.table-overview tr:last-child td',
  115. },
  116. {
  117. :execute => 'wait',
  118. :value => 1,
  119. },
  120. {
  121. :execute => 'set',
  122. :css => '.modal input[name=name]',
  123. :value => 'some sla update ' + random,
  124. },
  125. {
  126. :execute => 'set',
  127. :css => '.modal input[name="first_response_time"]',
  128. :value => 121,
  129. },
  130. {
  131. :execute => 'click',
  132. :css => '.modal button.js-submit',
  133. },
  134. {
  135. :execute => 'watch_for',
  136. :area => 'body table',
  137. :value => 'some sla update ' + random,
  138. },
  139. {
  140. :execute => 'wait',
  141. :value => 4,
  142. },
  143. {
  144. :execute => 'click',
  145. :css => 'a[data-type="destroy"]:last-child',
  146. },
  147. {
  148. :execute => 'wait',
  149. :value => 2,
  150. },
  151. {
  152. :execute => 'click',
  153. :css => '.modal button.js-submit',
  154. },
  155. {
  156. :execute => 'wait',
  157. :value => 3,
  158. },
  159. {
  160. :execute => 'match',
  161. :css => 'body',
  162. :value => 'some sla update ' + random,
  163. :match_result => false,
  164. },
  165. {
  166. :execute => 'click',
  167. :css => 'a[href="#/"]',
  168. },
  169. {
  170. :execute => 'click',
  171. :css => 'a[href="#manage"]',
  172. },
  173. {
  174. :execute => 'click',
  175. :css => 'a[href="#manage/slas"]',
  176. },
  177. {
  178. :execute => 'wait',
  179. :value => 2,
  180. },
  181. {
  182. :execute => 'match',
  183. :css => 'body',
  184. :value => 'some sla update ' + random,
  185. :match_result => false,
  186. },
  187. {
  188. :execute => 'reload',
  189. },
  190. {
  191. :execute => 'wait',
  192. :value => 2,
  193. },
  194. {
  195. :execute => 'click',
  196. :css => 'a[href="#/"]',
  197. },
  198. {
  199. :execute => 'click',
  200. :css => 'a[href="#manage"]',
  201. },
  202. {
  203. :execute => 'click',
  204. :css => 'a[href="#manage/slas"]',
  205. },
  206. {
  207. :execute => 'wait',
  208. :value => 2,
  209. },
  210. {
  211. :execute => 'match',
  212. :css => 'body',
  213. :value => 'some sla update ' + random,
  214. :match_result => false,
  215. },
  216. ],
  217. },
  218. ]
  219. browser_signle_test_with_login(tests, { :username => 'master@example.com' })
  220. end
  221. end