Improved tests.

This commit is contained in:
Martin Edenhofer 2015-12-07 16:22:37 +01:00
parent c58546285a
commit a28dc17b32
2 changed files with 69 additions and 0 deletions

View file

@ -22,6 +22,7 @@
padding: 10px; padding: 10px;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 3px 10px rgba(0,0,0,.3); box-shadow: 0 3px 10px rgba(0,0,0,.3);
width: 500px;
} }
.settings input { .settings input {
@ -36,6 +37,12 @@
padding-right: 0; padding-right: 0;
} }
table td.log {
text-align: left;
padding-right: 0;
word-break: break-all;
}
td { td {
padding: 5px; padding: 5px;
} }
@ -96,6 +103,11 @@
<tr> <tr>
<td> <td>
<td><button class="open-zammad-chat">Open Chat</button> <td><button class="open-zammad-chat">Open Chat</button>
<tr>
<td class="log"><h2>Log</h2>
<td>
<tr>
<td colspan="2" class="log js-chatLogDisplay">
</table> </table>
</div> </div>

View file

@ -507,6 +507,8 @@ class ChatTest < TestCase
browser: customer, browser: customer,
url: "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}", url: "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}",
) )
# no customer action, hide widget
watch_for( watch_for(
browser: customer, browser: customer,
css: '.zammad-chat', css: '.zammad-chat',
@ -517,6 +519,8 @@ class ChatTest < TestCase
css: '.zammad-chat', css: '.zammad-chat',
timeout: 75, timeout: 75,
) )
# no agent action, show sorry screen
reload( reload(
browser: customer, browser: customer,
) )
@ -541,6 +545,59 @@ class ChatTest < TestCase
timeout: 90, 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
end end