Maintenance: Ported chat test to capybara to increase the test stabilization.
This commit is contained in:
parent
423fafb701
commit
edcb483b85
8 changed files with 378 additions and 1767 deletions
|
@ -151,8 +151,8 @@
|
|||
background: '#494d52',
|
||||
flat: true,
|
||||
show: false,
|
||||
idleTimeout: 0.2,
|
||||
idleTimeoutIntervallCheck: 0.2,
|
||||
idleTimeout: 0.1,
|
||||
idleTimeoutIntervallCheck: 0.11,
|
||||
inactiveTimeout: 2,
|
||||
inactiveTimeoutIntervallCheck: 0.5,
|
||||
waitingListTimeout: 1.2,
|
||||
|
|
|
@ -150,12 +150,12 @@
|
|||
debug: true,
|
||||
background: '#494d52',
|
||||
flat: true,
|
||||
idleTimeout: 1,
|
||||
idleTimeoutIntervallCheck: 0.5,
|
||||
inactiveTimeout: 2,
|
||||
inactiveTimeoutIntervallCheck: 0.5,
|
||||
waitingListTimeout: 1.2,
|
||||
waitingListTimeoutIntervallCheck: 0.5,
|
||||
idleTimeout: 0.1,
|
||||
idleTimeoutIntervallCheck: 0.11,
|
||||
inactiveTimeout: 0.3,
|
||||
inactiveTimeoutIntervallCheck: 0.31,
|
||||
waitingListTimeout: 0.1,
|
||||
waitingListTimeoutIntervallCheck: 0.11,
|
||||
});
|
||||
|
||||
function updateStyle(form){
|
||||
|
@ -170,4 +170,4 @@
|
|||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -157,12 +157,12 @@
|
|||
debug: true,
|
||||
background: '#494d52',
|
||||
flat: true,
|
||||
idleTimeout: 1,
|
||||
idleTimeoutIntervallCheck: 0.5,
|
||||
inactiveTimeout: 2,
|
||||
inactiveTimeoutIntervallCheck: 0.5,
|
||||
waitingListTimeout: 1.2,
|
||||
waitingListTimeoutIntervallCheck: 0.5,
|
||||
idleTimeout: 0.2,
|
||||
idleTimeoutIntervallCheck: 0.21,
|
||||
inactiveTimeout: 0.3,
|
||||
inactiveTimeoutIntervallCheck: 0.31,
|
||||
waitingListTimeout: 0.1,
|
||||
waitingListTimeoutIntervallCheck: 0.11,
|
||||
});
|
||||
|
||||
$('.settings :input').on({
|
||||
|
@ -198,4 +198,4 @@
|
|||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -158,8 +158,8 @@
|
|||
background: '#494d52',
|
||||
flat: true,
|
||||
show: false,
|
||||
idleTimeout: 0.2,
|
||||
idleTimeoutIntervallCheck: 0.2,
|
||||
idleTimeout: 0.1,
|
||||
idleTimeoutIntervallCheck: 0.11,
|
||||
inactiveTimeout: 2,
|
||||
inactiveTimeoutIntervallCheck: 0.5,
|
||||
waitingListTimeout: 1.2,
|
||||
|
|
|
@ -54,8 +54,6 @@ if [ "$LEVEL" == '1' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
# test/browser/auth_test.rb
|
||||
rm test/browser/chat_test.rb
|
||||
rm test/browser/chat_no_jquery_test.rb
|
||||
rm test/browser/customer_ticket_create_fields_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
|
@ -129,8 +127,6 @@ elif [ "$LEVEL" == '2' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
rm test/browser/chat_test.rb
|
||||
rm test/browser/chat_no_jquery_test.rb
|
||||
rm test/browser/customer_ticket_create_fields_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
|
@ -204,8 +200,6 @@ elif [ "$LEVEL" == '3' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
rm test/browser/chat_test.rb
|
||||
rm test/browser/chat_no_jquery_test.rb
|
||||
rm test/browser/customer_ticket_create_fields_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
|
@ -279,8 +273,6 @@ elif [ "$LEVEL" == '4' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
rm test/browser/chat_test.rb
|
||||
rm test/browser/chat_no_jquery_test.rb
|
||||
# test/browser/customer_ticket_create_fields_test.rb
|
||||
# test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
|
@ -353,8 +345,6 @@ elif [ "$LEVEL" == '5' ]; then
|
|||
# test/browser/agent_user_manage_test.rb
|
||||
# test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
rm test/browser/chat_test.rb
|
||||
rm test/browser/chat_no_jquery_test.rb
|
||||
rm test/browser/customer_ticket_create_fields_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
rm test/browser/first_steps_test.rb
|
||||
|
@ -430,8 +420,6 @@ elif [ "$LEVEL" == '6' ]; then
|
|||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
# test/browser/chat_test.rb
|
||||
# test/browser/chat_no_jquery_test.rb
|
||||
rm test/browser/customer_ticket_create_fields_test.rb
|
||||
rm test/browser/customer_ticket_create_test.rb
|
||||
# test/browser/first_steps_test.rb
|
||||
|
|
|
@ -3,16 +3,47 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Chat Handling', type: :system do
|
||||
let(:admin) { create(:admin) }
|
||||
let(:agent_chat_switch_selector) { '#navigation .js-chatMenuItem .js-switch' }
|
||||
let(:chat_url) { "/assets/chat/znuny_open_by_button.html?port=#{ENV['WS_PORT']}" }
|
||||
let(:chat_url) { "/assets/chat/#{chat_url_type}.html?port=#{ENV['WS_PORT']}" }
|
||||
let(:chat_url_type) { 'znuny' }
|
||||
|
||||
def authenticate
|
||||
Setting.set('chat', true)
|
||||
true
|
||||
end
|
||||
|
||||
def check_content(selector, value, should_match: true, wait: nil)
|
||||
if should_match
|
||||
expect(page).to have_css(selector, wait: wait, text: value)
|
||||
else
|
||||
expect(page).to have_no_css(selector, wait: wait, text: value)
|
||||
end
|
||||
end
|
||||
|
||||
def enable_agent_chat
|
||||
click agent_chat_switch_selector
|
||||
click 'a[href="#customer_chat"]'
|
||||
end
|
||||
|
||||
def open_chat_dialog
|
||||
expect(page).to have_css('.zammad-chat')
|
||||
click '.zammad-chat .js-chat-open'
|
||||
expect(page).to have_css('.zammad-chat-is-shown')
|
||||
end
|
||||
|
||||
def send_customer_message(message)
|
||||
find('.zammad-chat .zammad-chat-input').send_keys(message)
|
||||
click '.zammad-chat .zammad-chat-send'
|
||||
end
|
||||
|
||||
def send_agent_message(message)
|
||||
find('.active .chat-window .js-customerChatInput').send_keys(message)
|
||||
click '.active .chat-window .js-send'
|
||||
end
|
||||
|
||||
shared_examples 'chat button is hidden after idle timeout' do
|
||||
it 'Check that button is hidden after idle timeout', authenticated_as: :authenticate do
|
||||
it 'check that button is hidden after idle timeout', authenticated_as: :authenticate do
|
||||
click agent_chat_switch_selector
|
||||
|
||||
open_window_and_switch
|
||||
|
@ -25,13 +56,337 @@ RSpec.describe 'Chat Handling', type: :system do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples 'chat messages' do
|
||||
it 'messages in each direction, starting on agent side', authenticated_as: :authenticate do
|
||||
enable_agent_chat
|
||||
|
||||
open_window_and_switch
|
||||
|
||||
visit chat_url
|
||||
|
||||
open_chat_dialog
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .js-acceptChat'
|
||||
|
||||
expect(page).to have_no_css('.active .chat-window .chat-status.is-modified')
|
||||
check_content('.active .chat-window .js-body', chat_url)
|
||||
|
||||
send_agent_message('my name is me')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat .zammad-chat-agent-status', 'Online')
|
||||
check_content('.zammad-chat', 'my name is me')
|
||||
|
||||
send_customer_message('my name is customer')
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
check_content('.active .chat-window', 'my name is customer')
|
||||
expect(page).to have_css('.active .chat-window .chat-status.is-modified')
|
||||
|
||||
click '.active .chat-window .js-customerChatInput'
|
||||
|
||||
expect(page).to have_no_css('.active .chat-window .chat-status.is-modified')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
click '.js-chat-toggle .zammad-chat-header-icon'
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
check_content('.active .chat-window', 'closed the conversation')
|
||||
end
|
||||
|
||||
it 'messages in each direction, starting on customer side', authenticated_as: :authenticate do
|
||||
enable_agent_chat
|
||||
|
||||
open_window_and_switch
|
||||
|
||||
visit chat_url
|
||||
|
||||
open_chat_dialog
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .js-acceptChat'
|
||||
|
||||
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'
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat .zammad-chat-agent-status', 'Online')
|
||||
|
||||
send_customer_message('my name is customer')
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
expect(page).to have_css('.active .chat-window .chat-status.is-modified')
|
||||
check_content('.active .chat-window', 'my name is customer')
|
||||
|
||||
send_agent_message('my name is me')
|
||||
expect(page).to have_no_css('.active .chat-window .chat-status.is-modified')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat', 'my name is me')
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .chat-window .js-disconnect:not(.is-hidden)'
|
||||
click '.active .chat-window .js-close'
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat .zammad-chat-agent-status', 'Offline')
|
||||
check_content('.zammad-chat', %r{(Chat closed by|Chat beendet von)})
|
||||
|
||||
click '.zammad-chat .js-chat-toggle .zammad-chat-header-icon'
|
||||
|
||||
expect(page).to have_no_css('.zammad-chat-is-open')
|
||||
|
||||
open_chat_dialog
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .js-acceptChat'
|
||||
|
||||
expect(page).to have_css('.active .chat-window .chat-status')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'open chat with button' do
|
||||
it 'open the chat', authenticated_as: :authenticate do
|
||||
enable_agent_chat
|
||||
|
||||
open_window_and_switch
|
||||
|
||||
visit chat_url
|
||||
|
||||
expect(page).to have_css('.zammad-chat', visible: :all)
|
||||
expect(page).to have_css('.zammad-chat-is-hidden', visible: :all)
|
||||
expect(page).to have_no_css('.zammad-chat-is-shown', visible: :all)
|
||||
expect(page).to have_no_css('.zammad-chat-is-open', visible: :all)
|
||||
|
||||
click '.open-zammad-chat'
|
||||
|
||||
expect(page).to have_css('.zammad-chat-is-shown', visible: :all)
|
||||
expect(page).to have_css('.zammad-chat-is-open', visible: :all)
|
||||
check_content('.zammad-chat-modal-text', %r{(waiting|Warte)})
|
||||
|
||||
click '.zammad-chat-header-icon-close'
|
||||
|
||||
expect(page).to have_no_css('.zammad-chat-is-shown', visible: :all)
|
||||
expect(page).to have_no_css('.zammad-chat-is-open', visible: :all)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'timeouts' do
|
||||
it 'check different timeouts', authenticated_as: :authenticate do
|
||||
enable_agent_chat
|
||||
|
||||
open_window_and_switch
|
||||
|
||||
visit chat_url
|
||||
|
||||
# No customer action, hide the widget.
|
||||
expect(page).to have_css('.zammad-chat')
|
||||
|
||||
expect(page).to have_no_css('.zammad-chat', wait: 20)
|
||||
|
||||
refresh
|
||||
|
||||
# No agent action, show sorry screen.
|
||||
open_chat_dialog
|
||||
|
||||
check_content('.zammad-chat-modal-text', %r{(waiting|Warte)})
|
||||
check_content('.zammad-chat-modal-text', %r{(takes longer|dauert länger)}, wait: 20)
|
||||
|
||||
refresh
|
||||
|
||||
# No customer action, show sorry screen.
|
||||
open_chat_dialog
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .js-acceptChat'
|
||||
|
||||
send_agent_message('agent is asking')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat', 'agent is asking')
|
||||
|
||||
check_content('.zammad-chat-modal-text', %r{(Since you didn't respond|Da Sie in den letzten)}, wait: 30)
|
||||
|
||||
# Test the restart of inactive chat.
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .chat-window .js-close'
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
click '.js-restart'
|
||||
|
||||
open_chat_dialog
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .js-acceptChat'
|
||||
|
||||
send_agent_message('my name is me')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat', 'my name is me')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when chat is activated or disabled' do
|
||||
it 'switch the chat setting', authenticated_as: :authenticate do
|
||||
visit '/#channels/chat'
|
||||
|
||||
click '.content.active .js-chatSetting'
|
||||
|
||||
expect(page).to have_no_css(agent_chat_switch_selector)
|
||||
|
||||
open_window_and_switch
|
||||
|
||||
visit chat_url
|
||||
|
||||
check_content('.settings', '{"state":"chat_disabled"}')
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.content.active .js-chatSetting'
|
||||
|
||||
expect(page).to have_css(agent_chat_switch_selector)
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).to have_no_css('.zammad-chat')
|
||||
check_content('.settings', '{"state":"chat_disabled"}', should_match: false)
|
||||
check_content('.settings', '{"event":"chat_status_customer","data":{"state":"offline"}}')
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click agent_chat_switch_selector
|
||||
click 'a[href="#customer_chat"]'
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).to have_css('.zammad-chat')
|
||||
check_content('.settings', '{"event":"chat_status_customer","data":{"state":"offline"}}', should_match: false)
|
||||
check_content('.settings', '{"state":"online"}')
|
||||
|
||||
click '.zammad-chat .js-chat-open'
|
||||
|
||||
expect(page).to have_css('.zammad-chat-is-shown')
|
||||
check_content('.zammad-chat-modal-text', %r{(waiting|Warte)})
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
check_content('.js-chatMenuItem .counter', '1')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
click '.zammad-chat .js-chat-toggle .zammad-chat-header-icon'
|
||||
|
||||
check_content('.zammad-chat-modal-text', %r{(waiting|Warte)}, should_match: false)
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
expect(page).to have_no_css('.js-chatMenuItem .counter')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when changing chat preferences for current agent' do
|
||||
it 'use chat phrase preference', authenticated_as: :authenticate do
|
||||
enable_agent_chat
|
||||
|
||||
click '.active .js-settings'
|
||||
|
||||
modal_ready
|
||||
|
||||
find('.modal [name="chat::phrase::1"]').send_keys('Hi Stranger!;My Greeting')
|
||||
click '.modal .js-submit'
|
||||
|
||||
modal_disappear
|
||||
|
||||
open_window_and_switch
|
||||
|
||||
visit chat_url
|
||||
|
||||
open_chat_dialog
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
click '.active .js-acceptChat'
|
||||
|
||||
expect(page).to have_css('.active .chat-window .chat-status')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat', %r{(Hi Stranger|My Greeting)})
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
send_agent_message('my name is me')
|
||||
|
||||
switch_to_window_index(2)
|
||||
|
||||
check_content('.zammad-chat', 'my name is me')
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).to have_css('.zammad-chat')
|
||||
check_content('.zammad-chat', %r{(Hi Stranger|My Greeting)})
|
||||
check_content('.zammad-chat', 'my name is me')
|
||||
|
||||
visit "#{chat_url}#new_hash"
|
||||
|
||||
switch_to_window_index(1)
|
||||
|
||||
check_content('.active .chat-window .js-body', "#{chat_url}#new_hash")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when jquery variant is used' do
|
||||
include_examples 'chat button is hidden after idle timeout'
|
||||
context 'when normal mode is used' do
|
||||
include_examples 'chat messages'
|
||||
include_examples 'timeouts'
|
||||
end
|
||||
|
||||
context 'when button mode is active' do
|
||||
let(:chat_url_type) { 'znuny_open_by_button' }
|
||||
|
||||
include_examples 'open chat with button'
|
||||
include_examples 'chat button is hidden after idle timeout'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when none jquery variant is used' do
|
||||
let(:chat_url) { "/assets/chat/znuny-no-jquery-open_by_button.html?port=#{ENV['WS_PORT']}" }
|
||||
let(:chat_url_type) { 'znuny-no-jquery' }
|
||||
|
||||
include_examples 'chat button is hidden after idle timeout'
|
||||
context 'when normal mode is used' do
|
||||
include_examples 'chat messages'
|
||||
include_examples 'timeouts'
|
||||
end
|
||||
|
||||
context 'when button mode is active' do
|
||||
let(:chat_url_type) { 'znuny-no-jquery-open_by_button' }
|
||||
|
||||
include_examples 'open chat with button'
|
||||
include_examples 'chat button is hidden after idle timeout'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,866 +0,0 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require 'browser_test_helper'
|
||||
|
||||
class ChatNoJqueryTest < TestCase
|
||||
|
||||
def test_basic
|
||||
chat_url = "#{browser_url}/assets/chat/znuny-no-jquery.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
|
||||
# disable chat
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#manage"]',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.content.active a[href="#channels/chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '.content.active .js-chatSetting',
|
||||
type: 'off',
|
||||
)
|
||||
|
||||
# nav bar shuld be gone
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
sleep 15
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
sleep 4
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
match(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"state":"chat_disabled"}',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#manage"]',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.content.active a[href="#channels/chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '.content.active .js-chatSetting',
|
||||
type: 'on',
|
||||
)
|
||||
sleep 15 # wait for rerendering
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch',
|
||||
type: 'off',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
wait: 2,
|
||||
)
|
||||
match_not(
|
||||
browser: agent,
|
||||
css: '.active.content',
|
||||
value: 'disabled',
|
||||
)
|
||||
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
sleep 4
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
match_not(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"state":"chat_disabled"}',
|
||||
)
|
||||
match(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"event":"chat_status_customer","data":{"state":"offline"}}',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch',
|
||||
type: 'on',
|
||||
)
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
match_not(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"state":"chat_disabled"}',
|
||||
)
|
||||
match_not(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"event":"chat_status_customer","data":{"state":"offline"}}',
|
||||
)
|
||||
match(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '"data":{"state":"online"}',
|
||||
)
|
||||
|
||||
# init chat
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.js-chatMenuItem .counter',
|
||||
value: '1',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: agent,
|
||||
css: '.js-chatMenuItem .counter',
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def test_basic_usecase1
|
||||
chat_url = "#{browser_url}/assets/chat/znuny-no-jquery.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
match(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-body',
|
||||
value: chat_url,
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
set(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-input',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
)
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'closed the conversation',
|
||||
)
|
||||
end
|
||||
|
||||
def test_basic_usecase2
|
||||
chat_url = "#{browser_url}/assets/chat/znuny-no-jquery.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
|
||||
# keep focus outside of chat window to check .chat-status.is-modified later
|
||||
click(
|
||||
browser: agent,
|
||||
css: '#global-search',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
set(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-input',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-disconnect:not(.is-hidden)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-close',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'offline',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(Chat closed by|Chat beendet von)',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
sleep 2
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status',
|
||||
)
|
||||
end
|
||||
|
||||
def test_basic_usecase3
|
||||
chat_url = "#{browser_url}/assets/chat/znuny-no-jquery.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
# set chat preferences
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-settings',
|
||||
)
|
||||
|
||||
modal_ready(browser: agent)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.modal [name="chat::phrase::1"]',
|
||||
value: 'Hi Stranger!;My Greeting',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.modal .js-submit',
|
||||
)
|
||||
modal_disappear(browser: agent)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .js-badgeWaitingCustomers',
|
||||
value: '1',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'Hi Stranger|My Greeting',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
match(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-body',
|
||||
value: chat_url,
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
set(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-input',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
)
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'Hi Stranger|My Greeting',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
location(
|
||||
browser: customer,
|
||||
url: "#{chat_url}#new_hash",
|
||||
)
|
||||
sleep 2
|
||||
match(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-body',
|
||||
value: "#{chat_url}#new_hash",
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'closed the conversation',
|
||||
)
|
||||
end
|
||||
|
||||
def test_open_chat_by_button
|
||||
chat_url = "#{browser_url}/assets/chat/znuny-no-jquery-open_by_button.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.open-zammad-chat',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
timeout: 4,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
timeout: 4,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-header-icon-close',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
timeout: 4,
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
timeout: 4,
|
||||
)
|
||||
end
|
||||
|
||||
def test_timeouts
|
||||
chat_url = "#{browser_url}/assets/chat/znuny-no-jquery.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch input[checked]'
|
||||
)
|
||||
|
||||
# no customer action, hide widget
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 95,
|
||||
)
|
||||
|
||||
# no agent action, show sorry screen
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
timeout: 35,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(takes longer|dauert länger)',
|
||||
timeout: 120,
|
||||
)
|
||||
|
||||
# check if agent is offline, idle timeout, chat not answered
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch input[checked]'
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch',
|
||||
type: 'on',
|
||||
)
|
||||
|
||||
# no customer action, show sorry screen
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.js-chatMenuItem .counter',
|
||||
value: '1',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'agent is asking',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'agent is asking',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(Since you didn\'t respond|Da Sie in den letzten)',
|
||||
timeout: 150,
|
||||
)
|
||||
|
||||
agent.find_elements({ css: '.active .chat-window .js-close' }).each(&:click)
|
||||
sleep 2
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-restart',
|
||||
)
|
||||
sleep 5
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status',
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def disable_chat
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
|
||||
# disable chat
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#manage"]',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.content.active a[href="#channels/chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '.content.active .js-chatSetting',
|
||||
type: 'off',
|
||||
)
|
||||
end
|
||||
|
||||
end
|
|
@ -1,866 +0,0 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require 'browser_test_helper'
|
||||
|
||||
class ChatTest < TestCase
|
||||
|
||||
def test_basic
|
||||
chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
|
||||
# disable chat
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#manage"]',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.content.active a[href="#channels/chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '.content.active .js-chatSetting',
|
||||
type: 'off',
|
||||
)
|
||||
|
||||
# nav bar shuld be gone
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
sleep 15
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
sleep 4
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
match(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"state":"chat_disabled"}',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#manage"]',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.content.active a[href="#channels/chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '.content.active .js-chatSetting',
|
||||
type: 'on',
|
||||
)
|
||||
sleep 15 # wait for rerendering
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch',
|
||||
type: 'off',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
wait: 2,
|
||||
)
|
||||
match_not(
|
||||
browser: agent,
|
||||
css: '.active.content',
|
||||
value: 'disabled',
|
||||
)
|
||||
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
sleep 4
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
match_not(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"state":"chat_disabled"}',
|
||||
)
|
||||
match(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"event":"chat_status_customer","data":{"state":"offline"}}',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch',
|
||||
type: 'on',
|
||||
)
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
match_not(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"state":"chat_disabled"}',
|
||||
)
|
||||
match_not(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '{"event":"chat_status_customer","data":{"state":"offline"}}',
|
||||
)
|
||||
match(
|
||||
browser: customer,
|
||||
css: '.settings',
|
||||
value: '"data":{"state":"online"}',
|
||||
)
|
||||
|
||||
# init chat
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.js-chatMenuItem .counter',
|
||||
value: '1',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: agent,
|
||||
css: '.js-chatMenuItem .counter',
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def test_basic_usecase1
|
||||
chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
match(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-body',
|
||||
value: chat_url,
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
set(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-input',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
)
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'closed the conversation',
|
||||
)
|
||||
end
|
||||
|
||||
def test_basic_usecase2
|
||||
chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
|
||||
# keep focus outside of chat window to check .chat-status.is-modified later
|
||||
click(
|
||||
browser: agent,
|
||||
css: '#global-search',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
set(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-input',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-disconnect:not(.is-hidden)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-close',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'offline',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(Chat closed by|Chat beendet von)',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
sleep 2
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status.is-modified',
|
||||
)
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status',
|
||||
)
|
||||
end
|
||||
|
||||
def test_basic_usecase3
|
||||
chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
# set chat preferences
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-settings',
|
||||
)
|
||||
|
||||
modal_ready(browser: agent)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.modal [name="chat::phrase::1"]',
|
||||
value: 'Hi Stranger!;My Greeting',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.modal .js-submit',
|
||||
)
|
||||
modal_disappear(browser: agent)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .js-badgeWaitingCustomers',
|
||||
value: '1',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'Hi Stranger|My Greeting',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
match(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-body',
|
||||
value: chat_url,
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
set(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-input',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
)
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'Hi Stranger|My Greeting',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is customer',
|
||||
)
|
||||
location(
|
||||
browser: customer,
|
||||
url: "#{chat_url}#new_hash",
|
||||
)
|
||||
sleep 2
|
||||
match(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-body',
|
||||
value: "#{chat_url}#new_hash",
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.active .chat-window',
|
||||
value: 'closed the conversation',
|
||||
)
|
||||
end
|
||||
|
||||
def test_open_chat_by_button
|
||||
chat_url = "#{browser_url}/assets/chat/znuny_open_by_button.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
exists_not(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.open-zammad-chat',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
timeout: 4,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
timeout: 4,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-header-icon-close',
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
timeout: 4,
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-open',
|
||||
timeout: 4,
|
||||
)
|
||||
end
|
||||
|
||||
def test_timeouts
|
||||
chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}"
|
||||
agent = browser_instance
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#customer_chat"]',
|
||||
)
|
||||
agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click)
|
||||
agent.find_elements(css: '.active .chat-window .js-close').each(&:click)
|
||||
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch input[checked]'
|
||||
)
|
||||
|
||||
# no customer action, hide widget
|
||||
customer = browser_instance
|
||||
location(
|
||||
browser: customer,
|
||||
url: chat_url,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 5,
|
||||
)
|
||||
watch_for_disappear(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
timeout: 95,
|
||||
)
|
||||
|
||||
# no agent action, show sorry screen
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
timeout: 35,
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(takes longer|dauert länger)',
|
||||
timeout: 120,
|
||||
)
|
||||
|
||||
# check if agent is offline, idle timeout, chat not answered
|
||||
exists_not(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch input[checked]'
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '#navigation .js-chatMenuItem .js-switch',
|
||||
type: 'on',
|
||||
)
|
||||
|
||||
# no customer action, show sorry screen
|
||||
reload(
|
||||
browser: customer,
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
)
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
watch_for(
|
||||
browser: agent,
|
||||
css: '.js-chatMenuItem .counter',
|
||||
value: '1',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'agent is asking',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'agent is asking',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(Since you didn\'t respond|Da Sie in den letzten)',
|
||||
timeout: 150,
|
||||
)
|
||||
|
||||
agent.find_elements({ css: '.active .chat-window .js-close' }).each(&:click)
|
||||
sleep 2
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-restart',
|
||||
)
|
||||
sleep 5
|
||||
click(
|
||||
browser: customer,
|
||||
css: '.js-chat-open',
|
||||
)
|
||||
exists(
|
||||
browser: customer,
|
||||
css: '.zammad-chat-is-shown',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: '(waiting|warte)',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .js-acceptChat',
|
||||
)
|
||||
sleep 2
|
||||
exists(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .chat-status',
|
||||
)
|
||||
set(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-customerChatInput',
|
||||
value: 'my name is me',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.active .chat-window .js-send',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat .zammad-chat-agent-status',
|
||||
value: 'online',
|
||||
)
|
||||
watch_for(
|
||||
browser: customer,
|
||||
css: '.zammad-chat',
|
||||
value: 'my name is me',
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def disable_chat
|
||||
login(
|
||||
browser: agent,
|
||||
username: 'admin@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
browser: agent,
|
||||
)
|
||||
|
||||
# disable chat
|
||||
click(
|
||||
browser: agent,
|
||||
css: 'a[href="#manage"]',
|
||||
)
|
||||
click(
|
||||
browser: agent,
|
||||
css: '.content.active a[href="#channels/chat"]',
|
||||
)
|
||||
switch(
|
||||
browser: agent,
|
||||
css: '.content.active .js-chatSetting',
|
||||
type: 'off',
|
||||
)
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue