share_entrypoint_spec.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Share page', :js, :streaming do
  4. include ProfileStories
  5. let(:email) { 'test@example.com' }
  6. let(:password) { 'password' }
  7. let(:confirmed_at) { Time.zone.now }
  8. let(:finished_onboarding) { true }
  9. before { as_a_logged_in_user }
  10. it 'allows posting a new status' do
  11. visit share_path
  12. expect(page)
  13. .to have_css('.modal-layout__mastodon')
  14. .and have_css('div#mastodon-compose')
  15. .and have_css('.compose-form__submit')
  16. fill_in_form
  17. expect(page)
  18. .to have_css('.notification-bar-message', text: translations['compose.published.body'])
  19. end
  20. def fill_in_form
  21. within('.compose-form') do
  22. fill_in translations['compose_form.placeholder'],
  23. with: 'This is a new status!'
  24. click_on translations['compose_form.publish']
  25. end
  26. end
  27. def translations
  28. # TODO: Extract to system spec helper for re-use?
  29. JSON.parse(
  30. Rails
  31. .root
  32. .join('app', 'javascript', 'mastodon', 'locales', 'en.json')
  33. .read
  34. )
  35. end
  36. end