agent_ticket_actions_level1_test.rb 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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.ticket-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_info h3',
  30. :value => '^#(.*)$',
  31. :no_quote => true,
  32. :match_result => true,
  33. },
  34. # update ticket
  35. {
  36. :execute => 'select',
  37. :css => '.active select[name="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.submit',
  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 => 'watch_for',
  82. :area => '.content_permanent.active',
  83. :value => 'some body 123äöü 222',
  84. },
  85. # update ticket
  86. {
  87. :execute => 'select',
  88. :css => '.content_permanent.active select[name="type_id"]',
  89. :value => 'note',
  90. },
  91. {
  92. :execute => 'check',
  93. :css => '.content_permanent.active textarea[name="body"]',
  94. :result => true,
  95. },
  96. {
  97. :execute => 'set',
  98. :css => '.content_permanent.active textarea[name="body"]',
  99. :value => 'some body 1234 äöüß 222',
  100. },
  101. {
  102. :execute => 'click',
  103. :css => '.content_permanent.active button.submit',
  104. },
  105. {
  106. :execute => 'watch_for',
  107. :area => '.content_permanent.active .ticket-answer',
  108. :value => 'some body 1234 äöüß 222',
  109. },
  110. # check if task is shown
  111. {
  112. :execute => 'match',
  113. :css => 'body',
  114. :value => 'test to merge',
  115. :match_result => true,
  116. },
  117. ],
  118. },
  119. {
  120. :name => 'agent ticket merge',
  121. :action => [
  122. {
  123. :execute => 'click',
  124. :css => '.active .actions',
  125. },
  126. {
  127. :execute => 'click',
  128. :css => '.active a[data-type="merge"]',
  129. },
  130. {
  131. :execute => 'wait',
  132. :value => 4,
  133. },
  134. {
  135. :execute => 'set',
  136. :css => '.modal input[name="master_ticket_number"]',
  137. :value => '###stack###',
  138. },
  139. {
  140. :execute => 'click',
  141. :css => '.modal button[type="submit"]',
  142. },
  143. {
  144. :execute => 'wait',
  145. :value => 6,
  146. },
  147. # check if megred to ticket is shown now
  148. {
  149. :execute => 'match',
  150. :css => '.active .ticket_info h3',
  151. :value => '###stack###',
  152. :match_result => true,
  153. },
  154. # check if task is now gone
  155. {
  156. :execute => 'match',
  157. :css => 'body',
  158. :value => 'test to merge',
  159. :match_result => true,
  160. },
  161. # close task/cleanup
  162. {
  163. :execute => 'click',
  164. :css => '#task [data-type="close"]',
  165. },
  166. ],
  167. },
  168. ]
  169. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  170. end
  171. end