agent_ticket_actions_level6_test.rb 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketActionLevel6Test < TestCase
  4. def test_ticket
  5. @browser = browser_instance
  6. login(
  7. username: 'agent1@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. #
  13. # attachment checks - new ticket
  14. #
  15. # create new ticket with no attachment, attachment check should pop up
  16. ticket_create(
  17. data: {
  18. customer: 'nico',
  19. group: 'Users',
  20. title: 'test 6 - ticket 1',
  21. body: 'test 6 - ticket 1 - with the word attachment, but not attachment atteched it should give an warning on submit',
  22. },
  23. do_not_submit: true,
  24. )
  25. sleep 1
  26. # submit form
  27. click( css: '.content.active button.submit' )
  28. sleep 2
  29. # check warning
  30. alert = @browser.switch_to.alert
  31. alert.dismiss()
  32. #alert.accept()
  33. #alert = alert.text
  34. # add attachment, attachment check should quiet
  35. @browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .richtext .attachments')" )
  36. # submit form
  37. click( css: '.content.active button.submit' )
  38. sleep 5
  39. # no warning
  40. #alert = @browser.switch_to.alert
  41. # check if ticket is shown
  42. location_check( url: '#ticket/zoom/' )
  43. sleep 2
  44. ticket_number = @browser.find_elements( { css: '.active .ticketZoom-header .ticket-number' } )[0].text
  45. #
  46. # attachment checks - update ticket
  47. #
  48. # update ticket with no attachment, attachment check should pop up
  49. ticket_update(
  50. data: {
  51. body: 'test 6 - ticket 1-1 - with the word attachment, but not attachment atteched it should give an warning on submit',
  52. },
  53. do_not_submit: true,
  54. )
  55. # submit form
  56. click(
  57. css: '.active button.js-submit',
  58. )
  59. sleep 2
  60. # check warning
  61. alert = @browser.switch_to.alert
  62. alert.dismiss()
  63. # add attachment, attachment check should quiet
  64. @browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .article-add .textBubble .attachments')" )
  65. # submit form
  66. click(
  67. css: '.active button.js-submit',
  68. )
  69. sleep 2
  70. # no warning
  71. #alert = @browser.switch_to.alert
  72. # check if article exists
  73. # discard changes should gone away
  74. watch_for_disappear(
  75. css: '.content.active .js-reset',
  76. value: '(Discard your unsaved changes.|Verwerfen der)',
  77. no_quote: true,
  78. )
  79. ticket_verify(
  80. data: {
  81. body: '',
  82. },
  83. )
  84. # check content and edit screen in instance 1
  85. match(
  86. css: '.active div.ticket-article',
  87. value: 'test 6 - ticket 1-1',
  88. )
  89. #
  90. # ticket customer change checks
  91. #
  92. # use current session
  93. browser1 = @browser
  94. browser2 = browser_instance
  95. login(
  96. browser: browser2,
  97. username: 'master@example.com',
  98. password: 'test',
  99. url: browser_url,
  100. )
  101. tasks_close_all(
  102. browser: browser2,
  103. )
  104. random = 'ticket-actions-6-test-' + rand(999_999).to_s
  105. user_email = random + '@example.com'
  106. user_create(
  107. browser: browser2,
  108. data: {
  109. firstname: 'Action6 Firstname' + random,
  110. lastname: 'Action6 Lastname' + random,
  111. email: user_email,
  112. password: 'some-pass',
  113. },
  114. )
  115. # update customer, check if new customer is shown in side bar
  116. ticket_open_by_search(
  117. browser: browser2,
  118. number: ticket_number,
  119. )
  120. ticket_update(
  121. browser: browser2,
  122. data: {
  123. customer: user_email,
  124. },
  125. do_not_submit: true,
  126. )
  127. # check if customer has changed in second browser
  128. click( browser: browser1, css: '.active .tabsSidebar-tab[data-tab="customer"]')
  129. watch_for(
  130. browser: browser1,
  131. css: '.active .tabsSidebar',
  132. value: user_email,
  133. )
  134. #
  135. # modify customer
  136. #
  137. # modify customer
  138. click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
  139. click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
  140. sleep 2
  141. set( browser: browser1, css: '.modal [name="address"]', value: 'some new address' )
  142. click( browser: browser1, css: '.modal .js-submit')
  143. # verify is customer has chnaged other browser too
  144. click( browser: browser2, css: '.active .tabsSidebar-tab[data-tab="customer"]')
  145. watch_for(
  146. browser: browser2,
  147. css: '.active .sidebar[data-tab="customer"]',
  148. value: 'some new address',
  149. )
  150. #
  151. # ticket customer organization change checks
  152. #
  153. # change org of customer, check if org is shown in sidebar
  154. click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
  155. click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
  156. sleep 2
  157. select( browser: browser1, css: '.modal [name="organization_id"]', value: 'Zammad Foundation' )
  158. click( browser: browser1, css: '.modal .js-submit')
  159. # check if org has changed in second browser
  160. sleep 3
  161. click( browser: browser2, css: '.active .tabsSidebar-tab[data-tab="organization"]')
  162. watch_for(
  163. browser: browser2,
  164. css: '.active .sidebar[data-tab="organization"]',
  165. value: 'Zammad Foundation',
  166. )
  167. #
  168. # form change/reset checks
  169. #
  170. # some form reset checks
  171. end
  172. end