agent_ticket_update_and_reload_test.rb 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  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. click(css: '.active .tabsSidebar-tab[data-tab="customer"]')
  25. match(
  26. css: '.active .sidebar[data-tab="customer"]',
  27. value: 'nicole',
  28. )
  29. # check task title
  30. verify_task(
  31. data: {
  32. title: 'some subject 4 - 123äöü',
  33. }
  34. )
  35. # check page title
  36. verify_title(
  37. value: 'some subject 4 - 123äöü',
  38. )
  39. # reload instances, verify autosave
  40. reload
  41. # check if customer is still shown in sidebar
  42. click(css: '.active .tabsSidebar-tab[data-tab="customer"]')
  43. watch_for(
  44. css: '.active .sidebar[data-tab="customer"]',
  45. value: 'nicole',
  46. )
  47. sleep 2
  48. # finally create ticket
  49. click(css: '.content.active .js-submit')
  50. sleep 5
  51. location_check(
  52. url: '#ticket/zoom/',
  53. )
  54. # check ticket
  55. match(
  56. css: '.active div.ticket-article',
  57. value: 'some body 4 - 123äöü',
  58. )
  59. ticket_id = nil
  60. if @browser.current_url =~ %r{ticket/zoom/(.+?)$}i
  61. ticket_id = $1
  62. end
  63. # check task title
  64. verify_task(
  65. data: {
  66. title: 'some subject 4 - 123äöü',
  67. }
  68. )
  69. # check page title
  70. verify_title(
  71. value: 'some subject 4 - 123äöü',
  72. )
  73. # check if task is not marked as modified
  74. exists(
  75. css: ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"]",
  76. )
  77. exists_not(
  78. css: ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"].is-modified",
  79. )
  80. # reload
  81. reload
  82. sleep 4
  83. # check task title
  84. verify_task(
  85. data: {
  86. title: 'some subject 4 - 123äöü',
  87. }
  88. )
  89. # check page title
  90. verify_title(
  91. value: 'some subject 4 - 123äöü',
  92. )
  93. # go to dashboard
  94. location(
  95. url: browser_url
  96. )
  97. sleep 5
  98. # check page title
  99. verify_title(
  100. value: 'Dashboard',
  101. )
  102. # reload
  103. reload
  104. sleep 5
  105. # check page title
  106. verify_title(
  107. value: 'Dashboard',
  108. )
  109. # cleanup
  110. tasks_close_all
  111. end
  112. end