ocr_spec.rb 846 B

123456789101112131415161718192021222324252627282930313233
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'OCR', :js, :paperclip_processing, :sidekiq_inline, :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 do
  10. as_a_logged_in_user
  11. visit root_path
  12. end
  13. it 'can recognize text in a media attachment' do
  14. expect(page).to have_css('div.app-holder')
  15. within('.compose-form') do
  16. attach_file('file-upload-input', file_fixture('text.png'), make_visible: true)
  17. within('.compose-form__upload') do
  18. click_on('Edit')
  19. end
  20. end
  21. click_on('Detect text from picture')
  22. expect(page).to have_css('#upload-modal__description', text: /Hello Mastodon\s*/, wait: 10)
  23. end
  24. end