Browse Source

Maintenance: Chat image preview test waits for image to be loaded

Mantas Masalskis 2 years ago
parent
commit
94db455a2a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      spec/system/chat_spec.rb

+ 5 - 2
spec/system/chat_spec.rb

@@ -111,13 +111,15 @@ RSpec.describe 'Chat Handling', type: :system do
       expect(page).to have_no_css('.active .chat-window .chat-status.is-modified')
 
       # Keep focus outside of chat window to check .chat-status.is-modified later.
-      click '#global-search'
+      click_on 'Dashboard'
 
       using_session :customer do
         check_content('.zammad-chat .zammad-chat-agent-status', 'Online')
         send_customer_message('my name is customer')
       end
 
+      click 'a[href="#customer_chat"]'
+
       expect(page).to have_css('.active .chat-window .chat-status.is-modified')
       check_content('.active .chat-window', 'my name is customer')
 
@@ -411,7 +413,8 @@ RSpec.describe 'Chat Handling', type: :system do
       it 'use image preview' do
         visit "#customer_chat/session/#{chat_session.id}"
 
-        click '.chat-body .chat-message img'
+        find('.chat-body .chat-message img') { |elem| ActiveModel::Type::Boolean.new.cast elem[:complete] }
+          .click
 
         in_modal do
           expect(page).to have_css('.js-submit', text: 'Download')