guided_setup_spec.rb 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require_relative '../../../../lib/zammad/service/redis'
  4. RSpec.describe 'Desktop > Guided Setup', app: :desktop_view, authenticated_as: false, integration: true, required_envs: %w[MAIL_ADDRESS MAIL_PASS], set_up: false, type: :system do
  5. before do
  6. # Import mail server CA certificate into the trust store.
  7. SSLCertificate.create!(certificate: Rails.root.join('spec/fixtures/files/imap/ca.crt').read)
  8. allow(NotificationFactory::Mailer).to receive(:notification)
  9. end
  10. after do
  11. # Make sure lock is lifted even on test errors.
  12. Zammad::Service::Redis.new.del('Zammad::System::Setup')
  13. end
  14. it 'Perform the basic system set-up' do
  15. visit '/'
  16. click_on 'Set up a new system'
  17. # Invalid password
  18. fill_in 'First name', with: 'John'
  19. fill_in 'Last name', with: 'Doe'
  20. fill_in 'Email', with: 'john.doe@example.com'
  21. fill_in 'Password', with: '1234'
  22. fill_in 'Confirm password', with: '1234'
  23. click_on 'Create account'
  24. expect(page).to have_text('Invalid password')
  25. # Valid password, create account
  26. fill_in 'Password', with: 'testTEST1234'
  27. fill_in 'Confirm password', with: 'testTEST1234'
  28. click_on 'Create account'
  29. fill_in 'Organization name', with: 'Test corp.'
  30. find('input[name="logo"]', visible: :all).set(Rails.root.join('test/data/image/1000x1000.png'))
  31. fill_in 'System URL', with: app_host
  32. click_on 'Save and Continue'
  33. # Accept default setting (local MTA).
  34. expect(page).to have_text('Email Notification')
  35. click_on 'Save and Continue'
  36. click_on 'Email Channel'
  37. fill_in 'Full name', with: 'John Doe'
  38. fill_in 'Email address', with: ENV['MAIL_ADDRESS']
  39. fill_in 'Password', with: ENV['MAIL_PASS']
  40. click_on 'Connect and Continue'
  41. expect(page).to have_text('Verifying and saving your configuration…')
  42. expect(page).to have_text('Invite Colleagues', wait: 2.minutes)
  43. fill_in 'First name', with: 'Jim'
  44. fill_in 'Last name', with: 'Doe'
  45. fill_in 'Email', with: 'jim.doe@example.com'
  46. click_on 'Send Invitation'
  47. expect(page).to have_text('Invitation sent!')
  48. click_on('Finish Setup')
  49. expect(NotificationFactory::Mailer).to have_received(:notification).once
  50. expect_current_route('/')
  51. # TODO: check for "clues" in UI, not available yet.
  52. end
  53. end