maintenance_login_message_test.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class MaintenanceLoginMessageTest < TestCase
  4. def test_login_message
  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/maintenance"]',
  19. )
  20. string = rand(99_999_999_999_999_999).to_s
  21. message = "test <b>#{string}</b>"
  22. set(
  23. browser: browser1,
  24. css: '.content.active .js-loginPreview [data-name="message"]',
  25. value: message,
  26. )
  27. click(
  28. browser: browser1,
  29. css: '#global-search',
  30. )
  31. browser2 = browser_instance
  32. location(
  33. browser: browser2,
  34. url: browser_url,
  35. )
  36. exists_not(
  37. browser: browser2,
  38. css: '.js-maintenanceLogin',
  39. )
  40. switch(
  41. browser: browser1,
  42. css: '.content.active .js-loginSetting',
  43. type: 'on',
  44. )
  45. watch_for(
  46. browser: browser2,
  47. css: '.js-maintenanceLogin',
  48. value: message
  49. )
  50. switch(
  51. browser: browser1,
  52. css: '.content.active .js-loginSetting',
  53. type: 'off',
  54. )
  55. watch_for_disappear(
  56. browser: browser2,
  57. css: '.js-maintenanceLogin',
  58. )
  59. end
  60. end