preferences_language_test.rb 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class PreferencesLanguageTest < TestCase
  4. def test_lang_change
  5. @browser = browser_instance
  6. login(
  7. username: 'master@example.com',
  8. password: 'test',
  9. url: browser_url,
  10. )
  11. tasks_close_all()
  12. # start ticket create
  13. ticket_create(
  14. data: {
  15. customer: 'nicole',
  16. group: 'Users',
  17. title: 'preferences lang check #1',
  18. body: 'preferences lang check #1',
  19. },
  20. do_not_submit: true,
  21. )
  22. # start ticket zoom
  23. ticket_create(
  24. data: {
  25. customer: 'nicole',
  26. group: 'Users',
  27. title: 'preferences lang check #2',
  28. body: 'preferences lang check #2',
  29. },
  30. )
  31. # start user profile
  32. user_open_by_search(
  33. value: 'Nicole',
  34. )
  35. # start organization profile
  36. organization_open_by_search(
  37. value: 'Zammad Foundation',
  38. )
  39. click(css: 'a[href="#current_user"]')
  40. click(css: 'a[href="#profile"]')
  41. click(css: 'a[href="#profile/language"]')
  42. select(
  43. css: '.language_item [name="locale"]',
  44. value: 'Deutsch',
  45. )
  46. click(css: '.content.active button[type="submit"]')
  47. watch_for(
  48. css: 'body',
  49. value: 'Sprache',
  50. )
  51. # check language in navbar
  52. watch_for(
  53. css: '.js-menu',
  54. value: 'Übersicht'
  55. )
  56. # check language in dashboard
  57. click(css: '.js-menu a[href="#dashboard"]')
  58. watch_for(
  59. css: '.content.active',
  60. value: 'Meine Statistik'
  61. )
  62. # check language in overview
  63. click(css: '.js-menu a[href="#ticket/view"]')
  64. watch_for(
  65. css: '.content.active',
  66. value: 'Meine'
  67. )
  68. verify_title(
  69. value: 'Meine zugewiesenen',
  70. )
  71. # check language in ticket create
  72. open_task(
  73. data: {
  74. title: 'Anruf',
  75. }
  76. )
  77. verify_task(
  78. data: {
  79. title: 'Anruf',
  80. }
  81. )
  82. open_task(
  83. data: {
  84. title: 'preferences lang check #1',
  85. }
  86. )
  87. watch_for(
  88. css: '.content.active',
  89. value: 'kunde'
  90. )
  91. watch_for(
  92. css: '.content.active',
  93. value: 'priorität'
  94. )
  95. watch_for(
  96. css: '.content.active [data-name="body"]',
  97. value: 'preferences lang check #1'
  98. )
  99. verify_title(
  100. value: 'anruf',
  101. )
  102. # check language in ticket zoom
  103. open_task(
  104. data: {
  105. title: 'preferences lang check #2',
  106. }
  107. )
  108. watch_for(
  109. css: '.content.active',
  110. value: 'erstellt'
  111. )
  112. watch_for(
  113. css: '.content.active',
  114. value: 'priorität'
  115. )
  116. # check language in user profile
  117. open_task(
  118. data: {
  119. title: 'Nicole',
  120. }
  121. )
  122. watch_for(
  123. css: '.content.active',
  124. value: 'notiz'
  125. )
  126. watch_for(
  127. css: '.content.active',
  128. value: 'e-mail'
  129. )
  130. watch_for(
  131. css: '.content.active',
  132. value: 'aktion'
  133. )
  134. # check language in organization profile
  135. open_task(
  136. data: {
  137. title: 'Zammad',
  138. }
  139. )
  140. watch_for(
  141. css: '.content.active',
  142. value: 'notiz'
  143. )
  144. click(css: 'a[href="#current_user"]')
  145. click(css: 'a[href="#profile"]')
  146. click(css: 'a[href="#profile/language"]')
  147. select(
  148. css: '.language_item [name="locale"]',
  149. value: 'English (United States)',
  150. )
  151. click(css: '.content.active button[type="submit"]')
  152. sleep 2
  153. watch_for(
  154. css: 'body',
  155. value: 'Language',
  156. )
  157. # check language in navbar
  158. watch_for(
  159. css: '.js-menu',
  160. value: 'Overview'
  161. )
  162. # check language in dashboard
  163. click(css: '.js-menu a[href="#dashboard"]')
  164. watch_for(
  165. css: '.content.active',
  166. value: 'My Stats'
  167. )
  168. # check language in overview
  169. click(css: '.js-menu a[href="#ticket/view"]')
  170. watch_for(
  171. css: '.content.active',
  172. value: 'My'
  173. )
  174. verify_title(
  175. value: 'My assig',
  176. )
  177. # check language in ticket create
  178. open_task(
  179. data: {
  180. title: 'Call',
  181. }
  182. )
  183. verify_task(
  184. data: {
  185. title: 'Call',
  186. }
  187. )
  188. open_task(
  189. data: {
  190. title: 'preferences lang check #1',
  191. }
  192. )
  193. watch_for(
  194. css: '.content.active',
  195. value: 'customer'
  196. )
  197. watch_for(
  198. css: '.content.active',
  199. value: 'priority'
  200. )
  201. watch_for(
  202. css: '.content.active [data-name="body"]',
  203. value: 'preferences lang check #1'
  204. )
  205. verify_title(
  206. value: 'call',
  207. )
  208. # check language in ticket zoom
  209. open_task(
  210. data: {
  211. title: 'preferences lang check #2',
  212. }
  213. )
  214. watch_for(
  215. css: '.content.active',
  216. value: 'create'
  217. )
  218. watch_for(
  219. css: '.content.active',
  220. value: 'priority'
  221. )
  222. # check language in user profile
  223. open_task(
  224. data: {
  225. title: 'Nicole',
  226. }
  227. )
  228. watch_for(
  229. css: '.content.active',
  230. value: 'note'
  231. )
  232. watch_for(
  233. css: '.content.active',
  234. value: 'email'
  235. )
  236. # check language in organization profile
  237. open_task(
  238. data: {
  239. title: 'Zammad',
  240. }
  241. )
  242. watch_for(
  243. css: '.content.active',
  244. value: 'note'
  245. )
  246. watch_for(
  247. css: '.content.active',
  248. value: 'action'
  249. )
  250. # switch to de again
  251. click(css: 'a[href="#current_user"]')
  252. click(css: 'a[href="#profile"]')
  253. click(css: 'a[href="#profile/language"]')
  254. sleep 4
  255. select(
  256. css: '.language_item [name="locale"]',
  257. value: 'Deutsch',
  258. )
  259. click(css: '.content.active button[type="submit"]')
  260. sleep 4
  261. watch_for(
  262. css: 'body',
  263. value: 'Sprache',
  264. )
  265. sleep 6
  266. # check if language is still used after reload
  267. reload()
  268. sleep 2
  269. watch_for(
  270. css: 'body',
  271. value: 'Sprache',
  272. )
  273. # check language in navbar
  274. watch_for(
  275. css: '.js-menu',
  276. value: 'Übersicht'
  277. )
  278. # check language in dashboard
  279. click(css: '.js-menu a[href="#dashboard"]')
  280. watch_for(
  281. css: '.content.active',
  282. value: 'Meine Statistik'
  283. )
  284. # check language in overview
  285. click(css: '.js-menu a[href="#ticket/view"]')
  286. watch_for(
  287. css: '.content.active',
  288. value: 'Meine'
  289. )
  290. # switch to en again
  291. click(css: 'a[href="#current_user"]')
  292. click(css: 'a[href="#profile"]')
  293. click(css: 'a[href="#profile/language"]')
  294. select(
  295. css: '.language_item [name="locale"]',
  296. value: 'English (United States)',
  297. )
  298. click(css: '.content.active button[type="submit"]')
  299. sleep 2
  300. watch_for(
  301. css: 'body',
  302. value: 'Language',
  303. )
  304. end
  305. end