agent_ticket_update_with_attachment_refresh_test.rb 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. # https://github.com/zammad/zammad/issues/1123
  4. # Make sure attachment is shown after reloading an in-progress ticket update
  5. class AgentTicketUpdateWithAttachmentRefreshTest < TestCase
  6. def test_attachment_after_refresh
  7. @browser = browser_instance
  8. login(
  9. username: 'agent1@example.com',
  10. password: 'test',
  11. url: browser_url,
  12. )
  13. #
  14. # attachment checks - existing ticket
  15. #
  16. # create new ticket with no attachment, attachment check should pop up
  17. ticket_create(
  18. data: {
  19. customer: 'nico',
  20. group: 'Users',
  21. title: 'test 6 - ticket 1',
  22. body: 'test 6 - ticket 1 body',
  23. },
  24. )
  25. sleep 1
  26. # fill body
  27. ticket_update(
  28. data: {
  29. body: 'keep me',
  30. },
  31. do_not_submit: true,
  32. )
  33. # since selenium webdriver with firefox is not able to upload files, skipp here
  34. # https://github.com/w3c/webdriver/issues/1230
  35. return if browser == 'firefox'
  36. # add attachment, attachment check should quiet
  37. file_upload(
  38. css: '.content.active .attachmentPlaceholder-inputHolder input',
  39. files: ['test/data/upload/upload1.txt'],
  40. )
  41. sleep 2
  42. # check if attachment is shown
  43. match(
  44. css: '.content.active .ticketZoom .attachments .attachment:nth-child(1) .attachment-name',
  45. value: 'upload1.txt'
  46. )
  47. @browser.navigate.refresh
  48. sleep 1
  49. # check if attachment is shown
  50. match(
  51. css: '.content.active .ticketZoom .attachments .attachment:nth-child(1) .attachment-name',
  52. value: 'upload1.txt'
  53. )
  54. end
  55. end