mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 10:38:07 +01:00
Add end-to-end test for OCR in media uploads (#29148)
This commit is contained in:
parent
a9e91eb955
commit
ca8fbda5d0
3 changed files with 34 additions and 0 deletions
|
@ -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}
|
||||
|
|
BIN
spec/fixtures/files/text.png
vendored
Normal file
BIN
spec/fixtures/files/text.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
33
spec/system/ocr_spec.rb
Normal file
33
spec/system/ocr_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue