Fixed firefox js issues.
This commit is contained in:
parent
893272e886
commit
586728fcef
2 changed files with 217 additions and 173 deletions
|
@ -37,7 +37,7 @@ class AgentTicketActionLevel0Test < TestCase
|
||||||
|
|
||||||
set(
|
set(
|
||||||
css: '.active div[data-name=body]',
|
css: '.active div[data-name=body]',
|
||||||
value: 'test ::' + random
|
value: 'test ::' + random,
|
||||||
)
|
)
|
||||||
watch_for(
|
watch_for(
|
||||||
css: '.active .shortcut',
|
css: '.active .shortcut',
|
||||||
|
@ -118,10 +118,6 @@ class AgentTicketActionLevel0Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# check if text module exists in instance2, for ready to use
|
# check if text module exists in instance2, for ready to use
|
||||||
click(
|
|
||||||
browser: browser2,
|
|
||||||
css: '#global-search',
|
|
||||||
)
|
|
||||||
set(
|
set(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
css: '.active div[data-name=body]',
|
css: '.active div[data-name=body]',
|
||||||
|
@ -135,7 +131,6 @@ class AgentTicketActionLevel0Test < TestCase
|
||||||
sendkey(
|
sendkey(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
value: :arrow_down,
|
value: :arrow_down,
|
||||||
slow: true,
|
|
||||||
)
|
)
|
||||||
click(
|
click(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
|
@ -147,22 +142,11 @@ class AgentTicketActionLevel0Test < TestCase
|
||||||
css: '.active div[data-name=body]',
|
css: '.active div[data-name=body]',
|
||||||
value: 'some content ' + random,
|
value: 'some content ' + random,
|
||||||
)
|
)
|
||||||
sleep 2
|
|
||||||
|
|
||||||
set(
|
ticket_customer_select(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
css: '.active .newTicket input[name="customer_id_completion"]',
|
css: '.active .newTicket',
|
||||||
value: 'nicole',
|
customer: 'nicole',
|
||||||
)
|
|
||||||
sleep 4
|
|
||||||
sendkey(
|
|
||||||
browser: browser2,
|
|
||||||
value: :arrow_down,
|
|
||||||
)
|
|
||||||
|
|
||||||
click(
|
|
||||||
browser: browser2,
|
|
||||||
css: '.active .newTicket .recipientList-entry.js-user.is-active',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(
|
set(
|
||||||
|
@ -207,19 +191,16 @@ class AgentTicketActionLevel0Test < TestCase
|
||||||
css: '.active div[data-name=body]',
|
css: '.active div[data-name=body]',
|
||||||
value: 'test',
|
value: 'test',
|
||||||
)
|
)
|
||||||
|
|
||||||
set(
|
set(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
css: '.active div[data-name=body]',
|
css: '.active div[data-name=body]',
|
||||||
value: '::' + random,
|
value: '::' + random,
|
||||||
)
|
)
|
||||||
|
|
||||||
sendkey(
|
sendkey(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
value: :arrow_down,
|
value: :arrow_down,
|
||||||
slow: true,
|
|
||||||
)
|
)
|
||||||
|
sleep 1
|
||||||
click(
|
click(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
css: '.active .shortcut > ul> li > a',
|
css: '.active .shortcut > ul> li > a',
|
||||||
|
@ -246,20 +227,12 @@ class AgentTicketActionLevel0Test < TestCase
|
||||||
)
|
)
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
set(
|
ticket_customer_select(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
css: '.modal [name="customer_id_completion"]',
|
css: '.modal',
|
||||||
value: firstname,
|
customer: firstname,
|
||||||
)
|
|
||||||
sleep 4
|
|
||||||
sendkey(
|
|
||||||
browser: browser2,
|
|
||||||
value: :arrow_down,
|
|
||||||
)
|
|
||||||
click(
|
|
||||||
browser: browser2,
|
|
||||||
css: '.modal .recipientList-entry.js-user.is-active',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
click(
|
click(
|
||||||
browser: browser2,
|
browser: browser2,
|
||||||
css: '.modal-content .js-submit',
|
css: '.modal-content .js-submit',
|
||||||
|
|
|
@ -111,6 +111,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def login(params)
|
def login(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('login', params)
|
log('login', params)
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
|
||||||
|
@ -158,6 +159,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def logout(params = {})
|
def logout(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('logout', params)
|
log('logout', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -188,6 +190,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def location(params)
|
def location(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('location', params)
|
log('location', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -205,6 +208,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def location_check(params)
|
def location_check(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('location_check', params)
|
log('location_check', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -224,6 +228,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def reload(params = {})
|
def reload(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('reload', params)
|
log('reload', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -249,6 +254,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def click(params)
|
def click(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('click', params)
|
log('click', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -281,6 +287,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def scroll_to(params)
|
def scroll_to(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('scroll_to', params)
|
log('scroll_to', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -308,6 +315,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def execute(params)
|
def execute(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('js', params)
|
log('js', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -321,13 +329,14 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
exists(
|
exists(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '.some_class',
|
css: '.some_class',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def exists(params)
|
def exists(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('exists', params)
|
log('exists', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -341,13 +350,14 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
exists_not(
|
exists_not(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '.some_class',
|
css: '.some_class',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def exists_not(params)
|
def exists_not(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('exists_not', params)
|
log('exists_not', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -373,6 +383,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def set(params)
|
def set(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('set', params)
|
log('set', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -380,12 +391,6 @@ class TestCase < Test::Unit::TestCase
|
||||||
element = instance.find_elements( { css: params[:css] } )[0]
|
element = instance.find_elements( { css: params[:css] } )[0]
|
||||||
#element.click
|
#element.click
|
||||||
|
|
||||||
# trigger also focus on input/select and textarea fields
|
|
||||||
#if params[:css] =~ /(input|select|textarea)/
|
|
||||||
# instance.execute_script( "$('#{params[:css]}').trigger('focus')" )
|
|
||||||
# sleep 0.2
|
|
||||||
#end
|
|
||||||
|
|
||||||
element.clear
|
element.clear
|
||||||
|
|
||||||
if !params[:slow]
|
if !params[:slow]
|
||||||
|
@ -402,15 +407,6 @@ class TestCase < Test::Unit::TestCase
|
||||||
instance.execute_script( "$('#{params[:css]}').blur()" )
|
instance.execute_script( "$('#{params[:css]}').blur()" )
|
||||||
end
|
end
|
||||||
|
|
||||||
# it's not working stable via selenium, use js
|
|
||||||
if params[:contenteditable]
|
|
||||||
value = instance.find_elements( { css: params[:css] } )[0].text
|
|
||||||
if value != params[:value]
|
|
||||||
body_quoted = quote( params[:value] )
|
|
||||||
instance.execute_script( "$('#{params[:css]}').focus().html('#{body_quoted}').trigger('focusout')" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -425,6 +421,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def select(params)
|
def select(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('select', params)
|
log('select', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -453,6 +450,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def check(params)
|
def check(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('check', params)
|
log('check', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -472,6 +470,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def uncheck(params)
|
def uncheck(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('uncheck', params)
|
log('uncheck', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -492,6 +491,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def sendkey(params)
|
def sendkey(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('sendkey', params)
|
log('sendkey', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -512,17 +512,18 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
match(
|
match(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '#content .text-1',
|
css: '#content .text-1',
|
||||||
:value => 'some test for browser and some other for browser',
|
value: 'some test for browser and some other for browser',
|
||||||
:attribute => 'some_attribute', # match on attribute
|
attribute: 'some_attribute', # match on attribute
|
||||||
:should_not_match => true,
|
should_not_match: true,
|
||||||
:no_quote => false, # use regex
|
no_quote: false, # use regex
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def match(params, fallback = false)
|
def match(params, fallback = false)
|
||||||
|
switch_window_focus(params)
|
||||||
log('match', params)
|
log('match', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -603,17 +604,18 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
match_not(
|
match_not(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '#content .text-1',
|
css: '#content .text-1',
|
||||||
:value => 'some test for browser and some other for browser',
|
value: 'some test for browser and some other for browser',
|
||||||
:attribute => 'some_attribute', # match on attribute
|
attribute: 'some_attribute', # match on attribute
|
||||||
:should_not_match => true,
|
should_not_match: true,
|
||||||
:no_quote => false, # use regex
|
no_quote: false, # use regex
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def match_not(params)
|
def match_not(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('match_not', params)
|
log('match_not', params)
|
||||||
|
|
||||||
params[:should_not_match] = true
|
params[:should_not_match] = true
|
||||||
|
@ -623,13 +625,14 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
task_type(
|
task_type(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:type => 'stayOnTab',
|
type: 'stayOnTab',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def task_type(params)
|
def task_type(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('task_type', params)
|
log('task_type', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -645,21 +648,22 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
cookie(
|
cookie(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:name => '^_zammad.+?',
|
name: '^_zammad.+?',
|
||||||
:value => '.+?',
|
value: '.+?',
|
||||||
:expires => nil,
|
expires: nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
cookie(
|
cookie(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:name => '^_zammad.+?',
|
name: '^_zammad.+?',
|
||||||
:should_not_exist => true,
|
should_not_exist: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def cookie(params)
|
def cookie(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('cookie', params)
|
log('cookie', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -700,13 +704,14 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
verify_title(
|
verify_title(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:value => 'some title',
|
value: 'some title',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def verify_title(params = {})
|
def verify_title(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('verify_title', params)
|
log('verify_title', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -722,16 +727,17 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
verify_task(
|
verify_task(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:data => {
|
data: {
|
||||||
:title => 'some title',
|
title: 'some title',
|
||||||
:modified => true, # optional
|
modified: true, # optional
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def verify_task(params = {}, fallback = false)
|
def verify_task(params = {}, fallback = false)
|
||||||
|
switch_window_focus(params)
|
||||||
log('verify_task', params)
|
log('verify_task', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -795,15 +801,16 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
open_task(
|
open_task(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:data => {
|
data: {
|
||||||
:title => 'some title',
|
title: 'some title',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def open_task(params = {}, _fallback = false)
|
def open_task(params = {}, _fallback = false)
|
||||||
|
switch_window_focus(params)
|
||||||
log('open_task', params)
|
log('open_task', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -821,14 +828,15 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
file_upload(
|
file_upload(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '#content .text-1',
|
css: '#content .text-1',
|
||||||
:value => 'some text',
|
value: 'some text',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def file_upload(params = {})
|
def file_upload(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('file_upload', params)
|
log('file_upload', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -847,12 +855,15 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
click_catcher_remove(
|
click_catcher_remove(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def click_catcher_remove(params = {})
|
def click_catcher_remove(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
|
log('click_catcher_remove', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
return if !instance.find_elements( { css: '.clickCatcher' } )[0]
|
return if !instance.find_elements( { css: '.clickCatcher' } )[0]
|
||||||
click( browser: instance, css: '.clickCatcher')
|
click( browser: instance, css: '.clickCatcher')
|
||||||
|
@ -861,16 +872,17 @@ class TestCase < Test::Unit::TestCase
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
watch_for(
|
watch_for(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '#content .text-1',
|
css: '#content .text-1',
|
||||||
:value => 'some text',
|
value: 'some text',
|
||||||
:attribute => 'some_attribute' # optional
|
attribute: 'some_attribute' # optional
|
||||||
:timeout => '16', # in sec, default 16
|
timeout: '16', # in sec, default 16
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def watch_for(params = {})
|
def watch_for(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('watch_for', params)
|
log('watch_for', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -914,23 +926,24 @@ class TestCase < Test::Unit::TestCase
|
||||||
wait untill selector disabppears
|
wait untill selector disabppears
|
||||||
|
|
||||||
watch_for_disappear(
|
watch_for_disappear(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '#content .text-1',
|
css: '#content .text-1',
|
||||||
:timeout => '16', # in sec, default 16
|
timeout: '16', # in sec, default 16
|
||||||
)
|
)
|
||||||
|
|
||||||
wait untill text in selector disabppears
|
wait untill text in selector disabppears
|
||||||
|
|
||||||
watch_for_disappear(
|
watch_for_disappear(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:css => '#content .text-1',
|
css: '#content .text-1',
|
||||||
:value => 'some value as regexp',
|
value: 'some value as regexp',
|
||||||
:timeout => '16', # in sec, default 16
|
timeout: '16', # in sec, default 16
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def watch_for_disappear(params = {})
|
def watch_for_disappear(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('watch_for_disappear', params)
|
log('watch_for_disappear', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -976,6 +989,7 @@ wait untill text in selector disabppears
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def tasks_close_all(params = {})
|
def tasks_close_all(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('tasks_close_all', params)
|
log('tasks_close_all', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1007,17 +1021,51 @@ wait untill text in selector disabppears
|
||||||
assert( true, 'all tasks closed' )
|
assert( true, 'all tasks closed' )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
ticket_customer_select(
|
||||||
|
browser: browser1,
|
||||||
|
css: '#content .text-1',
|
||||||
|
customer: '',
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def ticket_customer_select(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
|
log('ticket_customer_select', params)
|
||||||
|
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
|
||||||
|
element = instance.find_elements( { css: params[:css] + ' input[name="customer_id_completion"]' } )[0]
|
||||||
|
element.click
|
||||||
|
element.clear
|
||||||
|
|
||||||
|
# workaround, sometimes focus is not triggered
|
||||||
|
element.send_keys( params[:customer] + '*' )
|
||||||
|
sleep 3.5
|
||||||
|
|
||||||
|
# check if pulldown is open, it's not working stable via selenium
|
||||||
|
#instance.execute_script( "$('#{params[:css]} .js-recipientDropdown').addClass('open')" )
|
||||||
|
#sleep 0.5
|
||||||
|
element.send_keys( :arrow_down )
|
||||||
|
#sleep 0.3
|
||||||
|
#instance.find_elements( { css: params[:css] + ' .recipientList-entry.js-user.is-active' } )[0].click
|
||||||
|
sleep 0.6
|
||||||
|
assert( true, 'ticket_customer_select' )
|
||||||
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
username = overview_create(
|
username = overview_create(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:data => {
|
data: {
|
||||||
:name => name,
|
name: name,
|
||||||
:role => 'Agent',
|
role: 'Agent',
|
||||||
:selector => {
|
selector: {
|
||||||
'Priority': '1 low',
|
'Priority': '1 low',
|
||||||
},
|
},
|
||||||
:prio => 1000,
|
prio: 1000,
|
||||||
'order::direction' => 'down',
|
'order::direction' => 'down',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -1025,6 +1073,7 @@ wait untill text in selector disabppears
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def overview_create(params)
|
def overview_create(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('overview_create', params)
|
log('overview_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1090,26 +1139,27 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
ticket = ticket_create(
|
ticket = ticket_create(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:data => {
|
data: {
|
||||||
:customer => 'nico',
|
customer: 'nico',
|
||||||
:group => 'Users',
|
group: 'Users',
|
||||||
:priority => '2 normal',
|
priority: '2 normal',
|
||||||
:title => 'overview #1',
|
title: 'overview #1',
|
||||||
:body => 'overview #1',
|
body: 'overview #1',
|
||||||
},
|
},
|
||||||
:do_not_submit => true,
|
do_not_submit: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
returns (in case of submitted)
|
returns (in case of submitted)
|
||||||
{
|
{
|
||||||
:id => 123,
|
id: 123,
|
||||||
:number => '100001',
|
number: '100001',
|
||||||
}
|
}
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def ticket_create(params)
|
def ticket_create(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('ticket_create', params)
|
log('ticket_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1171,11 +1221,11 @@ wait untill text in selector disabppears
|
||||||
sleep 3.5
|
sleep 3.5
|
||||||
|
|
||||||
# check if pulldown is open, it's not working stable via selenium
|
# check if pulldown is open, it's not working stable via selenium
|
||||||
instance.execute_script( "$('.active .newTicket .js-recipientDropdown').addClass('open')" )
|
#instance.execute_script( "$('.active .newTicket .js-recipientDropdown').addClass('open')" )
|
||||||
sleep 0.5
|
#sleep 0.5
|
||||||
element.send_keys( :arrow_down )
|
element.send_keys( :arrow_down )
|
||||||
sleep 0.3
|
#sleep 0.3
|
||||||
instance.find_elements( { css: '.active .newTicket .recipientList-entry.js-user.is-active' } )[0].click
|
#instance.find_elements( { css: '.active .newTicket .recipientList-entry.js-user.is-active' } )[0].click
|
||||||
sleep 0.6
|
sleep 0.6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1224,21 +1274,22 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
ticket_update(
|
ticket_update(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:data => {
|
data: {
|
||||||
:title => '',
|
title: '',
|
||||||
:customer => 'some_customer@example.com',
|
customer: 'some_customer@example.com',
|
||||||
:body => 'some body',
|
body: 'some body',
|
||||||
:group => 'some group',
|
group: 'some group',
|
||||||
:priority => '1 low',
|
priority: '1 low',
|
||||||
:state => 'closed',
|
state: 'closed',
|
||||||
},
|
},
|
||||||
:do_not_submit => true,
|
do_not_submit: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def ticket_update(params)
|
def ticket_update(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('ticket_update', params)
|
log('ticket_update', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1292,12 +1343,12 @@ wait untill text in selector disabppears
|
||||||
sleep 3.5
|
sleep 3.5
|
||||||
|
|
||||||
# check if pulldown is open, it's not working stable via selenium
|
# check if pulldown is open, it's not working stable via selenium
|
||||||
instance.execute_script( "$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')" )
|
#instance.execute_script( "$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')" )
|
||||||
sleep 0.5
|
#sleep 0.5
|
||||||
element.send_keys( :arrow_down )
|
element.send_keys( :arrow_down )
|
||||||
sleep 0.3
|
sleep 0.6
|
||||||
instance.find_elements( { css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active' } )[0].click
|
#instance.find_elements( { css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active' } )[0].click
|
||||||
sleep 0.3
|
#sleep 0.3
|
||||||
|
|
||||||
click( browser: instance, css: '.modal .js-submit' )
|
click( browser: instance, css: '.modal .js-submit' )
|
||||||
|
|
||||||
|
@ -1411,18 +1462,19 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
ticket_verify(
|
ticket_verify(
|
||||||
:browser => browser1,
|
browser: browser1,
|
||||||
:data => {
|
data: {
|
||||||
:title => 'some title',
|
title: 'some title',
|
||||||
:body => 'some body',
|
body: 'some body',
|
||||||
## :group => 'some group',
|
## group: 'some group',
|
||||||
## :state => 'closed',
|
## state: 'closed',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def ticket_verify(params)
|
def ticket_verify(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('ticket_verify', params)
|
log('ticket_verify', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1451,14 +1503,15 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
ticket_open_by_overview(
|
ticket_open_by_overview(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:number => ticket1[:number],
|
number: ticket1[:number],
|
||||||
:link => "#ticket/view/#{name}",
|
link: "#ticket/view/#{name}",
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def ticket_open_by_overview(params)
|
def ticket_open_by_overview(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('ticket_open_by_overview', params)
|
log('ticket_open_by_overview', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1490,13 +1543,14 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
ticket_open_by_search(
|
ticket_open_by_search(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:number => ticket1[:number],
|
number: ticket1[:number],
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def ticket_open_by_search(params)
|
def ticket_open_by_search(params)
|
||||||
|
switch_window_focus(params)
|
||||||
log('ticket_open_by_search', params)
|
log('ticket_open_by_search', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1538,7 +1592,7 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
overview_count = overview_counter(
|
overview_count = overview_counter(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
)
|
)
|
||||||
|
|
||||||
returns
|
returns
|
||||||
|
@ -1549,6 +1603,7 @@ wait untill text in selector disabppears
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def overview_counter(params = {})
|
def overview_counter(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('overview_counter', params)
|
log('overview_counter', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1584,13 +1639,14 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
organization_open_by_search(
|
organization_open_by_search(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:value => 'some value',
|
value: 'some value',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def organization_open_by_search(params = {})
|
def organization_open_by_search(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('organization_open_by_search', params)
|
log('organization_open_by_search', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1627,13 +1683,14 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
user_open_by_search(
|
user_open_by_search(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:value => 'some value',
|
value: 'some value',
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def user_open_by_search(params = {})
|
def user_open_by_search(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('user_open_by_search', params)
|
log('user_open_by_search', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1658,8 +1715,8 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
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,
|
||||||
|
@ -1671,6 +1728,7 @@ wait untill text in selector disabppears
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def user_create(params = {})
|
def user_create(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('user_create', params)
|
log('user_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1717,16 +1775,17 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
sla_create(
|
sla_create(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:data => {
|
data: {
|
||||||
:name => 'some sla' + random,
|
name: 'some sla' + random,
|
||||||
:first_response_time_in_text => 61
|
first_response_time_in_text: 61
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def sla_create(params = {})
|
def sla_create(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('sla_create', params)
|
log('sla_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1761,17 +1820,18 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
text_module_create(
|
text_module_create(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:data => {
|
data: {
|
||||||
:name => 'some sla' + random,
|
name: 'some sla' + random,
|
||||||
:keywords => 'some keywords',
|
keywords: 'some keywords',
|
||||||
:content => 'some content',
|
content: 'some content',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def text_module_create(params = {})
|
def text_module_create(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('text_module_create', params)
|
log('text_module_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1809,16 +1869,17 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
signature_create(
|
signature_create(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:data => {
|
data: {
|
||||||
:name => 'some sla' + random,
|
name: 'some sla' + random,
|
||||||
:body => 'some body',
|
body: 'some body',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def signature_create(params = {})
|
def signature_create(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('signature_create', params)
|
log('signature_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1855,11 +1916,11 @@ wait untill text in selector disabppears
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
group_create(
|
group_create(
|
||||||
:browser => browser2,
|
browser: browser2,
|
||||||
:data => {
|
data: {
|
||||||
:name => 'some sla' + random,
|
name: 'some sla' + random,
|
||||||
:signature => 'some signature bame',
|
signature: 'some signature bame',
|
||||||
:member => [
|
member: [
|
||||||
'some_user_login',
|
'some_user_login',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -1868,6 +1929,7 @@ wait untill text in selector disabppears
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def group_create(params = {})
|
def group_create(params = {})
|
||||||
|
switch_window_focus(params)
|
||||||
log('group_create', params)
|
log('group_create', params)
|
||||||
|
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
|
@ -1932,6 +1994,15 @@ wait untill text in selector disabppears
|
||||||
string_quoted
|
string_quoted
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def switch_window_focus(params)
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
if instance != @last_used_browser
|
||||||
|
log('switch browser window focus', {})
|
||||||
|
instance.switch_to.window(instance.window_handles.first)
|
||||||
|
end
|
||||||
|
@last_used_browser = instance
|
||||||
|
end
|
||||||
|
|
||||||
def log(method, params)
|
def log(method, params)
|
||||||
return if !@@debug
|
return if !@@debug
|
||||||
return if params[:mute_log]
|
return if params[:mute_log]
|
||||||
|
|
Loading…
Reference in a new issue