aaa_getting_started_test.rb 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. # encoding: utf-8
  2. require 'browser_test_helper'
  3. class AaaGettingStartedTest < TestCase
  4. def test_a_getting_started
  5. #return # TODO: temp disable
  6. if !ENV['MAILBOX_INIT']
  7. #raise "Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
  8. puts "NOTICE: Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
  9. return
  10. end
  11. mailbox_user = ENV['MAILBOX_INIT'].split(':')[0]
  12. mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
  13. @browser = browser_instance
  14. location(url: browser_url)
  15. watch_for(
  16. css: '.setup.wizard',
  17. value: 'setup new system',
  18. )
  19. click(css: '.js-start .btn--primary')
  20. watch_for(
  21. css: '.setup.wizard',
  22. value: 'admin',
  23. )
  24. set(
  25. css: '.js-admin input[name="firstname"]',
  26. value: 'Test Master',
  27. )
  28. set(
  29. css: '.js-admin input[name="lastname"]',
  30. value: 'Agent',
  31. )
  32. set(
  33. css: '.js-admin input[name="email"]',
  34. value: 'master@example.com',
  35. )
  36. set(
  37. css: '.js-admin input[name="firstname"]',
  38. value: 'Test Master',
  39. )
  40. set(
  41. css: '.js-admin input[name="password"]',
  42. value: 'test1234äöüß',
  43. )
  44. set(
  45. css: '.js-admin input[name="password_confirm"]',
  46. value: 'test1234äöüß',
  47. )
  48. click(css: '.js-admin .btn--success')
  49. # getting started - base
  50. watch_for(
  51. css: '.js-base h2',
  52. value: 'Organization',
  53. )
  54. set(
  55. css: '.js-base input[name="organization"]',
  56. value: 'Some Organization',
  57. )
  58. set(
  59. css: '.js-base input[name="url"]',
  60. value: 'some host',
  61. )
  62. click(
  63. css: '.js-base .btn--primary',
  64. )
  65. watch_for(
  66. css: 'body',
  67. value: 'A URL looks like',
  68. )
  69. set(
  70. css: '.js-base input[name="url"]',
  71. value: browser_url,
  72. )
  73. click(
  74. css: '.js-base .btn--primary',
  75. )
  76. # getting started - email notification
  77. watch_for(
  78. css: '.js-outbound h2',
  79. value: 'Email Notification',
  80. )
  81. location_check(
  82. url: '#getting_started/email_notification',
  83. )
  84. click(
  85. css: '.js-outbound .btn--primary',
  86. )
  87. # getting started - create email account
  88. watch_for(
  89. css: '.js-channel h2',
  90. value: 'Connect Channels',
  91. )
  92. location_check(
  93. url: '#getting_started/channel',
  94. )
  95. click(
  96. css: '.js-channel .email .provider_name',
  97. )
  98. set(
  99. css: '.js-intro input[name="realname"]',
  100. value: 'Some Realname',
  101. )
  102. set(
  103. css: '.js-intro input[name="email"]',
  104. value: mailbox_user,
  105. )
  106. set(
  107. css: '.js-intro input[name="password"]',
  108. value: mailbox_password,
  109. )
  110. click(
  111. css: '.js-intro .btn--primary',
  112. )
  113. watch_for(
  114. css: 'body',
  115. value: 'verify',
  116. timeout: 20,
  117. )
  118. watch_for(
  119. css: 'body',
  120. value: 'invite',
  121. timeout: 100,
  122. )
  123. # invite agent1
  124. location_check(
  125. url: '#getting_started/agents',
  126. )
  127. set(
  128. css: '.js-agent input[name="firstname"]',
  129. value: 'Agent 1',
  130. )
  131. set(
  132. css: '.js-agent input[name="lastname"]',
  133. value: 'Test',
  134. )
  135. set(
  136. css: '.js-agent input[name="email"]',
  137. value: 'agent1@example.com',
  138. )
  139. # not needed since we hide group selections if only one group exists
  140. #click(
  141. # css: '.js-agent input[name="group_ids"][value="1"]',
  142. #)
  143. click(
  144. css: '.js-agent .btn--success',
  145. )
  146. watch_for(
  147. css: 'body',
  148. value: 'Invitation sent',
  149. )
  150. location_check(
  151. url: '#getting_started/agents',
  152. )
  153. click(
  154. css: '.js-agent .btn--primary',
  155. )
  156. watch_for(
  157. css: 'body',
  158. value: 'My Stats',
  159. )
  160. location_check(
  161. url: '#clues',
  162. #url: '#dashboard',
  163. )
  164. end
  165. def test_b_accounts_auto
  166. #return # TODO: temp disable
  167. accounts = []
  168. (1..10).each {|count|
  169. next if !ENV["MAILBOX_AUTO#{count}"]
  170. mailbox_user = ENV["MAILBOX_AUTO#{count}"].split(':')[0]
  171. mailbox_password = ENV["MAILBOX_AUTO#{count}"].split(':')[1]
  172. account = {
  173. realname: 'auto account',
  174. email: mailbox_user,
  175. password: mailbox_password,
  176. }
  177. accounts.push account
  178. }
  179. if accounts.empty?
  180. #raise "Need min. MAILBOX_AUTO1 as ENV variable like export MAILBOX_AUTO1='nicole.braun2015@gmail.com:somepass'"
  181. puts "NOTICE: Need min. MAILBOX_AUTO1 as ENV variable like export MAILBOX_AUTO1='nicole.braun2015@gmail.com:somepass'"
  182. return
  183. end
  184. @browser = browser_instance
  185. login(
  186. username: 'master@example.com',
  187. password: 'test',
  188. url: browser_url,
  189. )
  190. accounts.each {|account|
  191. # getting started - auto mail
  192. location(url: browser_url + '/#getting_started/channel')
  193. click(
  194. css: '.js-channel .email .provider_name',
  195. )
  196. set(
  197. css: '.js-intro input[name="realname"]',
  198. value: account[:realname],
  199. )
  200. set(
  201. css: '.js-intro input[name="email"]',
  202. value: account[:email],
  203. )
  204. set(
  205. css: '.js-intro input[name="password"]',
  206. value: account[:password],
  207. )
  208. click(
  209. css: '.js-intro .btn--primary',
  210. )
  211. watch_for(
  212. css: 'body',
  213. value: 'verify',
  214. timeout: 20,
  215. )
  216. watch_for(
  217. css: 'body',
  218. value: 'invite',
  219. timeout: 100,
  220. )
  221. location_check(
  222. url: '#getting_started/agents',
  223. )
  224. }
  225. end
  226. def test_b_accounts_manual
  227. #return # TODO: temp disable
  228. accounts = []
  229. (1..10).each {|count|
  230. next if !ENV["MAILBOX_MANUAL#{count}"]
  231. mailbox_user = ENV["MAILBOX_MANUAL#{count}"].split(':')[0]
  232. mailbox_password = ENV["MAILBOX_MANUAL#{count}"].split(':')[1]
  233. mailbox_inbound = ENV["MAILBOX_MANUAL#{count}"].split(':')[2]
  234. mailbox_outbound = ENV["MAILBOX_MANUAL#{count}"].split(':')[3]
  235. account = {
  236. realname: 'manual account',
  237. email: mailbox_user,
  238. password: mailbox_password,
  239. inbound: {
  240. 'options::host' => mailbox_inbound,
  241. },
  242. outbound: {
  243. 'options::host' => mailbox_outbound,
  244. },
  245. }
  246. accounts.push account
  247. }
  248. if accounts.empty?
  249. #raise "Need min. MAILBOX_MANUAL1 as ENV variable like export MAILBOX_MANUAL1='nicole.bauer2015@yahoo.de:somepass:imap.mail.yahoo.com:smtp.mail.yahoo.com'"
  250. puts "NOTICE: Need min. MAILBOX_MANUAL1 as ENV variable like export MAILBOX_MANUAL1='nicole.bauer2015@yahoo.de:somepass:imap.mail.yahoo.com:smtp.mail.yahoo.com'"
  251. return
  252. end
  253. @browser = browser_instance
  254. login(
  255. username: 'master@example.com',
  256. password: 'test',
  257. url: browser_url,
  258. )
  259. accounts.each {|account|
  260. # getting started - manual mail
  261. location(url: browser_url + '/#getting_started/channel')
  262. click(
  263. css: '.js-channel .email .provider_name',
  264. )
  265. set(
  266. css: '.js-intro input[name="realname"]',
  267. value: account[:realname],
  268. )
  269. set(
  270. css: '.js-intro input[name="email"]',
  271. value: account[:email],
  272. )
  273. set(
  274. css: '.js-intro input[name="password"]',
  275. value: account[:password],
  276. )
  277. click(
  278. css: '.js-intro .btn--primary',
  279. )
  280. watch_for(
  281. css: '.js-inbound h2',
  282. value: 'inbound',
  283. timeout: 220,
  284. )
  285. watch_for(
  286. css: '.js-inbound',
  287. value: 'manual',
  288. )
  289. set(
  290. css: '.js-inbound input[name="options::host"]',
  291. value: account[:inbound]['options::host'],
  292. )
  293. click(
  294. css: '.js-inbound .btn--primary',
  295. )
  296. watch_for(
  297. css: '.js-outbound h2',
  298. value: 'outbound',
  299. )
  300. select(
  301. css: '.js-outbound select[name="adapter"]',
  302. value: 'SMTP - configure your own outgoing SMTP settings',
  303. )
  304. set(
  305. css: '.js-outbound input[name="options::host"]',
  306. value: account[:outbound]['options::host'],
  307. )
  308. click(
  309. css: '.js-outbound .btn--primary',
  310. )
  311. watch_for(
  312. css: 'body',
  313. value: 'verify',
  314. )
  315. watch_for(
  316. css: 'body',
  317. value: 'invite',
  318. timeout: 190,
  319. )
  320. location_check(
  321. url: '#getting_started/agents',
  322. )
  323. }
  324. end
  325. end