Code layout improvements.

This commit is contained in:
Martin Edenhofer 2016-03-23 08:24:25 +01:00
parent 4d837d7bd4
commit 984bb9c4f5
5 changed files with 46 additions and 38 deletions

View file

@ -13,12 +13,12 @@ class AaaGettingStartedTest < TestCase
mailbox_password = ENV['MAILBOX_INIT'].split(':')[1] mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
@browser = browser_instance @browser = browser_instance
location( url: browser_url ) location(url: browser_url)
watch_for( watch_for(
css: '.setup.wizard', css: '.setup.wizard',
value: 'setup new system', value: 'setup new system',
) )
click( css: '.js-start .btn--primary' ) click(css: '.js-start .btn--primary')
watch_for( watch_for(
css: '.setup.wizard', css: '.setup.wizard',
value: 'admin', value: 'admin',
@ -47,7 +47,7 @@ class AaaGettingStartedTest < TestCase
css: '.js-admin input[name="password_confirm"]', css: '.js-admin input[name="password_confirm"]',
value: 'test1234äöüß', value: 'test1234äöüß',
) )
click( css: '.js-admin .btn--success' ) click(css: '.js-admin .btn--success')
# getting started - base # getting started - base
watch_for( watch_for(
@ -197,7 +197,7 @@ class AaaGettingStartedTest < TestCase
accounts.each {|account| accounts.each {|account|
# getting started - auto mail # getting started - auto mail
location( url: browser_url + '/#getting_started/channel' ) location(url: browser_url + '/#getting_started/channel')
click( click(
css: '.js-channel .email .provider_name', css: '.js-channel .email .provider_name',
) )
@ -269,7 +269,7 @@ class AaaGettingStartedTest < TestCase
accounts.each {|account| accounts.each {|account|
# getting started - manual mail # getting started - manual mail
location( url: browser_url + '/#getting_started/channel' ) location(url: browser_url + '/#getting_started/channel')
click( click(
css: '.js-channel .email .provider_name', css: '.js-channel .email .provider_name',

View file

@ -37,20 +37,14 @@ class AgentTicketActionLevel0Test < TestCase
tasks_close_all() tasks_close_all()
# invite agent (with one group) # invite agent (with one group)
click( click(css: '#navigation a[href="#dashboard"]')
css: '#navigation a[href="#dashboard"]', click(css: '.active.content .tab[data-area="first-steps-widgets"]')
)
click(
css: '.active.content .tab[data-area="first-steps-widgets"]',
)
watch_for( watch_for(
css: '.active.content', css: '.active.content',
value: 'Configuration', value: 'Configuration',
) )
click( click(css: '.active.content .js-inviteAgent')
css: '.active.content .js-inviteAgent', modal_ready()
)
sleep 4
set( set(
css: '.modal [name="firstname"]', css: '.modal [name="firstname"]',
value: 'Bob', value: 'Bob',
@ -94,12 +88,9 @@ class AgentTicketActionLevel0Test < TestCase
# customer ticket create # customer ticket create
click(css: 'a[href="#new"]') click(css: 'a[href="#new"]')
click(css: 'a[href="#customer_ticket_new"]') click(css: 'a[href="#customer_ticket_new"]', wait: 2)
sleep 2
exists_not( exists_not(css: '.newTicket select[name="group_id"]')
css: '.newTicket select[name="group_id"]',
)
set( set(
css: '.newTicket input[name="title"]', css: '.newTicket input[name="title"]',
@ -109,8 +100,7 @@ class AgentTicketActionLevel0Test < TestCase
css: '.newTicket [data-name="body"]', css: '.newTicket [data-name="body"]',
value: 'one group body', value: 'one group body',
) )
click(css: '.newTicket button.js-submit') click(css: '.newTicket button.js-submit', wait: 5)
sleep 5
# check if ticket is shown # check if ticket is shown
location_check(url: '#ticket/zoom/') location_check(url: '#ticket/zoom/')

View file

@ -25,7 +25,7 @@ class AdminChannelEmailTest < TestCase
click(css: '#content .js-channelNew') click(css: '#content .js-channelNew')
sleep 2 modal_ready()
set( set(
css: '.modal input[name="realname"]', css: '.modal input[name="realname"]',
@ -65,7 +65,7 @@ class AdminChannelEmailTest < TestCase
# re-create # re-create
click(css: '#content .js-channelNew') click(css: '#content .js-channelNew')
sleep 2 modal_ready()
set( set(
css: '.modal input[name="realname"]', css: '.modal input[name="realname"]',
@ -99,7 +99,8 @@ class AdminChannelEmailTest < TestCase
# set invalid folder # set invalid folder
click(css: '#content .js-editInbound') click(css: '#content .js-editInbound')
sleep 2
modal_ready()
set( set(
css: '.modal input[name="options::folder"]', css: '.modal input[name="options::folder"]',

View file

@ -12,8 +12,8 @@ class TaskbarTaskTest < TestCase
tasks_close_all() tasks_close_all()
# persistant task # persistant task
click( css: 'a[href="#new"]' ) click(css: 'a[href="#new"]')
click( css: 'a[href="#ticket/create"]' ) click(css: 'a[href="#ticket/create"]', wait: 0.8)
set( set(
css: '.active .newTicket input[name="title"]', css: '.active .newTicket input[name="title"]',
value: 'some test AAA', value: 'some test AAA',
@ -31,7 +31,7 @@ class TaskbarTaskTest < TestCase
sleep 3 sleep 3
# check if task still exists # check if task still exists
click( css: '.task' ) click(css: '.task', wait: 0.8)
match( match(
css: '.active .newTicket input[name="title"]', css: '.active .newTicket input[name="title"]',
@ -40,7 +40,7 @@ class TaskbarTaskTest < TestCase
tasks_close_all() tasks_close_all()
exists_not( css: '.active .newTicket input[name="title"]' ) exists_not(css: '.active .newTicket input[name="title"]')
end end
def test_persistant_task_with_relogin def test_persistant_task_with_relogin
@ -52,8 +52,8 @@ class TaskbarTaskTest < TestCase
) )
tasks_close_all() tasks_close_all()
click( css: 'a[href="#new"]' ) click(css: 'a[href="#new"]')
click( css: 'a[href="#ticket/create"]' ) click(css: 'a[href="#ticket/create"]')
set( set(
css: '.active .newTicket input[name="title"]', css: '.active .newTicket input[name="title"]',
value: 'INBOUND TEST#1', value: 'INBOUND TEST#1',
@ -63,8 +63,8 @@ class TaskbarTaskTest < TestCase
value: 'INBOUND BODY TEST#1', value: 'INBOUND BODY TEST#1',
) )
click( css: 'a[href="#new"]' ) click(css: 'a[href="#new"]')
click( css: 'a[href="#ticket/create"]' ) click(css: 'a[href="#ticket/create"]', wait: 0.8)
set( set(
css: '.active .newTicket input[name="title"]', css: '.active .newTicket input[name="title"]',
value: 'OUTBOUND TEST#1', value: 'OUTBOUND TEST#1',

View file

@ -264,7 +264,7 @@ class TestCase < Test::Unit::TestCase
return if !clues return if !clues
instance.execute_script("$('.js-modal--clue .js-close').click()") instance.execute_script("$('.js-modal--clue .js-close').click()")
assert(true, 'clues closed') assert(true, 'clues closed')
sleep 4 sleep 2
end end
=begin =begin
@ -416,6 +416,23 @@ class TestCase < Test::Unit::TestCase
sleep 0.3 sleep 0.3
end end
=begin
modal_ready(
browser: browser1,
)
=end
def modal_ready(params)
switch_window_focus(params)
log('modal_ready', params)
instance = params[:browser] || @browser
sleep 2
end
=begin =begin
execute( execute(
@ -544,7 +561,7 @@ class TestCase < Test::Unit::TestCase
element = instance.find_elements(css: "#{params[:css]}.js-shadow + .js-input")[0] element = instance.find_elements(css: "#{params[:css]}.js-shadow + .js-input")[0]
element.click element.click
element.clear element.clear
sleep 0.5 sleep 0.4
element.send_keys(params[:value]) element.send_keys(params[:value])
sleep 0.2 sleep 0.2
element.send_keys(:enter) element.send_keys(:enter)
@ -562,7 +579,7 @@ class TestCase < Test::Unit::TestCase
dropdown.select_by(:text, params[:value]) dropdown.select_by(:text, params[:value])
#puts "select - #{params.inspect}" #puts "select - #{params.inspect}"
rescue rescue
sleep 0.5 sleep 0.4
# just try again # just try again
log('select', { rescure: true }) log('select', { rescure: true })
@ -574,7 +591,7 @@ class TestCase < Test::Unit::TestCase
dropdown.select_by(:text, params[:value]) dropdown.select_by(:text, params[:value])
#puts "select2 - #{params.inspect}" #puts "select2 - #{params.inspect}"
end end
sleep 0.5 sleep 0.4
end end
=begin =begin
@ -1014,7 +1031,7 @@ class TestCase < Test::Unit::TestCase
# accept task close warning # accept task close warning
if params[:discard_changes] if params[:discard_changes]
sleep 1 modal_ready()
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
end end