2024-01-10 08:58:19 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 15:12:25 +10:00
|
|
|
RSpec.describe 'Share page', :js, :streaming do
|
2024-01-10 08:58:19 +11:00
|
|
|
include ProfileStories
|
|
|
|
|
|
|
|
let(:email) { 'test@example.com' }
|
|
|
|
let(:password) { 'password' }
|
|
|
|
let(:confirmed_at) { Time.zone.now }
|
|
|
|
let(:finished_onboarding) { true }
|
|
|
|
|
2024-08-28 17:58:40 +10:00
|
|
|
before { as_a_logged_in_user }
|
|
|
|
|
|
|
|
it 'allows posting a new status' do
|
2024-01-10 08:58:19 +11:00
|
|
|
visit share_path
|
|
|
|
|
2024-08-28 17:58:40 +10:00
|
|
|
expect(page)
|
|
|
|
.to have_css('.modal-layout__mastodon')
|
|
|
|
.and have_css('div#mastodon-compose')
|
|
|
|
.and have_css('.compose-form__submit')
|
2024-01-10 08:58:19 +11:00
|
|
|
|
2024-08-28 17:58:40 +10:00
|
|
|
fill_in_form
|
2024-01-10 08:58:19 +11:00
|
|
|
|
2024-08-28 17:58:40 +10:00
|
|
|
expect(page)
|
|
|
|
.to have_css('.notification-bar-message', text: translations['compose.published.body'])
|
|
|
|
end
|
|
|
|
|
|
|
|
def fill_in_form
|
2024-01-10 08:58:19 +11:00
|
|
|
within('.compose-form') do
|
2024-08-28 17:58:40 +10:00
|
|
|
fill_in translations['compose_form.placeholder'],
|
|
|
|
with: 'This is a new status!'
|
|
|
|
click_on translations['compose_form.publish']
|
2024-01-10 08:58:19 +11:00
|
|
|
end
|
2024-08-28 17:58:40 +10:00
|
|
|
end
|
2024-01-10 08:58:19 +11:00
|
|
|
|
2024-08-28 17:58:40 +10:00
|
|
|
def translations
|
|
|
|
# TODO: Extract to system spec helper for re-use?
|
|
|
|
JSON.parse(
|
|
|
|
Rails
|
|
|
|
.root
|
|
|
|
.join('app', 'javascript', 'mastodon', 'locales', 'en.json')
|
|
|
|
.read
|
|
|
|
)
|
2024-01-10 08:58:19 +11:00
|
|
|
end
|
|
|
|
end
|