admin_calendar_sla_test.rb 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. require 'browser_test_helper'
  2. class AdminCalendarSlaTest < TestCase
  3. def test_calendar
  4. @browser = browser_instance
  5. login(
  6. username: 'master@example.com',
  7. password: 'test',
  8. url: browser_url,
  9. )
  10. tasks_close_all()
  11. calendar_name = "ZZZ some calendar #{rand(99_999_999)}"
  12. sla_name = "ZZZ some sla #{rand(99_999_999)}"
  13. timezone = 'Europe/Berlin'
  14. timezone_verify = "Europe/Berlin\s\\(GMT\\+(2|1)\\)"
  15. calendar_create(
  16. data: {
  17. name: calendar_name,
  18. timezone: timezone,
  19. }
  20. )
  21. # got to maintanance
  22. click(css: '[href="#manage"]')
  23. click(css: '[href="#system/maintenance"]')
  24. watch_for(
  25. css: '.content.active',
  26. value: 'Enable or disable the maintenance mode',
  27. timeout: 4,
  28. )
  29. # go back
  30. click(css: '[href="#manage"]')
  31. click(css: '[href="#manage/calendars"]')
  32. watch_for(
  33. css: '.content.active',
  34. value: calendar_name,
  35. timeout: 4,
  36. )
  37. logout()
  38. login(
  39. username: 'master@example.com',
  40. password: 'test',
  41. )
  42. # check if admin exists
  43. click(css: '[href="#manage"]')
  44. click(css: '[href="#manage/calendars"]')
  45. watch_for(
  46. css: '.content.active',
  47. value: calendar_name,
  48. timeout: 4,
  49. )
  50. #@browser.execute_script('$(\'.content.active table tr td:contains(" ' + data[:name] + '")\').first().click()')
  51. @browser.execute_script('$(\'.content.active .main .js-edit\').last().click()')
  52. modal_ready(browser: @browser)
  53. watch_for(
  54. css: '.content.active .modal input[name=name]',
  55. value: calendar_name,
  56. timeout: 4,
  57. )
  58. watch_for(
  59. css: '.content.active .modal input.js-input',
  60. value: timezone_verify,
  61. timeout: 4,
  62. )
  63. modal_close()
  64. sla_create(
  65. data: {
  66. name: sla_name,
  67. calendar: "#{calendar_name} - #{timezone}",
  68. first_response_time_in_text: 61
  69. },
  70. )
  71. end
  72. end