Improved tests.

This commit is contained in:
Martin Edenhofer 2015-03-08 22:34:14 +01:00
parent 6db57a6509
commit 258130d824
2 changed files with 93 additions and 26 deletions

View file

@ -79,9 +79,14 @@ class PreferencesTest < TestCase
) )
# check language in ticket create # check language in ticket create
open_task(
:data => {
:title => 'Anruf',
}
)
verify_task( verify_task(
:data => { :data => {
:title => 'anruf', :title => 'Anruf',
} }
) )
open_task( open_task(
@ -106,8 +111,10 @@ class PreferencesTest < TestCase
) )
# check language in ticket zoom # check language in ticket zoom
ticket_open_by_search( open_task(
:number => ticket[:number], :data => {
:title => 'preferences lang check #2',
}
) )
watch_for( watch_for(
:css => '.content.active', :css => '.content.active',
@ -186,9 +193,14 @@ class PreferencesTest < TestCase
) )
# check language in ticket create # check language in ticket create
open_task(
:data => {
:title => 'Call',
}
)
verify_task( verify_task(
:data => { :data => {
:title => 'call', :title => 'Call',
} }
) )
open_task( open_task(
@ -213,8 +225,10 @@ class PreferencesTest < TestCase
) )
# check language in ticket zoom # check language in ticket zoom
ticket_open_by_search( open_task(
:number => ticket[:number], :data => {
:title => 'preferences lang check #2',
}
) )
watch_for( watch_for(
:css => '.content.active', :css => '.content.active',
@ -269,11 +283,11 @@ class PreferencesTest < TestCase
:css => 'body', :css => 'body',
:value => 'Sprache', :value => 'Sprache',
) )
sleep 6 sleep 10
# check if language is still used after reload # check if language is still used after reload
reload() reload()
sleep 2 sleep 10
watch_for( watch_for(
:css => 'body', :css => 'body',

View file

@ -1053,10 +1053,11 @@ wait untill text in selector disabppears
ticket_update( ticket_update(
:browser => browser1, :browser => browser1,
:data => { :data => {
:title => '', :title => '',
:body => 'some body', :customer => 'some_customer@example.com',
:group => 'some group', :body => 'some body',
:state => 'closed', :group => 'some group',
:state => 'closed',
}, },
:do_not_submit => true, :do_not_submit => true,
) )
@ -1095,6 +1096,56 @@ wait untill text in selector disabppears
# :css => '.content.active .page-header .ticket-title-update', # :css => '.content.active .page-header .ticket-title-update',
# :value => :tab, # :value => :tab,
# }, # },
end
if data[:customer]
# select tab
click( :browser => instance, :css => '.active .tabsSidebar-tab[data-tab="customer"]')
click( :browser => instance, :css => '.active div[data-tab="customer"] .js-actions .select-arrow' )
click( :browser => instance, :css => '.active div[data-tab="customer"] .js-actions a[data-type="customer-change"]' )
watch_for(
:browser => instance,
:css => '.modal',
:value => 'change',
)
element = instance.find_elements( { :css => '.modal input[name="customer_id_completion"]' } )[0]
element.click
element.clear
# workaround, sometimes focus is not triggered
element.send_keys( data[:customer] )
sleep 4
# check if pulldown is open, it's not working stable via selenium
res = instance.execute_script( "$('.modal .user_autocompletion .js-recipientDropdown').hasClass('open')" )
#puts "res #{res.inspect}"
if !res
#puts "IS NOT OPEN!, open it"
instance.execute_script( "$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')" )
end
element.send_keys( :arrow_down )
sleep 0.3
instance.find_elements( { :css => '.modal .user_autocompletion .recipientList-entry.js-user.is-active' } )[0].click
sleep 0.3
click( :browser => instance, :css => '.modal .js-submit' )
watch_for_disappear(
:browser => instance,
:css => '.modal',
)
watch_for(
:browser => instance,
:css => '.active .tabsSidebar',
:value => data[:customer],
)
# select tab
click( :browser => instance, :css => '.active .tabsSidebar-tab[data-tab="ticket"]')
end end
if data[:body] if data[:body]
#instance.execute_script( '$(".content.active div[data-name=body]").focus()' ) #instance.execute_script( '$(".content.active div[data-name=body]").focus()' )
@ -1127,22 +1178,24 @@ wait untill text in selector disabppears
sleep 0.2 sleep 0.2
end end
found = nil if data[:state] || data[:group] || data[:body]
(1..5).each {|loop| found = nil
if !found (1..5).each {|loop|
begin if !found
text = instance.find_elements( { :css => '.content.active .js-reset' } )[0].text begin
if text =~ /(Discard your unsaved changes.|Verwerfen der)/ text = instance.find_elements( { :css => '.content.active .js-reset' } )[0].text
found = true if text =~ /(Discard your unsaved changes.|Verwerfen der)/
found = true
end
rescue
# just try again
end end
rescue sleep 1
# just try again
end end
sleep 1 }
if !found
raise "no discard message found"
end end
}
if !found
raise "no discard message found"
end end
if params[:do_not_submit] if params[:do_not_submit]
@ -1393,7 +1446,7 @@ wait untill text in selector disabppears
user_create( user_create(
:browser => browser2, :browser => browser2,
:data => { :data => {
:login => 'some login' + random, #:login => 'some login' + random,
:firstname => 'Manage Firstname' + random, :firstname => 'Manage Firstname' + random,
:lastname => 'Manage Lastname' + random, :lastname => 'Manage Lastname' + random,
:email => user_email, :email => user_email,