agent_ticket_overview_tab_test.rb 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class AgentTicketOverviewTabTest < TestCase
  4. def task_count_equals(count)
  5. retries ||= 0
  6. assert_equal(count, @browser.find_elements(css: '.tasks .task').count)
  7. rescue
  8. retries += 1
  9. if retries < 5
  10. sleep 1
  11. retry
  12. end
  13. raise e
  14. end
  15. def test_i
  16. @browser = browser_instance
  17. login(
  18. username: 'admin@example.com',
  19. password: 'test',
  20. url: browser_url,
  21. )
  22. tasks_close_all
  23. title = "test #{SecureRandom.uuid}"
  24. # create new ticket
  25. ticket1 = ticket_create(
  26. data: {
  27. customer: 'nico',
  28. group: 'Users',
  29. title: "overview tab test #1 - #{title}",
  30. body: "overview tab test #1 - #{title}",
  31. }
  32. )
  33. ticket_create(
  34. data: {
  35. customer: 'nico',
  36. group: 'Users',
  37. title: "overview tab test #2 - #{title}",
  38. body: "overview tab test #2 - #{title}",
  39. }
  40. )
  41. ticket_create(
  42. data: {
  43. customer: 'nico',
  44. group: 'Users',
  45. title: "overview tab test #3 - #{title}",
  46. body: "overview tab test #3 - #{title}",
  47. }
  48. )
  49. tasks_close_all
  50. # click(text: 'Overviews')
  51. # enable full overviews
  52. # execute(
  53. # js: '$(".content.active .sidebar").css("display", "block")',
  54. # )
  55. # click(text: 'Unassigned & Open')
  56. ticket_open_by_overview(
  57. number: ticket1[:number],
  58. title: "overview tab test #1 - #{title}",
  59. link: '#ticket/view/all_unassigned',
  60. )
  61. task_count_equals(1)
  62. ticket_update(
  63. data: {
  64. body: 'some body',
  65. state: 'closed',
  66. },
  67. task_type: 'closeNextInOverview', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab
  68. )
  69. watch_for(
  70. css: '.tasks .task.is-active',
  71. value: "overview tab test #2 - #{title}",
  72. timeout: 8,
  73. )
  74. task_count_equals(1)
  75. ticket_update(
  76. data: {
  77. body: 'some body',
  78. state: 'closed',
  79. },
  80. task_type: 'closeTab', # default: stayOnTab / possible: closeTab, closeNextInOverview, stayOnTab
  81. )
  82. task_count_equals(0)
  83. # cleanup
  84. tasks_close_all
  85. end
  86. end