agent_ticket_zoom_hide_test.rb 1.6 KB

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