taskbar_task_test.rb 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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 => 2,
  112. },
  113. {
  114. :execute => 'set',
  115. :css => '.active .ticket_create input[name="subject"]',
  116. :value => 'INBOUND TEST#1',
  117. },
  118. {
  119. :execute => 'wait',
  120. :value => 4,
  121. },
  122. {
  123. :execute => 'set',
  124. :css => '.active .ticket_create textarea[name="body"]',
  125. :value => 'INBOUND BODY TEST#1',
  126. },
  127. {
  128. :execute => 'click',
  129. :css => 'a[href="#new"]',
  130. },
  131. {
  132. :execute => 'click',
  133. :css => 'a[href="#ticket_create/call_outbound"]',
  134. },
  135. {
  136. :execute => 'wait',
  137. :value => 2,
  138. },
  139. {
  140. :execute => 'set',
  141. :css => '.active .ticket_create input[name="subject"]',
  142. :value => 'OUTBOUND TEST#1',
  143. },
  144. {
  145. :execute => 'wait',
  146. :value => 1,
  147. },
  148. {
  149. :execute => 'set',
  150. :css => '.active .ticket_create textarea[name="body"]',
  151. :value => 'OUTBOUND BODY TEST#1',
  152. },
  153. {
  154. :execute => 'wait',
  155. :value => 12,
  156. },
  157. {
  158. :execute => 'logout',
  159. },
  160. {
  161. :execute => 'check',
  162. :css => '#login',
  163. :result => true,
  164. },
  165. {
  166. :execute => 'wait',
  167. :value => 10,
  168. },
  169. ],
  170. },
  171. {
  172. :name => 'relogin with master - task are not viewable',
  173. :action => [
  174. {
  175. :execute => 'login',
  176. :username => 'master@example.com',
  177. :password => 'test',
  178. },
  179. {
  180. :execute => 'wait',
  181. :value => 6,
  182. },
  183. {
  184. :execute => 'match',
  185. :css => 'body',
  186. :value => 'INBOUND TEST#1',
  187. :match_result => false,
  188. },
  189. {
  190. :execute => 'match',
  191. :css => 'body',
  192. :value => 'OUTBOUND TEST#1',
  193. :match_result => false,
  194. },
  195. {
  196. :execute => 'logout',
  197. },
  198. {
  199. :execute => 'check',
  200. :css => '#login',
  201. :result => true,
  202. },
  203. {
  204. :execute => 'match',
  205. :css => 'body',
  206. :value => 'INBOUND TEST#1',
  207. :match_result => false,
  208. },
  209. {
  210. :execute => 'match',
  211. :css => 'body',
  212. :value => 'OUTBOUND TEST#1',
  213. :match_result => false,
  214. },
  215. ],
  216. },
  217. {
  218. :name => 'relogin with agent - task are viewable',
  219. :action => [
  220. {
  221. :execute => 'login',
  222. :username => 'agent1@example.com',
  223. :password => 'test',
  224. },
  225. {
  226. :execute => 'wait',
  227. :value => 3,
  228. },
  229. {
  230. :execute => 'match',
  231. :css => 'body',
  232. :value => 'INBOUND TEST#1',
  233. :match_result => true,
  234. },
  235. {
  236. :execute => 'match',
  237. :css => 'body',
  238. :value => 'OUTBOUND TEST#1',
  239. :match_result => true,
  240. },
  241. ],
  242. },
  243. ]
  244. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  245. end
  246. end