agent_ticket_update_and_reload_test.rb 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AgentTicketUpdateAndReloadTest < TestCase
  4. def test_agent_ticket_create_with_reload
  5. @browser = browser_instance
  6. login(
  7. username: 'agent1@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # create ticket
  13. ticket_create(
  14. data: {
  15. customer: 'nicole',
  16. group: 'Users',
  17. title: 'some subject 4 - 123äöü',
  18. body: 'some body 4 - 123äöü',
  19. },
  20. do_not_submit: true,
  21. )
  22. sleep 6
  23. # check if customer is shown in sidebar
  24. match(
  25. css: '.active .sidebar[data-tab="customer"]',
  26. value: 'nicole',
  27. )
  28. # check task title
  29. verify_task(
  30. data: {
  31. title: 'some subject 4 - 123äöü',
  32. }
  33. )
  34. # check page title
  35. verify_title(
  36. value: 'some subject 4 - 123äöü',
  37. )
  38. # reload instances, verify autosave
  39. reload()
  40. # check if customer is still shown in sidebar
  41. watch_for(
  42. css: '.active .sidebar[data-tab="customer"]',
  43. value: 'nicole',
  44. )
  45. sleep 2
  46. # finally create ticket
  47. click(css: '.content.active .js-submit')
  48. sleep 5
  49. location_check(
  50. url: '#ticket/zoom/',
  51. )
  52. # check ticket
  53. match(
  54. css: '.active div.ticket-article',
  55. value: 'some body 4 - 123äöü',
  56. )
  57. ticket_id = nil
  58. if @browser.current_url =~ %r{ticket/zoom/(.+?)$}i
  59. ticket_id = $1
  60. end
  61. # check task title
  62. verify_task(
  63. data: {
  64. title: 'some subject 4 - 123äöü',
  65. }
  66. )
  67. # check page title
  68. verify_title(
  69. value: 'some subject 4 - 123äöü',
  70. )
  71. # check if task is not marked as modified
  72. exists(
  73. css: ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"]",
  74. )
  75. exists_not(
  76. css: ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"].is-modified",
  77. )
  78. # reload
  79. reload()
  80. sleep 4
  81. # check task title
  82. verify_task(
  83. data: {
  84. title: 'some subject 4 - 123äöü',
  85. }
  86. )
  87. # check page title
  88. verify_title(
  89. value: 'some subject 4 - 123äöü',
  90. )
  91. # go to dashboard
  92. location(
  93. url: browser_url
  94. )
  95. sleep 5
  96. # check page title
  97. verify_title(
  98. value: 'Dashboard',
  99. )
  100. # reload
  101. reload()
  102. sleep 5
  103. # check page title
  104. verify_title(
  105. value: 'Dashboard',
  106. )
  107. # cleanup
  108. tasks_close_all()
  109. end
  110. end