monitoring_test.rb 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class MonitoringTest < TestCase
  4. def test_mode
  5. browser1 = browser_instance
  6. login(
  7. browser: browser1,
  8. username: 'master@example.com',
  9. password: 'test',
  10. url: browser_url,
  11. )
  12. click(
  13. browser: browser1,
  14. css: 'a[href="#manage"]',
  15. )
  16. click(
  17. browser: browser1,
  18. css: 'a[href="#system/monitoring"]',
  19. )
  20. token = browser1.find_elements(css: '.active.content .js-token')[0].attribute('value')
  21. url = browser1.find_elements(css: '.active.content .js-url')[0].attribute('value')
  22. assert_match(token.to_s, url)
  23. click(
  24. browser: browser1,
  25. css: '.active.content .js-resetToken',
  26. )
  27. sleep 3
  28. token_new = browser1.find_elements(css: '.active.content .js-token')[0].attribute('value')
  29. url_new = browser1.find_elements(css: '.active.content .js-url')[0].attribute('value')
  30. assert_not_equal(token, token_new)
  31. assert_not_equal(url, url_new)
  32. assert_match(token_new.to_s, url_new)
  33. end
  34. end