aaa_getting_started_test.rb 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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@znuny.com:somepass'"
  7. puts "NOTICE: Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.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,
  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. click(
  84. css: '.js-outbound .btn--primary',
  85. )
  86. # getting started - create email account
  87. watch_for(
  88. css: '.js-channel h2',
  89. value: 'Connect Channels',
  90. )
  91. location_check(
  92. url: '#getting_started/channel',
  93. )
  94. click(
  95. css: '.js-channel .email .provider_name',
  96. )
  97. set(
  98. css: '.js-intro input[name="realname"]',
  99. value: 'Some Realname',
  100. )
  101. set(
  102. css: '.js-intro input[name="email"]',
  103. value: mailbox_user,
  104. )
  105. set(
  106. css: '.js-intro input[name="password"]',
  107. value: mailbox_password,
  108. )
  109. click(
  110. css: '.js-intro .btn--primary',
  111. )
  112. watch_for(
  113. css: 'body',
  114. value: 'verify',
  115. timeout: 20,
  116. )
  117. watch_for(
  118. css: 'body',
  119. value: 'invite',
  120. timeout: 100,
  121. )
  122. # invite agent1
  123. location_check(
  124. url: '#getting_started/agents',
  125. )
  126. watch_for(
  127. css: '.js-agent input[name="firstname"]',
  128. )
  129. set(
  130. css: '.js-agent input[name="firstname"]',
  131. value: 'Agent 1',
  132. )
  133. set(
  134. css: '.js-agent input[name="lastname"]',
  135. value: 'Test',
  136. )
  137. set(
  138. css: '.js-agent input[name="email"]',
  139. value: 'agent1@example.com',
  140. )
  141. # not needed since we hide group selections if only one group exists
  142. # click(
  143. # css: '.js-agent input[name="group_ids"][value="1"]',
  144. # )
  145. check(css: '.js-agent .js-groupListItem[value=full]')
  146. click(
  147. css: '.js-agent .btn--success',
  148. )
  149. watch_for(
  150. css: 'body',
  151. value: 'Invitation sent',
  152. )
  153. location_check(
  154. url: '#getting_started/agents',
  155. )
  156. click(
  157. css: '.js-agent .btn--primary',
  158. )
  159. watch_for(
  160. css: 'body',
  161. value: 'My Stats',
  162. )
  163. location_check(
  164. url: '#clues',
  165. )
  166. clues_close(
  167. optional: false,
  168. )
  169. # verify organization and fqdn
  170. click(
  171. css: 'a[href="#manage"]',
  172. )
  173. click(
  174. css: '.content.active a[href="#settings/branding"]',
  175. )
  176. match(
  177. css: '.content.active input[name="organization"]',
  178. value: 'Some Organization',
  179. )
  180. click(
  181. css: '.content.active a[href="#settings/system"]',
  182. )
  183. fqdn = nil
  184. if browser_url =~ %r{://(.+?)(:.+?|/.+?|)$}
  185. fqdn = $1
  186. end
  187. raise "Unable to get fqdn based on #{browser_url}" if !fqdn
  188. match(
  189. css: '.content.active input[name="fqdn"]',
  190. value: fqdn,
  191. )
  192. end
  193. end