agent_ticket_task_changed_test.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. require 'browser_test_helper'
  2. class AgentTicketTaskChangedTest < TestCase
  3. # regression test for issue #2042 - incorrect notification when closing a tab after setting up an object
  4. def test_detection_of_ticket_update_after_new_attribute
  5. @browser = instance = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. ticket_create(
  13. data: {
  14. customer: 'nico',
  15. group: 'Users',
  16. title: 'test ticket',
  17. body: 'some body 123äöü',
  18. },
  19. )
  20. object_manager_attribute_create(
  21. data: {
  22. name: 'text_test',
  23. display: 'text_test',
  24. data_type: 'Text',
  25. },
  26. )
  27. object_manager_attribute_migrate
  28. ticket_open_by_title(title: 'test ticket')
  29. # verify the 'Discard your changes' message does not appear (since there are no changes)
  30. assert_nil execute(js: "return $('.content.active .js-attributeBar .js-reset:not(\".hide\")').get(0)")
  31. # try and close the existing open ticket window
  32. instance.action.move_to(instance.find_elements(css: '#navigation .tasks .task:first-child')[0]).release.perform
  33. instance.find_elements(css: '#navigation .tasks .task:first-child .js-close')[0].click
  34. sleep 0.5
  35. exists_not( css: '.modal')
  36. object_manager_attribute_delete(
  37. data: {
  38. name: 'text_test',
  39. },
  40. )
  41. object_manager_attribute_migrate
  42. end
  43. end