manage_test.rb 5.5 KB

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