manage_test.rb 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'browser_test_helper'
  3. class ManageTest < TestCase
  4. def test_user
  5. random = "manage-test-#{SecureRandom.uuid}"
  6. user_email = "#{random}@example.com"
  7. # user management
  8. @browser = browser_instance
  9. login(
  10. username: 'admin@example.com',
  11. password: 'test',
  12. url: browser_url,
  13. )
  14. click(css: 'a[href="#manage"]')
  15. click(css: 'a[href="#manage/users"]')
  16. user_create(
  17. data: {
  18. login: "some login#{random}",
  19. firstname: "Manage Firstname#{random}",
  20. lastname: "Manage Lastname#{random}",
  21. email: user_email,
  22. password: 'some-pass',
  23. }
  24. )
  25. click(css: '.table-overview tr:last-child td')
  26. modal_ready
  27. set(
  28. css: '.modal input[name="lastname"]',
  29. value: "2Manage Lastname#{random}",
  30. )
  31. click(css: '.modal button.js-submit')
  32. modal_disappear
  33. watch_for(
  34. css: 'body',
  35. value: "2Manage Lastname#{random}",
  36. )
  37. # sla
  38. sla_create(
  39. data: {
  40. name: "some sla#{random}",
  41. first_response_time_in_text: '1:01'
  42. }
  43. )
  44. watch_for(
  45. css: 'body',
  46. value: random,
  47. )
  48. sleep 1
  49. click(css: '.content:not(.hide) .action:last-child .js-edit')
  50. modal_ready
  51. set(
  52. css: '.modal input[name=name]',
  53. value: "some sla update #{random}",
  54. )
  55. set(
  56. css: '.modal input[name="first_response_time_in_text"]',
  57. value: '2:01',
  58. )
  59. click(css: '.modal button.js-submit')
  60. modal_disappear
  61. watch_for(
  62. css: 'body',
  63. value: "some sla update #{random}",
  64. )
  65. sleep 4
  66. click(css: '.content:not(.hide) .action:last-child .js-delete')
  67. sleep 2
  68. click(css: '.modal button.js-submit')
  69. sleep 4
  70. match_not(
  71. css: 'body',
  72. value: "some sla update #{random}",
  73. )
  74. click(css: 'a[href="#manage"]')
  75. click(css: 'a[href="#manage/slas"]')
  76. sleep 2
  77. match_not(
  78. css: 'body',
  79. value: "some sla update #{random}",
  80. )
  81. reload
  82. sleep 2
  83. click(css: 'a[href="#manage"]')
  84. click(css: 'a[href="#manage/slas"]')
  85. sleep 2
  86. match_not(
  87. css: 'body',
  88. value: "some sla update #{random}",
  89. )
  90. end
  91. end