agent_ticket_overview_pending_til_test.rb 1.7 KB

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