setting_test.rb 4.1 KB

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