agent_ticket_actions_level1_test.rb 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketActionLevel1Test < TestCase
  4. def test_agent_ticket_create
  5. tests = [
  6. {
  7. :name => 'agent ticket create 1',
  8. :action => [
  9. {
  10. :execute => 'close_all_tasks',
  11. },
  12. # create ticket
  13. {
  14. :execute => 'create_ticket',
  15. :group => 'Users',
  16. :subject => 'some subject 123äöü',
  17. :body => 'some body 123äöü',
  18. },
  19. # check ticket
  20. {
  21. :execute => 'match',
  22. :css => '.active div.article',
  23. :value => 'some body 123äöü',
  24. :match_result => true,
  25. },
  26. # remember old ticket where we want to merge to
  27. {
  28. :execute => 'match',
  29. :css => '.active .ticket-zoom small',
  30. :value => '^(.*)$',
  31. :no_quote => true,
  32. :match_result => true,
  33. },
  34. # update ticket
  35. {
  36. :execute => 'select',
  37. :css => '.active select[name="ticket_article_type_id"]',
  38. :value => 'note',
  39. },
  40. {
  41. :execute => 'check',
  42. :css => '.active textarea[name="body"]',
  43. :result => true,
  44. },
  45. {
  46. :execute => 'set',
  47. :css => '.active textarea[name="body"]',
  48. :value => 'some body 1234 äöüß',
  49. },
  50. {
  51. :execute => 'click',
  52. :css => '.active button',
  53. },
  54. {
  55. :execute => 'wait',
  56. :value => 2,
  57. },
  58. {
  59. :execute => 'watch_for',
  60. :area => 'body',
  61. :value => 'some body 1234 äöüß',
  62. },
  63. {
  64. :execute => 'click',
  65. :css => '#task [data-type="close"]',
  66. },
  67. ],
  68. },
  69. {
  70. :name => 'agent ticket create 2',
  71. :action => [
  72. # create ticket
  73. {
  74. :execute => 'create_ticket',
  75. :group => 'Users',
  76. :subject => 'test to merge',
  77. :body => 'some body 123äöü 222',
  78. },
  79. # check ticket
  80. {
  81. :execute => 'match',
  82. :css => '.content_permanent.active',
  83. :value => 'some body 123äöü 222',
  84. :match_result => true,
  85. },
  86. # update ticket
  87. {
  88. :execute => 'select',
  89. :css => '.content_permanent.active select[name="ticket_article_type_id"]',
  90. :value => 'note',
  91. },
  92. {
  93. :execute => 'check',
  94. :css => '.content_permanent.active textarea[name="body"]',
  95. :result => true,
  96. },
  97. {
  98. :execute => 'set',
  99. :css => '.content_permanent.active textarea[name="body"]',
  100. :value => 'some body 1234 äöüß 222',
  101. },
  102. {
  103. :execute => 'click',
  104. :css => '.content_permanent.active button',
  105. },
  106. {
  107. :execute => 'wait',
  108. :value => 5,
  109. },
  110. {
  111. :execute => 'match',
  112. :css => '.content_permanent.active .ticket-answer',
  113. :value => 'some body 1234 äöüß 222',
  114. :match_result => true,
  115. },
  116. # check if task is shown
  117. {
  118. :execute => 'match',
  119. :css => 'body',
  120. :value => 'test to merge',
  121. :match_result => true,
  122. },
  123. ],
  124. },
  125. {
  126. :name => 'agent ticket merge',
  127. :action => [
  128. {
  129. :execute => 'click',
  130. :css => '.active a[data-type="merge"]',
  131. },
  132. {
  133. :execute => 'wait',
  134. :value => 4,
  135. },
  136. {
  137. :execute => 'set',
  138. :css => '.modal input[name="master_ticket_number"]',
  139. :value => '###stack###',
  140. },
  141. {
  142. :execute => 'click',
  143. :css => '.modal button[type="submit"]',
  144. },
  145. {
  146. :execute => 'wait',
  147. :value => 6,
  148. },
  149. # check if megred to ticket is shown now
  150. {
  151. :execute => 'match',
  152. :css => '.active .ticket-zoom small',
  153. :value => '###stack###',
  154. :match_result => true,
  155. },
  156. # check if task is now gone
  157. {
  158. :execute => 'match',
  159. :css => 'body',
  160. :value => 'test to merge',
  161. :match_result => true,
  162. },
  163. # close task/cleanup
  164. {
  165. :execute => 'click',
  166. :css => '#task [data-type="close"]',
  167. },
  168. ],
  169. },
  170. ]
  171. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  172. end
  173. end