taskbar_task_test.rb 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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/call_inbound"]',
  27. },
  28. {
  29. :execute => 'wait',
  30. :value => 3,
  31. },
  32. {
  33. :execute => 'check',
  34. :css => '.active .ticket_create',
  35. :result => true,
  36. },
  37. {
  38. :execute => 'set',
  39. :css => '.active .ticket_create input[name="subject"]',
  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 => 'click',
  76. :css => '.taskbar [data-type="close"]',
  77. },
  78. {
  79. :execute => 'match',
  80. :css => 'body',
  81. :value => 'some test AAA',
  82. :match_result => false,
  83. },
  84. ],
  85. },
  86. ]
  87. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  88. end
  89. def test_persistant_task_with_relogin
  90. tests = [
  91. {
  92. :name => 'agent1 - create persistant task',
  93. :action => [
  94. {
  95. :execute => 'wait',
  96. :value => 2,
  97. },
  98. {
  99. :execute => 'close_all_tasks',
  100. },
  101. {
  102. :execute => 'click',
  103. :css => 'a[href="#new"]',
  104. },
  105. {
  106. :execute => 'click',
  107. :css => 'a[href="#ticket_create/call_inbound"]',
  108. },
  109. {
  110. :execute => 'wait',
  111. :value => 3,
  112. },
  113. {
  114. :execute => 'set',
  115. :css => '.active .ticket_create input[name="subject"]',
  116. :value => 'INBOUND TEST#1',
  117. },
  118. {
  119. :execute => 'click',
  120. :css => 'a[href="#new"]',
  121. },
  122. {
  123. :execute => 'click',
  124. :css => 'a[href="#ticket_create/call_outbound"]',
  125. },
  126. {
  127. :execute => 'wait',
  128. :value => 1,
  129. },
  130. {
  131. :execute => 'set',
  132. :css => '.active .ticket_create input[name="subject"]',
  133. :value => 'OUTBOUND TEST#1',
  134. },
  135. {
  136. :execute => 'wait',
  137. :value => 12,
  138. },
  139. {
  140. :execute => 'click',
  141. :css => 'a[href="#current_user"]',
  142. },
  143. {
  144. :execute => 'click',
  145. :css => 'a[href="#logout"]',
  146. },
  147. {
  148. :execute => 'check',
  149. :css => '#login',
  150. :result => true,
  151. },
  152. {
  153. :execute => 'wait',
  154. :value => 10,
  155. },
  156. ],
  157. },
  158. {
  159. :name => 'relogin with master - task are not viewable',
  160. :action => [
  161. {
  162. :execute => 'set',
  163. :css => 'input[name="username"]',
  164. :value => 'master@example.com',
  165. },
  166. {
  167. :execute => 'set',
  168. :css => 'input[name="password"]',
  169. :value => 'test'
  170. },
  171. {
  172. :execute => 'click',
  173. :css => '#login button',
  174. },
  175. {
  176. :execute => 'wait',
  177. :value => 6,
  178. },
  179. {
  180. :execute => 'match',
  181. :css => 'body',
  182. :value => 'INBOUND TEST#1',
  183. :match_result => false,
  184. },
  185. {
  186. :execute => 'match',
  187. :css => 'body',
  188. :value => 'OUTBOUND TEST#1',
  189. :match_result => false,
  190. },
  191. {
  192. :execute => 'click',
  193. :css => 'a[href="#current_user"]',
  194. },
  195. {
  196. :execute => 'click',
  197. :css => 'a[href="#logout"]',
  198. },
  199. {
  200. :execute => 'check',
  201. :css => '#login',
  202. :result => true,
  203. },
  204. {
  205. :execute => 'match',
  206. :css => 'body',
  207. :value => 'INBOUND TEST#1',
  208. :match_result => false,
  209. },
  210. {
  211. :execute => 'match',
  212. :css => 'body',
  213. :value => 'OUTBOUND TEST#1',
  214. :match_result => false,
  215. },
  216. ],
  217. },
  218. {
  219. :name => 'relogin with agent - task are viewable',
  220. :action => [
  221. {
  222. :execute => 'set',
  223. :css => 'input[name="username"]',
  224. :value => 'agent1@example.com',
  225. },
  226. {
  227. :execute => 'set',
  228. :css => 'input[name="password"]',
  229. :value => 'test'
  230. },
  231. {
  232. :execute => 'click',
  233. :css => '#login button',
  234. },
  235. {
  236. :execute => 'wait',
  237. :value => 2,
  238. },
  239. {
  240. :execute => 'match',
  241. :css => 'body',
  242. :value => 'INBOUND TEST#1',
  243. :match_result => true,
  244. },
  245. {
  246. :execute => 'match',
  247. :css => 'body',
  248. :value => 'OUTBOUND TEST#1',
  249. :match_result => true,
  250. },
  251. ],
  252. },
  253. ]
  254. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  255. end
  256. end