Improved timings in tests.

This commit is contained in:
Martin Edenhofer 2015-11-30 13:13:27 +01:00
parent 7710c1232e
commit dd704194bc
3 changed files with 48 additions and 47 deletions

View file

@ -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

View file

@ -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',

View file

@ -1939,7 +1939,7 @@ wait untill text in selector disabppears
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
@ -1967,15 +1967,16 @@ wait untill text in selector disabppears
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
sleep 0.5
instance.find_elements({ css: 'a[href="#manage/users"]' })[0].click instance.find_elements({ css: 'a[href="#manage/users"]' })[0].click
sleep 2 sleep 3
element = instance.find_elements({ css: '#content [name="search"]' })[0] 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