agent_ticket_link_test.rb 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class AgentTicketLinkTest < TestCase
  4. def test_c_link
  5. @browser = browser_instance
  6. login(
  7. username: 'agent1@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all
  12. ticket1 = ticket_create(
  13. data: {
  14. customer: 'nico',
  15. group: 'Users',
  16. title: 'some subject - link#1',
  17. body: 'some body - link#1',
  18. },
  19. )
  20. ticket2 = ticket_create(
  21. data: {
  22. customer: 'nico',
  23. group: 'Users',
  24. title: 'some subject - link#2',
  25. body: 'some body - link#2',
  26. },
  27. )
  28. # verify changes in second browser
  29. browser2 = browser_instance
  30. login(
  31. browser: browser2,
  32. username: 'admin@example.com',
  33. password: 'test',
  34. url: browser_url,
  35. )
  36. ticket_open_by_search(
  37. browser: browser2,
  38. number: ticket1[:number],
  39. )
  40. click(
  41. css: '.content.active .js-links .js-add',
  42. )
  43. modal_ready
  44. set(
  45. css: '.content.active .modal-body [name="ticket_number"]',
  46. value: ticket1[:number],
  47. )
  48. select(
  49. css: '.content.active .modal-body [name="link_type"]',
  50. value: 'Normal',
  51. )
  52. click(
  53. css: '.content.active .modal-footer .js-submit',
  54. )
  55. watch_for(
  56. css: '.content.active .ticketLinks',
  57. value: ticket1[:title],
  58. )
  59. watch_for(
  60. browser: browser2,
  61. css: '.content.active .ticketLinks',
  62. value: ticket2[:title],
  63. )
  64. reload
  65. watch_for(
  66. css: '.content.active .ticketLinks',
  67. value: ticket1[:title],
  68. )
  69. click(
  70. css: '.content.active .ticketLinks .js-delete'
  71. )
  72. watch_for_disappear(
  73. css: '.content.active .ticketLinks',
  74. value: ticket1[:title],
  75. )
  76. watch_for_disappear(
  77. browser: browser2,
  78. css: '.content.active .ticketLinks',
  79. value: ticket2[:title],
  80. )
  81. reload
  82. watch_for_disappear(
  83. css: '.content.active .ticketLinks',
  84. value: ticket1[:title],
  85. )
  86. watch_for_disappear(
  87. browser: browser2,
  88. css: '.content.active .ticketLinks',
  89. value: ticket2[:title],
  90. )
  91. # cleanup
  92. ticket_open_by_search(
  93. browser: browser2,
  94. number: ticket1[:number],
  95. )
  96. sleep 1
  97. ticket_update(
  98. browser: browser2,
  99. data: {
  100. state: 'closed',
  101. }
  102. )
  103. tasks_close_all
  104. ticket_open_by_search(
  105. browser: browser2,
  106. number: ticket2[:number],
  107. )
  108. sleep 1
  109. ticket_update(
  110. browser: browser2,
  111. data: {
  112. state: 'closed',
  113. }
  114. )
  115. end
  116. end