agent_ticket_zoom_hide_test.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. require 'browser_test_helper'
  2. class AgentTicketZoomHideTest < TestCase
  3. def setup
  4. # Enable attachment image preview
  5. set_setting('ui_ticket_zoom_attachments_preview', true)
  6. end
  7. def test_ticket_zoom_hide_closes_all_modals
  8. # since selenium webdriver with firefox is not able to upload files, skip here
  9. # https://github.com/w3c/webdriver/issues/1230
  10. return if browser == 'firefox'
  11. @browser = browser_instance
  12. login(
  13. username: 'agent1@example.com',
  14. password: 'test',
  15. url: browser_url,
  16. )
  17. # create two tickets
  18. ticket1 = ticket_create(
  19. data: {
  20. customer: 'Nico',
  21. group: 'Users',
  22. title: 'Ticket 1',
  23. body: 'some body 123äöü - changes',
  24. }
  25. )
  26. ticket2 = ticket_create(
  27. data: {
  28. customer: 'Nico',
  29. group: 'Users',
  30. title: 'Ticket 2',
  31. body: 'some body 123äöü - changes',
  32. }
  33. )
  34. # Upload attachment and submit update
  35. ticket_update(
  36. data: {
  37. body: 'added image attachment',
  38. files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')],
  39. },
  40. )
  41. # Open the attachment preview modal
  42. click(
  43. css: '.attachment-icon img',
  44. )
  45. watch_for(
  46. css: 'body > .modal',
  47. )
  48. # Now go to a previous ticket and confirm that the modal disappears
  49. location(
  50. url: browser_url + '/#ticket/zoom/1',
  51. )
  52. sleep 2
  53. exists_not(
  54. css: 'body > .modal',
  55. )
  56. end
  57. def teardown
  58. # Disable attachment image preview
  59. set_setting('ui_ticket_zoom_attachments_preview', false)
  60. end
  61. end