manage_test.rb 2.2 KB

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