Test stabilization: Disconnect connected chats only

There is a race condition between clients exiting the chat session and disconnecting via a click. In cases where the client disconnects first the disconnect button is already hidden (not clickable) and Selenium will fail.
This commit is contained in:
Thorsten Eckel 2018-06-22 14:32:51 +02:00
parent bfd560ab49
commit e57707336c

View file

@ -186,8 +186,8 @@ class ChatTest < TestCase
browser: agent,
css: 'a[href="#customer_chat"]',
)
agent.find_elements( { css: '.active .chat-window .js-disconnect' } ).each(&:click)
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
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(
@ -299,8 +299,8 @@ class ChatTest < TestCase
browser: agent,
css: 'a[href="#customer_chat"]',
)
agent.find_elements( { css: '.active .chat-window .js-disconnect' } ).each(&:click)
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
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(
@ -383,7 +383,7 @@ class ChatTest < TestCase
)
click(
browser: agent,
css: '.active .chat-window .js-disconnect',
css: '.active .chat-window .js-disconnect:not(.is-hidden)',
)
click(
browser: agent,
@ -407,8 +407,8 @@ class ChatTest < TestCase
browser: customer,
css: '.zammad-chat-is-open',
)
agent.find_elements( { css: '.active .chat-window .js-disconnect' } ).each(&:click)
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
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,
@ -454,8 +454,8 @@ class ChatTest < TestCase
browser: agent,
css: 'a[href="#customer_chat"]',
)
agent.find_elements( { css: '.active .chat-window .js-disconnect' } ).each(&:click)
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
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(
@ -606,8 +606,8 @@ class ChatTest < TestCase
browser: agent,
css: 'a[href="#customer_chat"]',
)
agent.find_elements( { css: '.active .chat-window .js-disconnect' } ).each(&:click)
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
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,