From 63d0b52cf3641a819853197bf837937b9f67ef8e Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 9 Jan 2024 22:58:19 +0100 Subject: [PATCH] Add a system spec for the `/share` endpoint (#28672) --- spec/system/share_entrypoint_spec.rb | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec/system/share_entrypoint_spec.rb diff --git a/spec/system/share_entrypoint_spec.rb b/spec/system/share_entrypoint_spec.rb new file mode 100644 index 000000000..fd02d1120 --- /dev/null +++ b/spec/system/share_entrypoint_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'ShareEntrypoint' do + include ProfileStories + + subject { page } + + let(:email) { 'test@example.com' } + let(:password) { 'password' } + let(:confirmed_at) { Time.zone.now } + let(:finished_onboarding) { true } + + before do + as_a_logged_in_user + visit share_path + end + + it 'can be used to post a new status' do + expect(subject).to have_css('div#mastodon-compose') + expect(subject).to have_css('.compose-form__publish-button-wrapper > button') + + status_text = 'This is a new status!' + + within('.compose-form') do + fill_in "What's on your mind?", with: status_text + click_on 'Publish!' + end + + expect(subject).to have_css('.notification-bar-message', text: 'Post published.') + end +end