translation_test.rb 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class TranslationTest < TestCase
  4. def test_preferences
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  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. watch_for(
  22. css: 'body',
  23. value: 'Language',
  24. )
  25. click(css: 'a[href="#manage"]')
  26. click(css: 'a[href="#system/translation"]')
  27. watch_for(
  28. css: '.content.active',
  29. value: 'English is the source language, so we have nothing to translate',
  30. )
  31. click(css: 'a[href="#current_user"]')
  32. click(css: 'a[href="#profile"]')
  33. click(css: 'a[href="#profile/language"]')
  34. select(
  35. css: '.language_item [name="locale"]',
  36. value: 'Deutsch',
  37. )
  38. click(css: '.content.active button[type="submit"]')
  39. watch_for(
  40. css: 'body',
  41. value: 'Sprache',
  42. )
  43. click(css: 'a[href="#manage"]')
  44. click(css: 'a[href="#system/translation"]')
  45. notify_close(optional: true) # to be not in click area
  46. set(
  47. css: '.content.active input.js-Item[data-source="Translations"]',
  48. value: 'Übersetzung2',
  49. )
  50. sleep 5 # wait until nofify is gone
  51. click(css: '#global-search')
  52. sleep 4 # wait till rerender
  53. click(css: 'a[href="#dashboard"]')
  54. sleep 2 # wait till nav is rendered
  55. click(css: 'a[href="#manage"]')
  56. click(css: 'a[href="#system/translation"]')
  57. match(
  58. css: '.content.active .sidebar',
  59. value: 'Übersetzung2',
  60. )
  61. match(
  62. css: '.content.active input.js-Item[data-source="Translations"]',
  63. value: 'Übersetzung2',
  64. )
  65. execute(
  66. js: "$('.js-Item[data-source=Translations]').parents('tr').find('.js-Reset:visible').click()",
  67. )
  68. sleep 5
  69. match(
  70. css: '.content.active .sidebar',
  71. value: 'Übersetzung2',
  72. )
  73. match_not(
  74. css: '.content.active input.js-Item[data-source="Translations"]',
  75. value: 'Übersetzung2',
  76. )
  77. click(css: 'a[href="#dashboard"]')
  78. sleep 4 # wait till rerender
  79. click(css: 'a[href="#manage"]')
  80. click(css: 'a[href="#system/translation"]')
  81. sleep 2
  82. match_not(
  83. css: '.content.active .sidebar',
  84. value: 'Übersetzung2',
  85. )
  86. match_not(
  87. css: '.content.active input.js-Item[data-source="Translations"]',
  88. value: 'Übersetzung2',
  89. )
  90. match_not(
  91. css: '.content.active .sidebar',
  92. value: 'Übersetzung2',
  93. )
  94. @browser.action.key_down(:control)
  95. .key_down(:alt)
  96. .send_keys('t')
  97. .key_up(:alt)
  98. .key_up(:control)
  99. .perform
  100. watch_for(
  101. css: 'span.translation[title="Overviews"]',
  102. value: 'Übersichten',
  103. )
  104. set(
  105. css: 'span.translation[title="Overviews"]',
  106. value: 'Übersichten123',
  107. )
  108. sleep 1
  109. click(css: 'a[href="#dashboard"]')
  110. sleep 5
  111. @browser.action.key_down(:control)
  112. .key_down(:alt)
  113. .send_keys('t')
  114. .key_up(:alt)
  115. .key_up(:control)
  116. .perform
  117. sleep 5
  118. exists_not(
  119. css: 'span.translation[title="Overviews"]',
  120. )
  121. match(
  122. css: '.js-menu',
  123. value: 'Übersichten123',
  124. )
  125. reload()
  126. exists_not(
  127. css: 'span.translation[title="Overviews"]',
  128. )
  129. match(
  130. css: '.js-menu',
  131. value: 'Übersichten123',
  132. )
  133. click(css: 'a[href="#manage"]')
  134. click(css: 'a[href="#system/translation"]')
  135. sleep 4
  136. match(
  137. css: '.content.active input.js-Item[data-source="Overviews"]',
  138. value: 'Übersichten123',
  139. )
  140. execute(
  141. js: "$('.js-Item[data-source=Overviews]').parents('tr').find('.js-Reset:visible').click()",
  142. )
  143. sleep 5
  144. click(css: 'a[href="#dashboard"]')
  145. sleep 5
  146. match_not(
  147. css: '.js-menu',
  148. value: 'Übersichten123',
  149. )
  150. match(
  151. css: '.js-menu',
  152. value: 'Übersichten',
  153. )
  154. click(css: 'a[href="#current_user"]')
  155. click(css: 'a[href="#profile"]')
  156. click(css: 'a[href="#profile/language"]')
  157. select(
  158. css: '.language_item [name="locale"]',
  159. value: 'English (United States)',
  160. )
  161. click(css: '.content.active button[type="submit"]')
  162. sleep 2
  163. watch_for(
  164. css: 'body',
  165. value: 'Language',
  166. )
  167. sleep 5
  168. @browser.action.key_down(:control)
  169. .key_down(:alt)
  170. .send_keys('t')
  171. .key_up(:alt)
  172. .key_up(:control)
  173. .perform
  174. watch_for(
  175. css: 'span.translation[title="Overviews"]',
  176. value: 'Overviews',
  177. )
  178. set(
  179. css: 'span.translation[title="Overviews"]',
  180. value: 'Overviews123',
  181. )
  182. sleep 1
  183. click(css: 'a[href="#dashboard"]')
  184. sleep 5
  185. @browser.action.key_down(:control)
  186. .key_down(:alt)
  187. .send_keys('t')
  188. .key_up(:alt)
  189. .key_up(:control)
  190. .perform
  191. sleep 5
  192. exists_not(
  193. css: 'span.translation[title="Overviews"]',
  194. )
  195. match(
  196. css: '.js-menu',
  197. value: 'Overviews123',
  198. )
  199. click(css: 'a[href="#manage"]')
  200. click(css: 'a[href="#system/translation"]')
  201. sleep 4
  202. match(
  203. css: '.content.active input.js-Item[data-source="Overviews"]',
  204. value: 'Overviews123',
  205. )
  206. match_not(
  207. css: '.content.active',
  208. value: 'English is the source language, so we have nothing to translate',
  209. )
  210. execute(
  211. js: "$('.js-Item[data-source=Overviews]').parents('tr').find('.js-Reset:visible').click()",
  212. )
  213. watch_for(
  214. css: '.content.active',
  215. value: 'English is the source language, so we have nothing to translate',
  216. )
  217. end
  218. def test_admin_sync
  219. @browser = browser_instance
  220. login(
  221. username: 'master@example.com',
  222. password: 'test',
  223. url: browser_url,
  224. )
  225. tasks_close_all()
  226. click(css: 'a[href="#current_user"]')
  227. click(css: 'a[href="#profile"]')
  228. click(css: 'a[href="#profile/language"]')
  229. select(
  230. css: '.language_item [name="locale"]',
  231. value: 'Deutsch',
  232. )
  233. click(css: '.content.active button[type="submit"]')
  234. watch_for(
  235. css: 'body',
  236. value: 'Sprache',
  237. )
  238. click(css: 'a[href="#manage"]')
  239. click(css: 'a[href="#system/translation"]')
  240. watch_for(
  241. css: '.content.active',
  242. value: 'Inline Übersetzung',
  243. )
  244. click(css: '.content.active .js-syncChanges')
  245. watch_for(
  246. css: '.content.active .modal',
  247. value: 'Letzte Übersetzung laden',
  248. )
  249. watch_for_disappear(
  250. css: '.content.active .modal',
  251. timeout: 6 * 60,
  252. )
  253. click(css: 'a[href="#current_user"]')
  254. click(css: 'a[href="#profile"]')
  255. click(css: 'a[href="#profile/language"]')
  256. select(
  257. css: '.language_item [name="locale"]',
  258. value: 'English (United States)',
  259. )
  260. click(css: '.content.active button[type="submit"]')
  261. watch_for(
  262. css: 'body',
  263. value: 'Language',
  264. )
  265. end
  266. end