Maintenance: Stabilize Selenium tests by improving the wait_for_empty_ajax_queue logic.
This commit is contained in:
parent
8e537754bf
commit
25c971ed00
3 changed files with 4 additions and 2 deletions
|
@ -90,7 +90,7 @@ module BrowserTestHelper
|
|||
end
|
||||
|
||||
wait(5, interval: 0.1).until_constant do
|
||||
page.evaluate_script('App.Ajax.queue().length').zero? && page.evaluate_script('Object.keys(App.FormHandlerCoreWorkflow.getRequests()).length').zero?
|
||||
page.evaluate_script('App.Ajax.queue().length === 0 && $.active === 0 && Object.keys(App.FormHandlerCoreWorkflow.getRequests()).length === 0').present?
|
||||
end
|
||||
rescue
|
||||
nil
|
||||
|
|
|
@ -62,6 +62,7 @@ class AgentTicketActionLevel0Test < TestCase
|
|||
click(
|
||||
css: '.modal button.btn.btn--primary',
|
||||
fast: true,
|
||||
ajax: false,
|
||||
)
|
||||
watch_for(
|
||||
css: 'body div.modal',
|
||||
|
@ -98,6 +99,7 @@ class AgentTicketActionLevel0Test < TestCase
|
|||
click(
|
||||
css: '.modal button.btn.btn--primary',
|
||||
fast: true,
|
||||
ajax: false,
|
||||
)
|
||||
watch_for(
|
||||
css: 'body div.modal',
|
||||
|
|
|
@ -4881,7 +4881,7 @@ wait untill text in selector disabppears
|
|||
sleep 0.5
|
||||
|
||||
break if instance.execute_script('return typeof(App) === "undefined"')
|
||||
break if instance.execute_script('return App.Ajax.queue().length').zero? && instance.execute_script('return Object.keys(App.FormHandlerCoreWorkflow.getRequests()).length').zero?
|
||||
break if instance.execute_script('return App.Ajax.queue().length === 0 && $.active === 0 && Object.keys(App.FormHandlerCoreWorkflow.getRequests()).length === 0').present?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue