taskbar_task_test.rb 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class TaskbarTaskTest < TestCase
  4. def test_persistant_task_a
  5. tests = [
  6. {
  7. :name => 'persistant task',
  8. :action => [
  9. {
  10. :execute => 'wait',
  11. :value => 2,
  12. },
  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"]',
  27. },
  28. {
  29. :execute => 'wait',
  30. :value => 3,
  31. },
  32. {
  33. :execute => 'check',
  34. :css => '.active .newTicket',
  35. :result => true,
  36. },
  37. {
  38. :execute => 'set',
  39. :css => '.active .newTicket input[name="title"]',
  40. :value => 'some test AAA',
  41. },
  42. {
  43. :execute => 'wait',
  44. :value => 12,
  45. },
  46. ],
  47. },
  48. ]
  49. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  50. end
  51. def test_persistant_task_b
  52. tests = [
  53. {
  54. :name => 'persistant task',
  55. :action => [
  56. {
  57. :execute => 'wait',
  58. :value => 4,
  59. },
  60. {
  61. :execute => 'click',
  62. :css => '.task',
  63. },
  64. {
  65. :execute => 'wait',
  66. :value => 1,
  67. },
  68. {
  69. :execute => 'match',
  70. :css => 'body',
  71. :value => 'some test AAA',
  72. :match_result => true,
  73. },
  74. {
  75. :execute => 'close_all_tasks',
  76. },
  77. {
  78. :execute => 'match',
  79. :css => 'body',
  80. :value => 'some test AAA',
  81. :match_result => false,
  82. },
  83. ],
  84. },
  85. ]
  86. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  87. end
  88. def test_persistant_task_with_relogin
  89. tests = [
  90. {
  91. :name => 'agent1 - create persistant task',
  92. :action => [
  93. {
  94. :execute => 'wait',
  95. :value => 2,
  96. },
  97. {
  98. :execute => 'close_all_tasks',
  99. },
  100. {
  101. :execute => 'click',
  102. :css => 'a[href="#new"]',
  103. },
  104. {
  105. :execute => 'click',
  106. :css => 'a[href="#ticket/create"]',
  107. },
  108. {
  109. :execute => 'wait',
  110. :value => 2,
  111. },
  112. {
  113. :execute => 'set',
  114. :css => '.active .newTicket input[name="title"]',
  115. :value => 'INBOUND TEST#1',
  116. },
  117. {
  118. :execute => 'wait',
  119. :value => 4,
  120. },
  121. {
  122. :execute => 'set',
  123. :css => '.active .newTicket [data-name="body"]',
  124. :value => 'INBOUND BODY TEST#1',
  125. },
  126. {
  127. :execute => 'click',
  128. :css => 'a[href="#new"]',
  129. },
  130. {
  131. :execute => 'click',
  132. :css => 'a[href="#ticket/create"]',
  133. },
  134. {
  135. :execute => 'wait',
  136. :value => 2,
  137. },
  138. {
  139. :execute => 'set',
  140. :css => '.active .newTicket input[name="title"]',
  141. :value => 'OUTBOUND TEST#1',
  142. },
  143. {
  144. :execute => 'wait',
  145. :value => 1,
  146. },
  147. {
  148. :execute => 'set',
  149. :css => '.active .newTicket [data-name="body"]',
  150. :value => 'OUTBOUND BODY TEST#1',
  151. },
  152. {
  153. :execute => 'wait',
  154. :value => 12,
  155. },
  156. {
  157. :execute => 'logout',
  158. },
  159. {
  160. :execute => 'check',
  161. :css => '#login',
  162. :result => true,
  163. },
  164. {
  165. :execute => 'wait',
  166. :value => 10,
  167. },
  168. ],
  169. },
  170. {
  171. :name => 'relogin with master - task are not viewable',
  172. :action => [
  173. {
  174. :execute => 'login',
  175. :username => 'master@example.com',
  176. :password => 'test',
  177. },
  178. {
  179. :execute => 'wait',
  180. :value => 6,
  181. },
  182. {
  183. :execute => 'match',
  184. :css => 'body',
  185. :value => 'INBOUND TEST#1',
  186. :match_result => false,
  187. },
  188. {
  189. :execute => 'match',
  190. :css => 'body',
  191. :value => 'OUTBOUND TEST#1',
  192. :match_result => false,
  193. },
  194. {
  195. :execute => 'logout',
  196. },
  197. {
  198. :execute => 'check',
  199. :css => '#login',
  200. :result => true,
  201. },
  202. {
  203. :execute => 'match',
  204. :css => 'body',
  205. :value => 'INBOUND TEST#1',
  206. :match_result => false,
  207. },
  208. {
  209. :execute => 'match',
  210. :css => 'body',
  211. :value => 'OUTBOUND TEST#1',
  212. :match_result => false,
  213. },
  214. ],
  215. },
  216. {
  217. :name => 'relogin with agent - task are viewable',
  218. :action => [
  219. {
  220. :execute => 'login',
  221. :username => 'agent1@example.com',
  222. :password => 'test',
  223. },
  224. {
  225. :execute => 'wait',
  226. :value => 3,
  227. },
  228. {
  229. :execute => 'match',
  230. :css => 'body',
  231. :value => 'INBOUND TEST#1',
  232. :match_result => true,
  233. },
  234. {
  235. :execute => 'match',
  236. :css => 'body',
  237. :value => 'OUTBOUND TEST#1',
  238. :match_result => true,
  239. },
  240. ],
  241. },
  242. ]
  243. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  244. end
  245. end