aaa_getting_started_test.rb 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. require 'browser_test_helper'
  2. class AaaGettingStartedTest < TestCase
  3. def test_a_getting_started
  4. if !ENV['MAILBOX_INIT']
  5. #raise "Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
  6. puts "NOTICE: Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
  7. return
  8. end
  9. mailbox_user = ENV['MAILBOX_INIT'].split(':')[0]
  10. mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
  11. @browser = browser_instance
  12. location(url: browser_url)
  13. watch_for(
  14. css: '.setup.wizard',
  15. value: 'setup new system',
  16. )
  17. click(css: '.js-start .btn--primary')
  18. watch_for(
  19. css: '.setup.wizard',
  20. value: 'admin',
  21. )
  22. set(
  23. css: '.js-admin input[name="firstname"]',
  24. value: 'Test Master',
  25. )
  26. set(
  27. css: '.js-admin input[name="lastname"]',
  28. value: 'Agent',
  29. )
  30. set(
  31. css: '.js-admin input[name="email"]',
  32. value: 'master@example.com',
  33. )
  34. set(
  35. css: '.js-admin input[name="firstname"]',
  36. value: 'Test Master',
  37. )
  38. set(
  39. css: '.js-admin input[name="password"]',
  40. value: 'TEst1234äöüß',
  41. )
  42. set(
  43. css: '.js-admin input[name="password_confirm"]',
  44. value: 'TEst1234äöüß',
  45. )
  46. click(css: '.js-admin .btn--success')
  47. # getting started - base
  48. watch_for(
  49. css: '.js-base h2',
  50. value: 'Organization',
  51. )
  52. set(
  53. css: '.js-base input[name="organization"]',
  54. value: 'Some Organization',
  55. )
  56. set(
  57. css: '.js-base input[name="url"]',
  58. value: 'some host',
  59. )
  60. click(
  61. css: '.js-base .btn--primary',
  62. )
  63. watch_for(
  64. css: 'body',
  65. value: 'An URL looks like this',
  66. )
  67. set(
  68. css: '.js-base input[name="url"]',
  69. value: browser_url,
  70. )
  71. click(
  72. css: '.js-base .btn--primary',
  73. )
  74. # getting started - email notification
  75. watch_for(
  76. css: '.js-outbound h2',
  77. value: 'Email Notification',
  78. )
  79. location_check(
  80. url: '#getting_started/email_notification',
  81. )
  82. click(
  83. css: '.js-outbound .btn--primary',
  84. )
  85. # getting started - create email account
  86. watch_for(
  87. css: '.js-channel h2',
  88. value: 'Connect Channels',
  89. )
  90. location_check(
  91. url: '#getting_started/channel',
  92. )
  93. click(
  94. css: '.js-channel .email .provider_name',
  95. )
  96. set(
  97. css: '.js-intro input[name="realname"]',
  98. value: 'Some Realname',
  99. )
  100. set(
  101. css: '.js-intro input[name="email"]',
  102. value: mailbox_user,
  103. )
  104. set(
  105. css: '.js-intro input[name="password"]',
  106. value: mailbox_password,
  107. )
  108. click(
  109. css: '.js-intro .btn--primary',
  110. )
  111. watch_for(
  112. css: 'body',
  113. value: 'verify',
  114. timeout: 20,
  115. )
  116. watch_for(
  117. css: 'body',
  118. value: 'invite',
  119. timeout: 100,
  120. )
  121. # invite agent1
  122. location_check(
  123. url: '#getting_started/agents',
  124. )
  125. watch_for(
  126. css: '.js-agent input[name="firstname"]',
  127. )
  128. set(
  129. css: '.js-agent input[name="firstname"]',
  130. value: 'Agent 1',
  131. )
  132. set(
  133. css: '.js-agent input[name="lastname"]',
  134. value: 'Test',
  135. )
  136. set(
  137. css: '.js-agent input[name="email"]',
  138. value: 'agent1@example.com',
  139. )
  140. # not needed since we hide group selections if only one group exists
  141. #click(
  142. # css: '.js-agent input[name="group_ids"][value="1"]',
  143. #)
  144. click(
  145. css: '.js-agent .btn--success',
  146. )
  147. watch_for(
  148. css: 'body',
  149. value: 'Invitation sent',
  150. )
  151. location_check(
  152. url: '#getting_started/agents',
  153. )
  154. click(
  155. css: '.js-agent .btn--primary',
  156. )
  157. watch_for(
  158. css: 'body',
  159. value: 'My Stats',
  160. )
  161. location_check(
  162. url: '#clues',
  163. )
  164. clues_close(
  165. optional: false,
  166. )
  167. # verify organization and fqdn
  168. click(
  169. css: 'a[href="#manage"]',
  170. )
  171. click(
  172. css: '.content.active a[href="#settings/branding"]',
  173. )
  174. match(
  175. css: '.content.active input[name="organization"]',
  176. value: 'Some Organization',
  177. )
  178. click(
  179. css: '.content.active a[href="#settings/system"]',
  180. )
  181. fqdn = nil
  182. if browser_url =~ %r{://(.+?)(:.+?|/.+?|)$}
  183. fqdn = $1
  184. end
  185. raise "Unable to get fqdn based on #{browser_url}" if !fqdn
  186. match(
  187. css: '.content.active input[name="fqdn"]',
  188. value: fqdn,
  189. )
  190. end
  191. end