Corrected with rubocop cop 'Style/HashSyntax'.
This commit is contained in:
parent
7863118515
commit
e98d98e5ff
1 changed files with 32 additions and 32 deletions
|
@ -69,7 +69,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
def teardown
|
def teardown
|
||||||
return if !@browsers
|
return if !@browsers
|
||||||
@browsers.each { |hash, local_browser|
|
@browsers.each { |hash, local_browser|
|
||||||
screenshot( :browser => local_browser, :comment => 'teardown' )
|
screenshot( browser: local_browser, comment: 'teardown' )
|
||||||
browser_instance_close(local_browser)
|
browser_instance_close(local_browser)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -78,7 +78,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
comment = params[:comment] || ''
|
comment = params[:comment] || ''
|
||||||
filename = "tmp/#{Time.zone.now.strftime("screenshot_%Y_%m_%d__%H_%M_%S")}_#{comment}_#{instance.hash}.png"
|
filename = "tmp/#{Time.zone.now.strftime("screenshot_%Y_%m_%d__%H_%M_%S")}_#{comment}_#{instance.hash}.png"
|
||||||
log('screenshot', {:filename => filename})
|
log('screenshot', {filename: filename})
|
||||||
instance.save_screenshot(filename)
|
instance.save_screenshot(filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
element = instance.find_elements( { css: '#login input[name="username"]' } )[0]
|
element = instance.find_elements( { css: '#login input[name="username"]' } )[0]
|
||||||
if !element
|
if !element
|
||||||
screenshot( :browser => instance, :comment => 'login_failed' )
|
screenshot( browser: instance, comment: 'login_failed' )
|
||||||
raise 'No login box found'
|
raise 'No login box found'
|
||||||
end
|
end
|
||||||
|
|
||||||
screenshot( :browser => instance, :comment => 'login' )
|
screenshot( browser: instance, comment: 'login' )
|
||||||
|
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( params[:username] )
|
element.send_keys( params[:username] )
|
||||||
|
@ -125,10 +125,10 @@ class TestCase < Test::Unit::TestCase
|
||||||
sleep 4
|
sleep 4
|
||||||
login = instance.find_elements( { css: '.user-menu .user a' } )[0].attribute('title')
|
login = instance.find_elements( { css: '.user-menu .user a' } )[0].attribute('title')
|
||||||
if login != params[:username]
|
if login != params[:username]
|
||||||
screenshot( :browser => instance, :comment => 'login_failed' )
|
screenshot( browser: instance, comment: 'login_failed' )
|
||||||
raise 'login failed'
|
raise 'login failed'
|
||||||
end
|
end
|
||||||
screenshot( :browser => instance, :comment => 'login_ok' )
|
screenshot( browser: instance, comment: 'login_ok' )
|
||||||
assert( true, 'login ok' )
|
assert( true, 'login ok' )
|
||||||
login
|
login
|
||||||
end
|
end
|
||||||
|
@ -153,12 +153,12 @@ class TestCase < Test::Unit::TestCase
|
||||||
sleep 1
|
sleep 1
|
||||||
login = instance.find_elements( { css: '#login' } )[0]
|
login = instance.find_elements( { css: '#login' } )[0]
|
||||||
if login
|
if login
|
||||||
screenshot( :browser => instance, :comment => 'logout_ok' )
|
screenshot( browser: instance, comment: 'logout_ok' )
|
||||||
assert( true, 'logout ok' )
|
assert( true, 'logout ok' )
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'logout_failed' )
|
screenshot( browser: instance, comment: 'logout_failed' )
|
||||||
raise 'no login box found, seems logout was not successfully!'
|
raise 'no login box found, seems logout was not successfully!'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
instance.get( params[:url] )
|
instance.get( params[:url] )
|
||||||
screenshot( :browser => instance, :comment => 'location' )
|
screenshot( browser: instance, comment: 'location' )
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -193,7 +193,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
if instance.current_url !~ /#{Regexp.quote(params[:url])}/
|
if instance.current_url !~ /#{Regexp.quote(params[:url])}/
|
||||||
screenshot( :browser => instance, :comment => 'location_check_failed' )
|
screenshot( browser: instance, comment: 'location_check_failed' )
|
||||||
raise "url #{instance.current_url} is not matching #{params[:url]}"
|
raise "url #{instance.current_url} is not matching #{params[:url]}"
|
||||||
end
|
end
|
||||||
assert( true, "url #{instance.current_url} is matching #{params[:url]}" )
|
assert( true, "url #{instance.current_url} is matching #{params[:url]}" )
|
||||||
|
@ -211,9 +211,9 @@ class TestCase < Test::Unit::TestCase
|
||||||
log('reload', params)
|
log('reload', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
screenshot( :browser => instance, :comment => 'reload_before' )
|
screenshot( browser: instance, comment: 'reload_before' )
|
||||||
instance.navigate.refresh
|
instance.navigate.refresh
|
||||||
screenshot( :browser => instance, :comment => 'reload_after' )
|
screenshot( browser: instance, comment: 'reload_after' )
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -258,7 +258,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
if !instance.find_elements( { css: params[:css] } )[0]
|
if !instance.find_elements( { css: params[:css] } )[0]
|
||||||
screenshot( :browser => instance, :comment => 'exists_failed' )
|
screenshot( browser: instance, comment: 'exists_failed' )
|
||||||
raise "#{params[:css]} dosn't exist, but should"
|
raise "#{params[:css]} dosn't exist, but should"
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
|
@ -278,7 +278,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
if instance.find_elements( { css: params[:css] } )[0]
|
if instance.find_elements( { css: params[:css] } )[0]
|
||||||
screenshot( :browser => instance, :comment => 'exists_not_failed' )
|
screenshot( browser: instance, comment: 'exists_not_failed' )
|
||||||
raise "#{params[:css]} exists but should not"
|
raise "#{params[:css]} exists but should not"
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
|
@ -704,7 +704,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
element = instance.find_elements( { partial_link_text: data[:title] } )[0]
|
element = instance.find_elements( { partial_link_text: data[:title] } )[0]
|
||||||
if !element
|
if !element
|
||||||
screenshot( :browser => instance, :comment => 'open_task_failed' )
|
screenshot( browser: instance, comment: 'open_task_failed' )
|
||||||
raise "no task with title '#{data[:title]}' found"
|
raise "no task with title '#{data[:title]}' found"
|
||||||
end
|
end
|
||||||
element.click
|
element.click
|
||||||
|
@ -784,7 +784,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'watch_for_failed' )
|
screenshot( browser: instance, comment: 'watch_for_failed' )
|
||||||
raise "'#{params[:value]}' found in '#{text}'"
|
raise "'#{params[:value]}' found in '#{text}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'disappear_failed' )
|
screenshot( browser: instance, comment: 'disappear_failed' )
|
||||||
raise "#{params[:css]}) still exsists"
|
raise "#{params[:css]}) still exsists"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -954,7 +954,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'overview_create_failed' )
|
screenshot( browser: instance, comment: 'overview_create_failed' )
|
||||||
raise 'overview creation failed'
|
raise 'overview creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ wait untill text in selector disabppears
|
||||||
instance.find_elements( { css: 'a[href="#ticket/create"]' } )[0].click
|
instance.find_elements( { css: 'a[href="#ticket/create"]' } )[0].click
|
||||||
element = instance.find_elements( { css: '.active .newTicket' } )[0]
|
element = instance.find_elements( { css: '.active .newTicket' } )[0]
|
||||||
if !element
|
if !element
|
||||||
screenshot( :browser => instance, :comment => 'ticket_create_failed' )
|
screenshot( browser: instance, comment: 'ticket_create_failed' )
|
||||||
raise 'no ticket create screen found!'
|
raise 'no ticket create screen found!'
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -1079,13 +1079,13 @@ wait untill text in selector disabppears
|
||||||
number: number,
|
number: number,
|
||||||
}
|
}
|
||||||
sleep 3 # wait until notify is gone
|
sleep 3 # wait until notify is gone
|
||||||
screenshot( :browser => instance, :comment => 'ticket_create_ok' )
|
screenshot( browser: instance, comment: 'ticket_create_ok' )
|
||||||
return ticket
|
return ticket
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'ticket_create_failed' )
|
screenshot( browser: instance, comment: 'ticket_create_failed' )
|
||||||
raise "ticket creation failed, can't get zoom url (current url is '#{ instance.current_url }')"
|
raise "ticket creation failed, can't get zoom url (current url is '#{ instance.current_url }')"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1234,7 +1234,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
if !found
|
if !found
|
||||||
screenshot( :browser => instance, :comment => 'ticket_update_discard_message_failed' )
|
screenshot( browser: instance, comment: 'ticket_update_discard_message_failed' )
|
||||||
raise 'no discard message found'
|
raise 'no discard message found'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1250,7 +1250,7 @@ wait untill text in selector disabppears
|
||||||
begin
|
begin
|
||||||
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
||||||
if !text || text.empty?
|
if !text || text.empty?
|
||||||
screenshot( :browser => instance, :comment => 'ticket_update_ok' )
|
screenshot( browser: instance, comment: 'ticket_update_ok' )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
|
@ -1258,7 +1258,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'ticket_update_failed' )
|
screenshot( browser: instance, comment: 'ticket_update_failed' )
|
||||||
raise 'unable to update ticket'
|
raise 'unable to update ticket'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1325,7 +1325,7 @@ wait untill text in selector disabppears
|
||||||
sleep 1
|
sleep 1
|
||||||
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
||||||
if number !~ /#{params[:number]}/
|
if number !~ /#{params[:number]}/
|
||||||
screenshot( :browser => instance, :comment => 'ticket_open_by_overview_failed' )
|
screenshot( browser: instance, comment: 'ticket_open_by_overview_failed' )
|
||||||
raise "unable to search/find ticket #{params[:number]}!"
|
raise "unable to search/find ticket #{params[:number]}!"
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -1373,7 +1373,7 @@ wait untill text in selector disabppears
|
||||||
instance.find_element( { partial_link_text: params[:number] } ).click
|
instance.find_element( { partial_link_text: params[:number] } ).click
|
||||||
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text
|
||||||
if number !~ /#{params[:number]}/
|
if number !~ /#{params[:number]}/
|
||||||
screenshot( :browser => instance, :comment => 'ticket_open_by_search_failed' )
|
screenshot( browser: instance, comment: 'ticket_open_by_search_failed' )
|
||||||
raise "unable to search/find ticket #{params[:number]}!"
|
raise "unable to search/find ticket #{params[:number]}!"
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -1449,7 +1449,7 @@ wait untill text in selector disabppears
|
||||||
instance.find_element( { partial_link_text: params[:value] } ).click
|
instance.find_element( { partial_link_text: params[:value] } ).click
|
||||||
name = instance.find_elements( { css: '.active h1' } )[0].text
|
name = instance.find_elements( { css: '.active h1' } )[0].text
|
||||||
if name !~ /#{params[:value]}/
|
if name !~ /#{params[:value]}/
|
||||||
screenshot( :browser => instance, :comment => 'organization_open_by_search_failed' )
|
screenshot( browser: instance, comment: 'organization_open_by_search_failed' )
|
||||||
raise "unable to search/find org #{params[:value]}!"
|
raise "unable to search/find org #{params[:value]}!"
|
||||||
end
|
end
|
||||||
assert( true, "org #{params[:value]} found" )
|
assert( true, "org #{params[:value]} found" )
|
||||||
|
@ -1479,7 +1479,7 @@ wait untill text in selector disabppears
|
||||||
instance.find_element( { partial_link_text: params[:value] } ).click
|
instance.find_element( { partial_link_text: params[:value] } ).click
|
||||||
name = instance.find_elements( { css: '.active h1' } )[0].text
|
name = instance.find_elements( { css: '.active h1' } )[0].text
|
||||||
if name !~ /#{params[:value]}/
|
if name !~ /#{params[:value]}/
|
||||||
screenshot( :browser => instance, :comment => 'user_open_by_search_failed' )
|
screenshot( browser: instance, comment: 'user_open_by_search_failed' )
|
||||||
raise "unable to search/find user #{params[:value]}!"
|
raise "unable to search/find user #{params[:value]}!"
|
||||||
end
|
end
|
||||||
assert( true, "user #{params[:term]} found" )
|
assert( true, "user #{params[:term]} found" )
|
||||||
|
@ -1585,7 +1585,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'sla_create_failed' )
|
screenshot( browser: instance, comment: 'sla_create_failed' )
|
||||||
raise 'sla creation failed'
|
raise 'sla creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1632,7 +1632,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'text_module_create_failed' )
|
screenshot( browser: instance, comment: 'text_module_create_failed' )
|
||||||
raise 'text module creation failed'
|
raise 'text module creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1676,7 +1676,7 @@ wait untill text in selector disabppears
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'signature_create_failed' )
|
screenshot( browser: instance, comment: 'signature_create_failed' )
|
||||||
raise 'signature creation failed'
|
raise 'signature creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1747,7 +1747,7 @@ wait untill text in selector disabppears
|
||||||
sleep 1
|
sleep 1
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
screenshot( :browser => instance, :comment => 'group_create_failed' )
|
screenshot( browser: instance, comment: 'group_create_failed' )
|
||||||
raise 'group creation failed'
|
raise 'group creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue