setting_test.rb 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. require 'browser_test_helper'
  2. class SettingTest < TestCase
  3. def test_setting
  4. @browser = browser_instance
  5. login(
  6. username: 'master@example.com',
  7. password: 'test',
  8. url: browser_url,
  9. )
  10. tasks_close_all()
  11. # make sure, that we have english frontend
  12. click(css: 'a[href="#current_user"]')
  13. click(css: 'a[href="#profile"]')
  14. click(css: 'a[href="#profile/language"]')
  15. select(
  16. css: '.language_item [name="locale"]',
  17. value: 'English (United States)',
  18. )
  19. click(css: '.content.active button[type="submit"]')
  20. sleep 2
  21. # change settings
  22. click(css: 'a[href="#manage"]')
  23. click(css: 'a[href="#settings/security"]')
  24. click(css: 'a[href="#third_party_auth"]')
  25. sleep 2
  26. switch(
  27. css: '.content.active .js-setting[data-name="auth_facebook"]',
  28. type: 'off',
  29. )
  30. browser2 = browser_instance
  31. location(
  32. browser: browser2,
  33. url: browser_url,
  34. )
  35. watch_for(
  36. browser: browser2,
  37. css: 'body',
  38. value: 'login',
  39. )
  40. match_not(
  41. browser: browser2,
  42. css: 'body',
  43. value: 'facebook',
  44. )
  45. # set yes
  46. switch(
  47. css: '.content.active .js-setting[data-name="auth_facebook"]',
  48. type: 'on',
  49. )
  50. # set key and secret
  51. set(
  52. css: '[data-name="auth_facebook_credentials"] input[name=app_id]',
  53. value: 'id_test1234äöüß',
  54. )
  55. set(
  56. css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
  57. value: 'secret_test1234äöüß',
  58. )
  59. click( css: '[data-name="auth_facebook_credentials"] button[type=submit]')
  60. watch_for(
  61. css: '#notify',
  62. value: 'update successful',
  63. )
  64. sleep 4
  65. match(
  66. css: '[data-name="auth_facebook_credentials"] input[name=app_id]',
  67. value: 'id_test1234äöüß',
  68. )
  69. match(
  70. css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
  71. value: 'secret_test1234äöüß',
  72. )
  73. # verify login page
  74. sleep 2
  75. watch_for(
  76. browser: browser2,
  77. css: 'body',
  78. value: 'facebook',
  79. )
  80. # set key and secret again
  81. set(
  82. css: '[data-name="auth_facebook_credentials"] input[name=app_id]',
  83. value: '---',
  84. )
  85. set(
  86. css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
  87. value: '---',
  88. )
  89. click(css: '[data-name="auth_facebook_credentials"] button[type=submit]')
  90. watch_for(
  91. css: '#notify',
  92. value: 'update successful',
  93. )
  94. sleep 4
  95. match(
  96. css: '[data-name="auth_facebook_credentials"] input[name=app_id]',
  97. value: '---',
  98. )
  99. match(
  100. css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
  101. value: '---',
  102. )
  103. reload()
  104. click(css: 'a[href="#settings/security"]')
  105. click(css: 'a[href="#third_party_auth"]')
  106. watch_for(
  107. css: '[data-name="auth_facebook_credentials"] input[name=app_id]',
  108. value: '---',
  109. )
  110. watch_for(
  111. css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
  112. value: '---',
  113. )
  114. sleep 2
  115. switch(
  116. css: '.content.active .js-setting[data-name="auth_facebook"]',
  117. type: 'off',
  118. )
  119. sleep 2
  120. watch_for(
  121. browser: browser2,
  122. css: 'body',
  123. value: 'login',
  124. )
  125. match_not(
  126. browser: browser2,
  127. css: 'body',
  128. value: 'facebook',
  129. )
  130. end
  131. def test_product_name
  132. @browser = browser_instance
  133. login(
  134. username: 'master@example.com',
  135. password: 'test',
  136. url: browser_url,
  137. )
  138. tasks_close_all()
  139. verify_title(value: 'Zammad Test System')
  140. click(css: 'a[href="#manage"]')
  141. click(css: '.content.active a[href="#settings/branding"]')
  142. set(
  143. css: '.content.active [name="product_name"]',
  144. value: 'ABC App',
  145. )
  146. click(css: '.content.active #product_name button[type=submit]')
  147. sleep 2
  148. verify_title(value: 'ABC App')
  149. set(
  150. css: '.content.active [name="product_name"]',
  151. value: 'Zammad Test System',
  152. )
  153. click(css: '.content.active #product_name button[type=submit]')
  154. sleep 2
  155. verify_title(value: 'Zammad Test System')
  156. end
  157. end