From a28dc17b324c51d30f2bb331734b13b5732b5a35 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 7 Dec 2015 16:22:37 +0100 Subject: [PATCH] Improved tests. --- public/assets/chat/index.html | 12 ++++++++ test/browser/chat_test.rb | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/public/assets/chat/index.html b/public/assets/chat/index.html index e72254bce..46c20be03 100644 --- a/public/assets/chat/index.html +++ b/public/assets/chat/index.html @@ -22,6 +22,7 @@ padding: 10px; border-radius: 5px; box-shadow: 0 3px 10px rgba(0,0,0,.3); + width: 500px; } .settings input { @@ -36,6 +37,12 @@ padding-right: 0; } + table td.log { + text-align: left; + padding-right: 0; + word-break: break-all; + } + td { padding: 5px; } @@ -96,6 +103,11 @@ + +

Log

+ + + diff --git a/test/browser/chat_test.rb b/test/browser/chat_test.rb index afc67a620..0f56c0405 100644 --- a/test/browser/chat_test.rb +++ b/test/browser/chat_test.rb @@ -507,6 +507,8 @@ class ChatTest < TestCase browser: customer, url: "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}", ) + + # no customer action, hide widget watch_for( browser: customer, css: '.zammad-chat', @@ -517,6 +519,8 @@ class ChatTest < TestCase css: '.zammad-chat', timeout: 75, ) + + # no agent action, show sorry screen reload( browser: customer, ) @@ -541,6 +545,59 @@ class ChatTest < TestCase timeout: 90, ) + # no customer action, show sorry screen + reload( + browser: customer, + ) + exists( + browser: customer, + css: '.zammad-chat', + ) + click( + browser: customer, + css: '.js-chat-open', + ) + + agent = browser_instance + login( + browser: agent, + username: 'master@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-close' } ).each(&:click) + click( + browser: agent, + css: '.active .js-acceptChat', + ) + 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, + ) + end end