agent_ticket_overview_tab_test.rb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. require 'browser_test_helper'
  2. class AgentTicketOverviewTabTest < TestCase
  3. def test_i
  4. @browser = browser_instance
  5. login(
  6. username: 'master@example.com',
  7. password: 'test',
  8. url: browser_url,
  9. )
  10. tasks_close_all()
  11. title = "test #{rand(9_999_999)}"
  12. # create new ticket
  13. ticket1 = ticket_create(
  14. data: {
  15. customer: 'nico',
  16. group: 'Users',
  17. title: "overview tab test #1 - #{title}",
  18. body: "overview tab test #1 - #{title}",
  19. }
  20. )
  21. ticket2 = ticket_create(
  22. data: {
  23. customer: 'nico',
  24. group: 'Users',
  25. title: "overview tab test #2 - #{title}",
  26. body: "overview tab test #2 - #{title}",
  27. }
  28. )
  29. ticket3 = ticket_create(
  30. data: {
  31. customer: 'nico',
  32. group: 'Users',
  33. title: "overview tab test #3 - #{title}",
  34. body: "overview tab test #3 - #{title}",
  35. }
  36. )
  37. tasks_close_all()
  38. #click(text: 'Overviews')
  39. # enable full overviews
  40. #execute(
  41. # js: '$(".content.active .sidebar").css("display", "block")',
  42. #)
  43. #click(text: 'Unassigned & Open')
  44. sleep 8 # till overview is rendered
  45. ticket_open_by_overview(
  46. number: ticket1[:number],
  47. title: "overview tab test #1 - #{title}",
  48. link: '#ticket/view/all_unassigned',
  49. )
  50. assert_equal(1, @browser.find_elements(css: '.tasks .task').count)
  51. ticket_update(
  52. data: {
  53. body: 'some body',
  54. state: 'closed',
  55. },
  56. task_type: 'closeNextInOverview', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab
  57. )
  58. match(
  59. css: '.tasks .task.is-active',
  60. value: "overview tab test #2 - #{title}",
  61. )
  62. assert_equal(1, @browser.find_elements(css: '.tasks .task').count)
  63. ticket_update(
  64. data: {
  65. body: 'some body',
  66. state: 'closed',
  67. },
  68. task_type: 'closeTab', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab
  69. )
  70. assert_equal(0, @browser.find_elements(css: '.tasks .task').count)
  71. # cleanup
  72. tasks_close_all()
  73. end
  74. end