agent_ticket_zoom_hide_test.rb 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. ticket_create(
  19. data: {
  20. customer: 'Nico',
  21. group: 'Users',
  22. title: 'Ticket 1',
  23. body: 'some body 123äöü - changes',
  24. }
  25. )
  26. 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. modal_ready()
  46. # Now go to a previous ticket and confirm that the modal disappears
  47. location(
  48. url: "#{browser_url}/#ticket/zoom/1",
  49. )
  50. sleep 2
  51. modal_disappear()
  52. end
  53. def teardown
  54. # Disable attachment image preview
  55. set_setting('ui_ticket_zoom_attachments_preview', false)
  56. end
  57. end