agent_ticket_overview_group_by_organization_test.rb 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. require 'browser_test_helper'
  2. class AgentTicketOverviewGroupByOrganizationTest < TestCase
  3. =begin
  4. Verify fix for Github issue #2046 - Special characters get HTML encoded when displayed in overviews...
  5. =end
  6. def test_grouping_by_organzation_overview
  7. random = rand(999_999).to_s
  8. user_email = "user_#{random}@example.com"
  9. overview_name = "overview_#{random}"
  10. @browser = instance = browser_instance
  11. login(
  12. username: 'master@example.com',
  13. password: 'test',
  14. url: browser_url,
  15. )
  16. tasks_close_all()
  17. # 1. Create a new test organization with special characters in its name
  18. organization_create(
  19. data: {
  20. name: 'äöüß & Test Organization',
  21. }
  22. )
  23. # 2. Create a new user that belongs to the test organization
  24. user_create(
  25. data: {
  26. login: 'test user',
  27. firstname: 'Max',
  28. lastname: 'Mustermann',
  29. email: user_email,
  30. password: 'some-pass',
  31. organization: 'äöüß & Test Organization',
  32. }
  33. )
  34. # 3. Create a new ticket for the test user
  35. ticket_create(
  36. data: {
  37. customer: user_email,
  38. title: 'test ticket',
  39. body: 'test ticket',
  40. group: 'Users',
  41. },
  42. )
  43. # 4. Create an overview grouping by organization
  44. overview_create(
  45. data: {
  46. name: overview_name,
  47. roles: %w[Agent Admin Customer],
  48. group_by: 'Organization',
  49. }
  50. )
  51. # 5. Open the newly created overview and verify that the organization name is correctly rendered
  52. location(url: "#{browser_url}/#ticket/view/#{overview_name}")
  53. sleep 1
  54. elements = instance.find_elements(xpath: '//b[contains(text(),"äöüß & Test Organization")]')
  55. elements = elements.select { |x| x.text.present? }
  56. assert elements
  57. # flanky
  58. assert_equal 'äöüß & Test Organization', elements.first.text
  59. end
  60. end