aaa_getting_started_test.rb 5.1 KB

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