Improved timings in tests.
This commit is contained in:
parent
7710c1232e
commit
dd704194bc
3 changed files with 48 additions and 47 deletions
|
@ -35,9 +35,9 @@ returns if user has no permissions to search
|
||||||
search user
|
search user
|
||||||
|
|
||||||
result = User.search(
|
result = User.search(
|
||||||
:query => 'some search term'
|
query: 'some search term'
|
||||||
:limit => 15,
|
limit: 15,
|
||||||
:current_user => user_model,
|
current_user: user_model,
|
||||||
)
|
)
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
@ -71,11 +71,11 @@ returns
|
||||||
query.delete! '*'
|
query.delete! '*'
|
||||||
if params[:role_ids]
|
if params[:role_ids]
|
||||||
users = User.joins(:roles).where( 'roles.id' => params[:role_ids] ).where(
|
users = User.joins(:roles).where( 'roles.id' => params[:role_ids] ).where(
|
||||||
'(users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%",
|
'(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
).order('firstname').limit(limit)
|
).order('firstname').limit(limit)
|
||||||
else
|
else
|
||||||
users = User.where(
|
users = User.where(
|
||||||
'(firstname LIKE ? or lastname LIKE ? or email LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%",
|
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
).order('firstname').limit(limit)
|
).order('firstname').limit(limit)
|
||||||
end
|
end
|
||||||
users
|
users
|
||||||
|
|
|
@ -273,7 +273,7 @@ class PreferencesTest < TestCase
|
||||||
click( css: 'a[href="#current_user"]' )
|
click( css: 'a[href="#current_user"]' )
|
||||||
click( css: 'a[href="#profile"]' )
|
click( css: 'a[href="#profile"]' )
|
||||||
click( css: 'a[href="#profile/language"]' )
|
click( css: 'a[href="#profile/language"]' )
|
||||||
sleep 10
|
sleep 4
|
||||||
select(
|
select(
|
||||||
css: '.language_item select[name="locale"]',
|
css: '.language_item select[name="locale"]',
|
||||||
value: 'Deutsch',
|
value: 'Deutsch',
|
||||||
|
@ -284,11 +284,11 @@ class PreferencesTest < TestCase
|
||||||
css: 'body',
|
css: 'body',
|
||||||
value: 'Sprache',
|
value: 'Sprache',
|
||||||
)
|
)
|
||||||
sleep 16
|
sleep 6
|
||||||
|
|
||||||
# check if language is still used after reload
|
# check if language is still used after reload
|
||||||
reload()
|
reload()
|
||||||
sleep 4
|
sleep 2
|
||||||
|
|
||||||
watch_for(
|
watch_for(
|
||||||
css: 'body',
|
css: 'body',
|
||||||
|
|
|
@ -1888,31 +1888,31 @@ wait untill text in selector disabppears
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
data = params[:data]
|
data = params[:data]
|
||||||
|
|
||||||
instance.find_elements( { css: 'a[href="#manage"]' } )[0].click
|
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
|
||||||
sleep 1
|
sleep 1
|
||||||
instance.find_elements( { css: 'a[href="#channels/email"]' } )[0].click
|
instance.find_elements({ css: 'a[href="#channels/email"]' })[0].click
|
||||||
sleep 1
|
sleep 1
|
||||||
instance.find_elements( { css: 'a[href="#c-signature"]' } )[0].click
|
instance.find_elements({ css: 'a[href="#c-signature"]' })[0].click
|
||||||
sleep 8
|
sleep 8
|
||||||
instance.find_elements( { css: '#content #c-signature a[data-type="new"]' } )[0].click
|
instance.find_elements({ css: '#content #c-signature a[data-type="new"]' })[0].click
|
||||||
sleep 2
|
sleep 2
|
||||||
element = instance.find_elements( { css: '.modal input[name=name]' } )[0]
|
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( data[:name] )
|
element.send_keys(data[:name])
|
||||||
element = instance.find_elements( { css: '.modal textarea[name=body]' } )[0]
|
element = instance.find_elements({ css: '.modal textarea[name=body]' })[0]
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( data[:body] )
|
element.send_keys(data[:body])
|
||||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
instance.find_elements({ css: '.modal button.js-submit' })[0].click
|
||||||
(1..12).each {
|
(1..12).each {
|
||||||
element = instance.find_elements( { css: 'body' } )[0]
|
element = instance.find_elements({ css: 'body' })[0]
|
||||||
text = element.text
|
text = element.text
|
||||||
if text =~ /#{Regexp.quote(data[:name])}/
|
if text =~ /#{Regexp.quote(data[:name])}/
|
||||||
assert( true, 'signature created' )
|
assert(true, 'signature created')
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
}
|
}
|
||||||
screenshot( browser: instance, comment: 'signature_create_failed' )
|
screenshot(browser: instance, comment: 'signature_create_failed')
|
||||||
fail 'signature creation failed'
|
fail 'signature creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1938,54 +1938,55 @@ wait untill text in selector disabppears
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
data = params[:data]
|
data = params[:data]
|
||||||
|
|
||||||
instance.find_elements( { css: 'a[href="#manage"]' } )[0].click
|
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
|
||||||
sleep 1
|
sleep 0.5
|
||||||
instance.find_elements( { css: 'a[href="#manage/groups"]' } )[0].click
|
instance.find_elements({ css: 'a[href="#manage/groups"]' })[0].click
|
||||||
sleep 2
|
sleep 2
|
||||||
instance.find_elements( { css: 'a[data-type="new"]' } )[0].click
|
instance.find_elements({ css: 'a[data-type="new"]' })[0].click
|
||||||
sleep 2
|
sleep 2
|
||||||
element = instance.find_elements( { css: '.modal input[name=name]' } )[0]
|
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( data[:name] )
|
element.send_keys(data[:name])
|
||||||
element = instance.find_elements( { css: '.modal select[name="email_address_id"]' } )[0]
|
element = instance.find_elements({ css: '.modal select[name="email_address_id"]' })[0]
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||||
dropdown.select_by( :index, 1 )
|
dropdown.select_by(:index, 1)
|
||||||
#dropdown.select_by( :text, action[:group])
|
#dropdown.select_by(:text, action[:group])
|
||||||
if data[:signature]
|
if data[:signature]
|
||||||
element = instance.find_elements( { css: '.modal select[name="signature_id"]' } )[0]
|
element = instance.find_elements({ css: '.modal select[name="signature_id"]' })[0]
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||||
dropdown.select_by( :text, data[:signature])
|
dropdown.select_by(:text, data[:signature])
|
||||||
end
|
end
|
||||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
instance.find_elements({ css: '.modal button.js-submit' })[0].click
|
||||||
(1..12).each {
|
(1..12).each {
|
||||||
element = instance.find_elements( { css: 'body' } )[0]
|
element = instance.find_elements({ css: 'body' })[0]
|
||||||
text = element.text
|
text = element.text
|
||||||
if text =~ /#{Regexp.quote(data[:name])}/
|
if text =~ /#{Regexp.quote(data[:name])}/
|
||||||
assert( true, 'group created' )
|
assert(true, 'group created')
|
||||||
|
|
||||||
# add member
|
# add member
|
||||||
if data[:member]
|
if data[:member]
|
||||||
data[:member].each {|login|
|
data[:member].each {|login|
|
||||||
instance.find_elements( { css: 'a[href="#manage"]' } )[0].click
|
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
|
||||||
instance.find_elements( { css: 'a[href="#manage/users"]' } )[0].click
|
sleep 0.5
|
||||||
sleep 2
|
instance.find_elements({ css: 'a[href="#manage/users"]' })[0].click
|
||||||
element = instance.find_elements( { css: '#content [name="search"]' } )[0]
|
sleep 3
|
||||||
|
element = instance.find_elements({ css: '#content [name="search"]' })[0]
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys( login )
|
element.send_keys(login)
|
||||||
sleep 2
|
sleep 3
|
||||||
#instance.find_elements( { :css => '#content table [data-id]' } )[0].click
|
#instance.find_elements({ :css => '#content table [data-id]' })[0].click
|
||||||
instance.execute_script( '$("#content table [data-id] td").first().click()' )
|
instance.execute_script('$("#content table [data-id] td").first().click()')
|
||||||
sleep 2
|
sleep 3
|
||||||
#instance.find_elements( { :css => 'label:contains(" ' + action[:name] + '")' } )[0].click
|
#instance.find_elements({ :css => 'label:contains(" ' + action[:name] + '")' })[0].click
|
||||||
instance.execute_script( '$(\'label:contains(" ' + data[:name] + '")\').first().click()' )
|
instance.execute_script('$(\'label:contains(" ' + data[:name] + '")\').first().click()')
|
||||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
instance.find_elements({ css: '.modal button.js-submit' })[0].click
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
screenshot( browser: instance, comment: 'group_create_failed' )
|
screenshot(browser: instance, comment: 'group_create_failed')
|
||||||
fail 'group creation failed'
|
fail 'group creation failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue