registration_spec.rb 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Desktop > Registration', app: :desktop_view, authenticated_as: false, type: :system do
  4. notification_url = ''
  5. before do
  6. allow(NotificationFactory::Mailer).to receive(:notification) do |params|
  7. notification_url = params[:objects][:url]
  8. end
  9. end
  10. it 'Register a new user and log in with the confirmation link' do
  11. visit '/login', skip_waiting: true
  12. click_on 'Register'
  13. fill_in 'First name', with: 'John'
  14. fill_in 'Last name', with: 'Doe'
  15. fill_in 'Email', with: 'john.doe@example.com'
  16. fill_in 'Password', with: 's3cr3tPassWord'
  17. fill_in 'Confirm password', with: 's3cr3tPassWord'
  18. click_on 'Create my account'
  19. expect(page).to have_text('Thanks for joining. Email sent to "john.doe@example.com".')
  20. expect(notification_url).to be_present
  21. visit notification_url.sub(%r{.*/desktop/}, '')
  22. expect_current_route '/'
  23. wait_for_test_flag('useSessionUserStore.getCurrentUser.loaded')
  24. end
  25. end