agent_ticket_actions_level1_test.rb 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 .page-header .ticket-number',
  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 => 'set_ticket_attributes',
  42. :body => 'some body 1234 äöüß',
  43. },
  44. {
  45. :execute => 'click',
  46. :css => '.content.active button.js-submit',
  47. },
  48. {
  49. :execute => 'wait',
  50. :value => 2,
  51. },
  52. {
  53. :execute => 'watch_for',
  54. :area => 'body',
  55. :value => 'some body 1234 äöüß',
  56. },
  57. {
  58. :execute => 'close_all_tasks',
  59. },
  60. ],
  61. },
  62. {
  63. :name => 'agent ticket create 2',
  64. :action => [
  65. # create ticket
  66. {
  67. :execute => 'create_ticket',
  68. :group => 'Users',
  69. :subject => 'test to merge',
  70. :body => 'some body 123äöü 222 - test to merge',
  71. },
  72. # check ticket
  73. {
  74. :execute => 'watch_for',
  75. :area => '.content.active',
  76. :value => 'some body 123äöü 222 - test to merge',
  77. },
  78. # update ticket
  79. #{
  80. # :execute => 'select',
  81. # :css => '.content_permanent.active select[name="type_id"]',
  82. # :value => 'note',
  83. #},
  84. {
  85. :execute => 'set_ticket_attributes',
  86. :body => 'some body 1234 äöüß 333',
  87. },
  88. {
  89. :execute => 'click',
  90. :css => '.content.active button.js-submit',
  91. },
  92. {
  93. :execute => 'watch_for',
  94. :area => '.content.active .ticket-edit',
  95. :value => 'some body 1234 äöüß 333',
  96. },
  97. # check if task is shown
  98. {
  99. :execute => 'match',
  100. :css => 'body',
  101. :value => 'test to merge',
  102. :match_result => true,
  103. },
  104. ],
  105. },
  106. {
  107. :name => 'agent ticket merge',
  108. :action => [
  109. {
  110. :execute => 'click',
  111. :css => '.active .actions button',
  112. },
  113. {
  114. :execute => 'click',
  115. :css => '.active a[data-type="merge"]',
  116. },
  117. {
  118. :execute => 'wait',
  119. :value => 4,
  120. },
  121. {
  122. :execute => 'set',
  123. :css => '.modal input[name="master_ticket_number"]',
  124. :value => '###stack###',
  125. },
  126. {
  127. :execute => 'click',
  128. :css => '.modal button[type="submit"]',
  129. },
  130. {
  131. :execute => 'wait',
  132. :value => 6,
  133. },
  134. # check if megred to ticket is shown now
  135. {
  136. :execute => 'match',
  137. :css => '.active .page-header .ticket-number',
  138. :value => '###stack###',
  139. :match_result => true,
  140. },
  141. # check if task is now gone
  142. {
  143. :execute => 'match',
  144. :css => 'body',
  145. :value => 'test to merge',
  146. :match_result => true,
  147. },
  148. # close task/cleanup
  149. {
  150. :execute => 'close_all_tasks',
  151. },
  152. ],
  153. },
  154. ]
  155. browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
  156. end
  157. end