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