aaa_getting_started_test.rb 8.5 KB

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