agent_ticket_link_test.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # encoding: utf-8
  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: 'master@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 .links .js-add',
  42. )
  43. sleep 2
  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. end
  92. end