diff --git a/app/javascript/mastodon/features/compose/components/upload_button.jsx b/app/javascript/mastodon/features/compose/components/upload_button.jsx index 3866f239d7..50c9ad6321 100644 --- a/app/javascript/mastodon/features/compose/components/upload_button.jsx +++ b/app/javascript/mastodon/features/compose/components/upload_button.jsx @@ -65,6 +65,7 @@ class UploadButton extends ImmutablePureComponent { key={resetFileKey} ref={this.setRef} type='file' + name='file-upload-input' multiple accept={acceptContentTypes.toArray().join(',')} onChange={this.handleChange} diff --git a/spec/fixtures/files/text.png b/spec/fixtures/files/text.png new file mode 100644 index 0000000000..7463b54fd5 Binary files /dev/null and b/spec/fixtures/files/text.png differ diff --git a/spec/system/ocr_spec.rb b/spec/system/ocr_spec.rb new file mode 100644 index 0000000000..3ab815c047 --- /dev/null +++ b/spec/system/ocr_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'OCR', :paperclip_processing, :sidekiq_inline do + include ProfileStories + + 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 root_path + end + + it 'can recognize text in a media attachment' do + expect(page).to have_css('div.app-holder') + + within('.compose-form') do + attach_file('file-upload-input', file_fixture('text.png'), make_visible: true) + + within('.compose-form__upload') do + click_on('Edit') + end + end + + click_on('Detect text from picture') + + expect(page).to have_css('#upload-modal__description', text: 'Hello Mastodon') + end +end