preferences_language_test.rb 6.5 KB

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