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. 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. 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. ticket_open_by_overview(
  45. number: ticket1[:number],
  46. title: "overview tab test #1 - #{title}",
  47. link: '#ticket/view/all_unassigned',
  48. )
  49. assert_equal(1, @browser.find_elements(css: '.tasks .task').count)
  50. ticket_update(
  51. data: {
  52. body: 'some body',
  53. state: 'closed',
  54. },
  55. task_type: 'closeNextInOverview', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab
  56. )
  57. watch_for(
  58. css: '.tasks .task.is-active',
  59. value: "overview tab test #2 - #{title}",
  60. timeout: 8,
  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