chat_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Chat Handling', type: :system do
  4. let(:agent_chat_switch_selector) { '#navigation .js-chatMenuItem .js-switch' }
  5. def authenticate
  6. Setting.set('chat', true)
  7. true
  8. end
  9. it 'Check that button is hidden after idle timeout (JQuery and without JQuery variant)', authenticated_as: :authenticate do
  10. click agent_chat_switch_selector
  11. open_window_and_switch
  12. visit "/assets/chat/znuny_open_by_button.html?port=#{ENV['WS_PORT']}"
  13. expect(page).to have_css('.zammad-chat', visible: :all)
  14. expect(page).to have_css('.zammad-chat-is-hidden', visible: :all)
  15. expect(page).to have_no_css('.open-zammad-chat:not([style*="display: none"]', visible: :all)
  16. visit "/assets/chat/znuny-no-jquery-open_by_button.html?port=#{ENV['WS_PORT']}"
  17. expect(page).to have_css('.zammad-chat', visible: :all)
  18. expect(page).to have_css('.zammad-chat-is-hidden', visible: :all)
  19. expect(page).to have_no_css('.open-zammad-chat:not([style*="display: none"]', visible: :all)
  20. end
  21. end