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
|
||||
|
||||
result = User.search(
|
||||
:query => 'some search term'
|
||||
:limit => 15,
|
||||
:current_user => user_model,
|
||||
query: 'some search term'
|
||||
limit: 15,
|
||||
current_user: user_model,
|
||||
)
|
||||
|
||||
returns
|
||||
|
@ -71,11 +71,11 @@ returns
|
|||
query.delete! '*'
|
||||
if params[:role_ids]
|
||||
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)
|
||||
else
|
||||
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)
|
||||
end
|
||||
users
|
||||
|
|
|
@ -273,7 +273,7 @@ class PreferencesTest < TestCase
|
|||
click( css: 'a[href="#current_user"]' )
|
||||
click( css: 'a[href="#profile"]' )
|
||||
click( css: 'a[href="#profile/language"]' )
|
||||
sleep 10
|
||||
sleep 4
|
||||
select(
|
||||
css: '.language_item select[name="locale"]',
|
||||
value: 'Deutsch',
|
||||
|
@ -284,11 +284,11 @@ class PreferencesTest < TestCase
|
|||
css: 'body',
|
||||
value: 'Sprache',
|
||||
)
|
||||
sleep 16
|
||||
sleep 6
|
||||
|
||||
# check if language is still used after reload
|
||||
reload()
|
||||
sleep 4
|
||||
sleep 2
|
||||
|
||||
watch_for(
|
||||
css: 'body',
|
||||
|
|
|
@ -1888,31 +1888,31 @@ wait untill text in selector disabppears
|
|||
instance = params[:browser] || @browser
|
||||
data = params[:data]
|
||||
|
||||
instance.find_elements( { css: 'a[href="#manage"]' } )[0].click
|
||||
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
|
||||
sleep 1
|
||||
instance.find_elements( { css: 'a[href="#channels/email"]' } )[0].click
|
||||
instance.find_elements({ css: 'a[href="#channels/email"]' })[0].click
|
||||
sleep 1
|
||||
instance.find_elements( { css: 'a[href="#c-signature"]' } )[0].click
|
||||
instance.find_elements({ css: 'a[href="#c-signature"]' })[0].click
|
||||
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
|
||||
element = instance.find_elements( { css: '.modal input[name=name]' } )[0]
|
||||
element = instance.find_elements({ css: '.modal input[name=name]' })[0]
|
||||
element.clear
|
||||
element.send_keys( data[:name] )
|
||||
element = instance.find_elements( { css: '.modal textarea[name=body]' } )[0]
|
||||
element.send_keys(data[:name])
|
||||
element = instance.find_elements({ css: '.modal textarea[name=body]' })[0]
|
||||
element.clear
|
||||
element.send_keys( data[:body] )
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
element.send_keys(data[:body])
|
||||
instance.find_elements({ css: '.modal button.js-submit' })[0].click
|
||||
(1..12).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
element = instance.find_elements({ css: 'body' })[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
assert( true, 'signature created' )
|
||||
assert(true, 'signature created')
|
||||
return true
|
||||
end
|
||||
sleep 1
|
||||
}
|
||||
screenshot( browser: instance, comment: 'signature_create_failed' )
|
||||
screenshot(browser: instance, comment: 'signature_create_failed')
|
||||
fail 'signature creation failed'
|
||||
end
|
||||
|
||||
|
@ -1938,54 +1938,55 @@ wait untill text in selector disabppears
|
|||
instance = params[:browser] || @browser
|
||||
data = params[:data]
|
||||
|
||||
instance.find_elements( { css: 'a[href="#manage"]' } )[0].click
|
||||
sleep 1
|
||||
instance.find_elements( { css: 'a[href="#manage/groups"]' } )[0].click
|
||||
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
|
||||
sleep 0.5
|
||||
instance.find_elements({ css: 'a[href="#manage/groups"]' })[0].click
|
||||
sleep 2
|
||||
instance.find_elements( { css: 'a[data-type="new"]' } )[0].click
|
||||
instance.find_elements({ css: 'a[data-type="new"]' })[0].click
|
||||
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.send_keys( data[:name] )
|
||||
element = instance.find_elements( { css: '.modal select[name="email_address_id"]' } )[0]
|
||||
element.send_keys(data[:name])
|
||||
element = instance.find_elements({ css: '.modal select[name="email_address_id"]' })[0]
|
||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||
dropdown.select_by( :index, 1 )
|
||||
#dropdown.select_by( :text, action[:group])
|
||||
dropdown.select_by(:index, 1)
|
||||
#dropdown.select_by(:text, action[:group])
|
||||
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.select_by( :text, data[:signature])
|
||||
dropdown.select_by(:text, data[:signature])
|
||||
end
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
instance.find_elements({ css: '.modal button.js-submit' })[0].click
|
||||
(1..12).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
element = instance.find_elements({ css: 'body' })[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
assert( true, 'group created' )
|
||||
assert(true, 'group created')
|
||||
|
||||
# add member
|
||||
if data[:member]
|
||||
data[:member].each {|login|
|
||||
instance.find_elements( { css: 'a[href="#manage"]' } )[0].click
|
||||
instance.find_elements( { css: 'a[href="#manage/users"]' } )[0].click
|
||||
sleep 2
|
||||
element = instance.find_elements( { css: '#content [name="search"]' } )[0]
|
||||
instance.find_elements({ css: 'a[href="#manage"]' })[0].click
|
||||
sleep 0.5
|
||||
instance.find_elements({ css: 'a[href="#manage/users"]' })[0].click
|
||||
sleep 3
|
||||
element = instance.find_elements({ css: '#content [name="search"]' })[0]
|
||||
element.clear
|
||||
element.send_keys( login )
|
||||
sleep 2
|
||||
#instance.find_elements( { :css => '#content table [data-id]' } )[0].click
|
||||
instance.execute_script( '$("#content table [data-id] td").first().click()' )
|
||||
sleep 2
|
||||
#instance.find_elements( { :css => 'label:contains(" ' + action[:name] + '")' } )[0].click
|
||||
instance.execute_script( '$(\'label:contains(" ' + data[:name] + '")\').first().click()' )
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
element.send_keys(login)
|
||||
sleep 3
|
||||
#instance.find_elements({ :css => '#content table [data-id]' })[0].click
|
||||
instance.execute_script('$("#content table [data-id] td").first().click()')
|
||||
sleep 3
|
||||
#instance.find_elements({ :css => 'label:contains(" ' + action[:name] + '")' })[0].click
|
||||
instance.execute_script('$(\'label:contains(" ' + data[:name] + '")\').first().click()')
|
||||
instance.find_elements({ css: '.modal button.js-submit' })[0].click
|
||||
}
|
||||
end
|
||||
end
|
||||
sleep 1
|
||||
return true
|
||||
}
|
||||
screenshot( browser: instance, comment: 'group_create_failed' )
|
||||
screenshot(browser: instance, comment: 'group_create_failed')
|
||||
fail 'group creation failed'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue