You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. feature 'Profile' do
  4. include ProfileStories
  5. given(:local_domain) { ENV['LOCAL_DOMAIN'] }
  6. background do
  7. as_a_logged_in_user
  8. with_alice_as_local_user
  9. end
  10. subject { page }
  11. scenario 'I can view Annes public account' do
  12. visit account_path('alice')
  13. is_expected.to have_title("alice (@alice@#{local_domain})")
  14. within('.public-account-header h1') do
  15. is_expected.to have_content("alice @alice@#{local_domain}")
  16. end
  17. bio_elem = first('.public-account-bio')
  18. expect(bio_elem).to have_content(alice_bio)
  19. # The bio has hashtags made clickable
  20. expect(bio_elem).to have_link('cryptology')
  21. expect(bio_elem).to have_link('science')
  22. # Nicknames are make clickable
  23. expect(bio_elem).to have_link('@alice')
  24. expect(bio_elem).to have_link('@bob')
  25. # Nicknames not on server are not clickable
  26. expect(bio_elem).not_to have_link('@pepe')
  27. end
  28. scenario 'I can change my account' do
  29. visit settings_profile_path
  30. fill_in 'Display name', with: 'Bob'
  31. fill_in 'Bio', with: 'Bob is silent'
  32. first('.btn[type=submit]').click
  33. is_expected.to have_content 'Changes successfully saved!'
  34. # View my own public profile and see the changes
  35. click_link "Bob @bob@#{local_domain}"
  36. within('.public-account-header h1') do
  37. is_expected.to have_content("Bob @bob@#{local_domain}")
  38. end
  39. expect(first('.public-account-bio')).to have_content('Bob is silent')
  40. end
  41. end