agent_ticket_overview_group_by_organization_test.rb 2.0 KB

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