Added headless support for ff and chrome.

This commit is contained in:
Martin Edenhofer 2018-08-06 12:21:44 +02:00
parent e9c26a5f7c
commit be11e9a1d5
4 changed files with 114 additions and 23 deletions

View file

@ -145,7 +145,7 @@ GEM
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0) faraday-http-cache (2.0.0)
faraday (~> 0.8) faraday (~> 0.8)
ffi (1.9.23) ffi (1.9.25)
ffi-compiler (0.1.3) ffi-compiler (0.1.3)
ffi (>= 1.0.0) ffi (>= 1.0.0)
rake rake
@ -400,7 +400,7 @@ GEM
sawyer (0.8.1) sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6) addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0) faraday (~> 0.8, < 1.0)
selenium-webdriver (3.11.0) selenium-webdriver (3.13.1)
childprocess (~> 0.5) childprocess (~> 0.5)
rubyzip (~> 1.2) rubyzip (~> 1.2)
shellany (0.0.1) shellany (0.0.1)

View file

@ -5,7 +5,11 @@ class AAbUnitTest < TestCase
def test_core def test_core
@browser = browser_instance @browser = browser_instance
location(url: browser_url + '/tests_core') location(url: browser_url + '/tests_core')
sleep 10 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
@ -15,35 +19,55 @@ class AAbUnitTest < TestCase
def test_ui def test_ui
@browser = browser_instance @browser = browser_instance
location(url: browser_url + '/tests_ui') location(url: browser_url + '/tests_ui')
sleep 8 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_model') location(url: browser_url + '/tests_model')
sleep 8 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_model_binding') location(url: browser_url + '/tests_model_binding')
sleep 8 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_model_ui') location(url: browser_url + '/tests_model_ui')
sleep 8 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_ticket_selector') location(url: browser_url + '/tests_ticket_selector')
sleep 8 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
@ -53,63 +77,99 @@ class AAbUnitTest < TestCase
def test_form def test_form
@browser = browser_instance @browser = browser_instance
location(url: browser_url + '/tests_form') location(url: browser_url + '/tests_form')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_trim') location(url: browser_url + '/tests_form_trim')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_find') location(url: browser_url + '/tests_form_find')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_timer') location(url: browser_url + '/tests_form_timer')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_extended') location(url: browser_url + '/tests_form_extended')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_searchable_select') location(url: browser_url + '/tests_form_searchable_select')
sleep 2 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_tree_select') location(url: browser_url + '/tests_form_tree_select')
sleep 2 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_column_select') location(url: browser_url + '/tests_form_column_select')
sleep 2 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_form_validation') location(url: browser_url + '/tests_form_validation')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
@ -119,28 +179,44 @@ class AAbUnitTest < TestCase
def test_table def test_table
@browser = browser_instance @browser = browser_instance
location(url: browser_url + '/tests_table') location(url: browser_url + '/tests_table')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_table_extended') location(url: browser_url + '/tests_table_extended')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_html_utils') location(url: browser_url + '/tests_html_utils')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',
) )
location(url: browser_url + '/tests_taskbar') location(url: browser_url + '/tests_taskbar')
sleep 4 watch_for(
css: '.result',
value: 'Tests completed',
timeout: 8,
)
match( match(
css: '.result .failed', css: '.result .failed',
value: '0', value: '0',

View file

@ -227,6 +227,9 @@ class AgentTicketActionLevel0Test < TestCase
}, },
) )
# wait to push new group dependencies to browser (to show group selection)
sleep 12
# create new ticket # create new ticket
ticket1 = ticket_create( ticket1 = ticket_create(
data: { data: {

View file

@ -51,7 +51,19 @@ class TestCase < Test::Unit::TestCase
def browser_instance def browser_instance
@browsers ||= {} @browsers ||= {}
if ENV['REMOTE_URL'].blank? if ENV['REMOTE_URL'].blank?
local_browser = Selenium::WebDriver.for(browser.to_sym, profile: profile) params = {
profile: profile,
}
if ENV['BROWSER_HEADLESS'].present?
if browser == 'firefox'
params[:options] = Selenium::WebDriver::Firefox::Options.new
params[:options].add_argument('-headless')
elsif browser == 'chrome'
params[:options] = Selenium::WebDriver::Chrome::Options.new
params[:options].add_argument('-headless')
end
end
local_browser = Selenium::WebDriver.for(browser.to_sym, params)
@browsers[local_browser.hash] = local_browser @browsers[local_browser.hash] = local_browser
browser_instance_preferences(local_browser) browser_instance_preferences(local_browser)
return local_browser return local_browser
@ -2020,7 +2032,7 @@ wait untill text in selector disabppears
assert_equal(3, count, 'check if owner selection is - selection + master + agent per default') assert_equal(3, count, 'check if owner selection is - selection + master + agent per default')
else else
# check count of agents, should be only 1 / - selection on init screen # check count of agents, should be only 1 selection, the "-" selection on init screen
if !params[:disable_group_check] if !params[:disable_group_check]
count = instance.find_elements(css: '.content.active .newTicket select[name="owner_id"] option').count count = instance.find_elements(css: '.content.active .newTicket select[name="owner_id"] option').count
if count != 1 if count != 1