Applied rubocop cop 'Style/Next' and 'Lint/UnneededDisable'.
This commit is contained in:
parent
08de22d863
commit
b92e5c7532
1 changed files with 30 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
||||||
ENV['RAILS_ENV'] = 'test'
|
ENV['RAILS_ENV'] = 'test'
|
||||||
# rubocop:disable Next, CyclomaticComplexity, PerceivedComplexity, HandleExceptions, ClassVars, NonLocalExitFromIterator
|
# rubocop:disable HandleExceptions, ClassVars, NonLocalExitFromIterator
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'selenium-webdriver'
|
require 'selenium-webdriver'
|
||||||
|
|
||||||
|
@ -152,11 +152,11 @@ class TestCase < Test::Unit::TestCase
|
||||||
(1..6).each {
|
(1..6).each {
|
||||||
sleep 1
|
sleep 1
|
||||||
login = instance.find_elements( { css: '#login' } )[0]
|
login = instance.find_elements( { css: '#login' } )[0]
|
||||||
if login
|
|
||||||
screenshot( browser: instance, comment: 'logout_ok' )
|
next if !login
|
||||||
assert( true, 'logout ok' )
|
screenshot( browser: instance, comment: 'logout_ok' )
|
||||||
return
|
assert( true, 'logout ok' )
|
||||||
end
|
return
|
||||||
}
|
}
|
||||||
screenshot( browser: instance, comment: 'logout_failed' )
|
screenshot( browser: instance, comment: 'logout_failed' )
|
||||||
fail 'no login box found, seems logout was not successfully!'
|
fail 'no login box found, seems logout was not successfully!'
|
||||||
|
@ -578,23 +578,22 @@ class TestCase < Test::Unit::TestCase
|
||||||
cookies.each {|cookie|
|
cookies.each {|cookie|
|
||||||
#puts "CCC #{cookie.inspect}"
|
#puts "CCC #{cookie.inspect}"
|
||||||
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
|
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
|
||||||
if cookie[:name] =~ /#{params[:name]}/i
|
next if cookie[:name] !~ /#{params[:name]}/i
|
||||||
if params.key?( :value ) && cookie[:value].to_s =~ /#{params[:value]}/i
|
|
||||||
assert( true, "matching value '#{params[:value]}' in cookie '#{cookie}'" )
|
|
||||||
else
|
|
||||||
fail "not matching value '#{params[:value]}' in cookie '#{cookie}'"
|
|
||||||
end
|
|
||||||
if params.key?( :expires ) && cookie[:expires].to_s =~ /#{params[:expires]}/i
|
|
||||||
assert( true, "matching expires '#{params[:expires].inspect}' in cookie '#{cookie}'" )
|
|
||||||
else
|
|
||||||
fail "not matching expires '#{params[:expires]}' in cookie '#{cookie}'"
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:should_not_exist]
|
if params.key?( :value ) && cookie[:value].to_s =~ /#{params[:value]}/i
|
||||||
fail "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'"
|
assert( true, "matching value '#{params[:value]}' in cookie '#{cookie}'" )
|
||||||
end
|
else
|
||||||
return
|
fail "not matching value '#{params[:value]}' in cookie '#{cookie}'"
|
||||||
end
|
end
|
||||||
|
if params.key?( :expires ) && cookie[:expires].to_s =~ /#{params[:expires]}/i
|
||||||
|
assert( true, "matching expires '#{params[:expires].inspect}' in cookie '#{cookie}'" )
|
||||||
|
else
|
||||||
|
fail "not matching expires '#{params[:expires]}' in cookie '#{cookie}'"
|
||||||
|
end
|
||||||
|
|
||||||
|
return if !params[:should_not_exist]
|
||||||
|
|
||||||
|
fail "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'"
|
||||||
}
|
}
|
||||||
if params[:should_not_exist]
|
if params[:should_not_exist]
|
||||||
assert( true, "cookie with name '#{params[:name]}' is not existing" )
|
assert( true, "cookie with name '#{params[:name]}' is not existing" )
|
||||||
|
@ -1226,17 +1225,18 @@ wait untill text in selector disabppears
|
||||||
if data[:state] || data[:group] || data[:body]
|
if data[:state] || data[:group] || data[:body]
|
||||||
found = nil
|
found = nil
|
||||||
(1..10).each {
|
(1..10).each {
|
||||||
if !found
|
|
||||||
begin
|
next if found
|
||||||
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
|
||||||
if text =~ /(Discard your unsaved changes.|Verwerfen der)/
|
begin
|
||||||
found = true
|
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
||||||
end
|
if text =~ /(Discard your unsaved changes.|Verwerfen der)/
|
||||||
rescue
|
found = true
|
||||||
# try again
|
|
||||||
end
|
end
|
||||||
sleep 1
|
rescue
|
||||||
|
# try again
|
||||||
end
|
end
|
||||||
|
sleep 1
|
||||||
}
|
}
|
||||||
if !found
|
if !found
|
||||||
screenshot( browser: instance, comment: 'ticket_update_discard_message_failed' )
|
screenshot( browser: instance, comment: 'ticket_update_discard_message_failed' )
|
||||||
|
|
Loading…
Reference in a new issue