agent_ticket_overview_pending_til_test.rb 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class AgentTicketOverviewPendingTil < TestCase
  4. # regression for issue #2367 - cannot sort by Pending Til
  5. def test_sorting_by_pending_til
  6. name = "overview_pending_til_#{SecureRandom.uuid}"
  7. @browser = browser_instance
  8. login(
  9. username: 'admin@example.com',
  10. password: 'test',
  11. url: browser_url,
  12. )
  13. tasks_close_all
  14. # create 4 tickets, 2 with pending til data and 2 without
  15. tickets = []
  16. 4.times do |i|
  17. ticket = ticket_create(
  18. data: {
  19. customer: 'nico',
  20. group: 'Users',
  21. title: "pending til ticket #{i}",
  22. body: 'test ticket',
  23. state: i.odd? ? 'pending close' : 'open',
  24. pending_date: '11/24/2028',
  25. pending_time: '08:00',
  26. }
  27. )
  28. tickets.push ticket
  29. end
  30. # create and open new overview that has the Pending Til column
  31. overview_create(
  32. data: {
  33. name: name,
  34. roles: %w[Admin Agent],
  35. selector: {
  36. 'State' => ['new', 'open', 'closed', 'merged', 'pending close', 'pending reminder'],
  37. },
  38. attributes: {
  39. 'pending_time' => true,
  40. },
  41. }
  42. )
  43. overview_open(
  44. name: name,
  45. )
  46. # sort by Pending Til
  47. click(
  48. css: '.content.active table.table th.js-tableHead[data-column-key="pending_time"]',
  49. )
  50. # check if the first and second rows both correctly contain 'pending close'
  51. match(
  52. css: '.content.active table .js-tableBody tr:nth-child(1)',
  53. value: 'pending close',
  54. )
  55. match(
  56. css: '.content.active table .js-tableBody tr:nth-child(2)',
  57. value: 'pending close',
  58. )
  59. end
  60. end