Improved speed of tests.
This commit is contained in:
parent
6baf72a3c9
commit
809246aab5
2 changed files with 151 additions and 218 deletions
|
@ -4,185 +4,132 @@ require 'browser_test_helper'
|
|||
class AgentOrganizationProfileTest < TestCase
|
||||
def test_search_and_edit_verify_in_second
|
||||
message = 'comment 1 ' + rand(99999999999999999).to_s
|
||||
tests = [
|
||||
{
|
||||
:name => 'start',
|
||||
:instance1 => browser_instance,
|
||||
:instance2 => browser_instance,
|
||||
:instance1_username => 'master@example.com',
|
||||
:instance1_password => 'test',
|
||||
:instance2_username => 'agent1@example.com',
|
||||
:instance2_password => 'test',
|
||||
|
||||
browser1 = browser_instance
|
||||
login(
|
||||
:browser => browser1,
|
||||
:username => 'master@example.com',
|
||||
:password => 'test',
|
||||
:url => browser_url,
|
||||
:action => [
|
||||
{
|
||||
:where => :instance1,
|
||||
:execute => 'close_all_tasks',
|
||||
},
|
||||
{
|
||||
:where => :instance2,
|
||||
:execute => 'close_all_tasks',
|
||||
},
|
||||
{
|
||||
:where => :instance1,
|
||||
:execute => 'search_organization',
|
||||
:term => 'Zammad Foundation',
|
||||
},
|
||||
{
|
||||
:where => :instance2,
|
||||
:execute => 'search_organization',
|
||||
:term => 'Zammad Foundation',
|
||||
},
|
||||
)
|
||||
tasks_close_all(
|
||||
:browser => browser1,
|
||||
)
|
||||
|
||||
browser2 = browser_instance
|
||||
login(
|
||||
:browser => browser2,
|
||||
:username => 'agent1@example.com',
|
||||
:password => 'test',
|
||||
:url => browser_url,
|
||||
)
|
||||
tasks_close_all(
|
||||
:browser => browser2,
|
||||
)
|
||||
|
||||
organization_open_by_search(
|
||||
:browser => browser1,
|
||||
:value => 'Zammad Foundation',
|
||||
)
|
||||
organization_open_by_search(
|
||||
:browser => browser2,
|
||||
:value => 'Zammad Foundation',
|
||||
)
|
||||
|
||||
# update note
|
||||
{
|
||||
:where => :instance1,
|
||||
:execute => 'set',
|
||||
set(
|
||||
:browser => browser1,
|
||||
:css => '.active [data-name="note"]',
|
||||
:value => message,
|
||||
},
|
||||
{
|
||||
:where => :instance1,
|
||||
:execute => 'click',
|
||||
)
|
||||
click(
|
||||
:browser => browser1,
|
||||
:css => '.active .profile',
|
||||
},
|
||||
{
|
||||
:where => :instance1,
|
||||
:execute => 'wait',
|
||||
:value => 3,
|
||||
},
|
||||
)
|
||||
|
||||
# verify
|
||||
{
|
||||
:where => :instance2,
|
||||
:execute => 'match',
|
||||
watch_for(
|
||||
:browser => browser2,
|
||||
:css => '.active .profile-window',
|
||||
:value => message,
|
||||
:match_result => true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
browser_double_test(tests)
|
||||
)
|
||||
end
|
||||
|
||||
def test_search_and_edit_in_one
|
||||
message = '1 ' + rand(99999999).to_s
|
||||
tests = [
|
||||
{
|
||||
:name => 'search and edit',
|
||||
:action => [
|
||||
{
|
||||
:execute => 'close_all_tasks',
|
||||
},
|
||||
|
||||
@browser = browser_instance
|
||||
login(
|
||||
:username => 'master@example.com',
|
||||
:password => 'test',
|
||||
:url => browser_url,
|
||||
)
|
||||
tasks_close_all()
|
||||
sleep 1
|
||||
|
||||
# search and open org
|
||||
{
|
||||
:execute => 'search_organization',
|
||||
:term => 'Zammad Foundation',
|
||||
},
|
||||
{
|
||||
:execute => 'match',
|
||||
organization_open_by_search(
|
||||
:value => 'Zammad Foundation',
|
||||
)
|
||||
watch_for(
|
||||
:css => '.active .profile-window',
|
||||
:value => 'note',
|
||||
:match_result => true,
|
||||
},
|
||||
{
|
||||
:execute => 'match',
|
||||
)
|
||||
watch_for(
|
||||
:css => '.active .profile-window',
|
||||
:value => 'member',
|
||||
:match_result => true,
|
||||
|
||||
},
|
||||
)
|
||||
|
||||
# update note
|
||||
{
|
||||
:execute => 'set',
|
||||
set(
|
||||
:css => '.active [data-name="note"]',
|
||||
:value => 'some note 123'
|
||||
},
|
||||
{
|
||||
:execute => 'click',
|
||||
:css => '.active .profile',
|
||||
},
|
||||
{
|
||||
:execute => 'wait',
|
||||
:value => 1,
|
||||
},
|
||||
)
|
||||
click( :css => '.active .profile' )
|
||||
sleep 1
|
||||
|
||||
# check and change note again in edit screen
|
||||
{
|
||||
:execute => 'click',
|
||||
:css => '.active .js-action .select-arrow',
|
||||
},
|
||||
{
|
||||
:execute => 'click',
|
||||
:css => '.active .js-action a[data-type="edit"]',
|
||||
},
|
||||
{
|
||||
:execute => 'wait',
|
||||
:value => 1,
|
||||
},
|
||||
{
|
||||
:execute => 'match',
|
||||
click( :css => '.active .js-action .select-arrow' )
|
||||
click( :css => '.active .js-action a[data-type="edit"]' )
|
||||
|
||||
watch_for(
|
||||
:css => '.active .modal',
|
||||
:value => 'note',
|
||||
:match_result => true,
|
||||
},
|
||||
{
|
||||
:execute => 'match',
|
||||
)
|
||||
watch_for(
|
||||
:css => '.active .modal',
|
||||
:value => 'some note 123',
|
||||
:match_result => true,
|
||||
},
|
||||
{
|
||||
:execute => 'set',
|
||||
)
|
||||
|
||||
set(
|
||||
:css => '.active .modal [data-name="note"]',
|
||||
:value => 'some note abc'
|
||||
},
|
||||
{
|
||||
:execute => 'click',
|
||||
:css => '.active .modal button.js-submit',
|
||||
},
|
||||
{
|
||||
:execute => 'wait',
|
||||
:value => 4,
|
||||
},
|
||||
{
|
||||
:execute => 'match',
|
||||
:value => 'some note abc',
|
||||
)
|
||||
click( :css => '.active .modal button.js-submit' )
|
||||
|
||||
watch_for(
|
||||
:css => '.active .profile-window',
|
||||
:value => 'some note abc',
|
||||
:match_result => true,
|
||||
},
|
||||
)
|
||||
|
||||
# create new ticket
|
||||
{
|
||||
:execute => 'create_ticket',
|
||||
ticket_create(
|
||||
:data => {
|
||||
:customer => 'nico',
|
||||
:group => 'Users',
|
||||
:subject => 'org profile check ' + message,
|
||||
:title => 'org profile check ' + message,
|
||||
:body => 'org profile check ' + message,
|
||||
},
|
||||
{
|
||||
:execute => 'wait',
|
||||
:value => 4,
|
||||
},
|
||||
)
|
||||
sleep 1
|
||||
|
||||
# switch to org tab, verify if ticket is shown
|
||||
{
|
||||
:execute => 'search_organization',
|
||||
:term => 'Zammad Foundation',
|
||||
},
|
||||
|
||||
{
|
||||
:execute => 'match',
|
||||
organization_open_by_search(
|
||||
:value => 'Zammad Foundation',
|
||||
)
|
||||
watch_for(
|
||||
:css => '.active .profile-window',
|
||||
:value => 'org profile check ' + message,
|
||||
:match_result => true,
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
]
|
||||
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
|
||||
)
|
||||
end
|
||||
end
|
|
@ -887,6 +887,45 @@ class TestCase < Test::Unit::TestCase
|
|||
overviews
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
organization_open_by_search(
|
||||
:browser => browser2,
|
||||
:value => 'some value',
|
||||
)
|
||||
|
||||
=end
|
||||
|
||||
def organization_open_by_search(params = {})
|
||||
instance = params[:browser] || @browser
|
||||
|
||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
||||
|
||||
element.click
|
||||
element.clear
|
||||
element.send_keys( params[:value] )
|
||||
sleep 3
|
||||
instance.find_elements( { :css => '.search .empty-search' } )[0].click
|
||||
sleep 0.5
|
||||
text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value')
|
||||
if !text
|
||||
raise "#global-search is not empty!"
|
||||
end
|
||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
||||
element.click
|
||||
element.clear
|
||||
element.send_keys( params[:value] )
|
||||
sleep 2
|
||||
element = instance.find_element( { :partial_link_text => params[:value] } ).click
|
||||
name = instance.find_elements( { :css => '.active h1' } )[0].text
|
||||
if name !~ /#{params[:value]}/
|
||||
raise "unable to search/find org #{params[:value]}!"
|
||||
return
|
||||
end
|
||||
assert( true, "org #{params[:value]} found" )
|
||||
true
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
user_open_by_search(
|
||||
|
@ -1457,59 +1496,6 @@ class TestCase < Test::Unit::TestCase
|
|||
assert( false, "(#{test[:name]}) ticket creation failed, can't get zoom url" )
|
||||
return
|
||||
|
||||
# search user
|
||||
elsif action[:execute] == 'search_user'
|
||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
||||
element.click
|
||||
element.clear
|
||||
if @stack
|
||||
action[:term].gsub! '###stack###', @stack
|
||||
end
|
||||
element.send_keys( action[:term] )
|
||||
sleep 3
|
||||
element = instance.find_element( { :partial_link_text => action[:term] } ).click
|
||||
name = instance.find_elements( { :css => '.active h1' } )[0].text
|
||||
if name !~ /#{action[:term]}/
|
||||
assert( false, "(#{test[:name]}) unable to search/find user #{action[:term]}!" )
|
||||
return
|
||||
end
|
||||
assert( true, "(#{test[:name]}) user #{action[:term]} found" )
|
||||
return
|
||||
|
||||
# search org
|
||||
elsif action[:execute] == 'search_organization'
|
||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
||||
element.click
|
||||
element.clear
|
||||
if @stack
|
||||
action[:term].gsub! '###stack###', @stack
|
||||
end
|
||||
element.send_keys( action[:term] )
|
||||
sleep 3
|
||||
instance.find_elements( { :css => '.search .empty-search' } )[0].click
|
||||
sleep 0.5
|
||||
text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value')
|
||||
if !text
|
||||
assert( false, "(#{test[:name]}) #global-search is not empty!" )
|
||||
return
|
||||
end
|
||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
||||
element.click
|
||||
element.clear
|
||||
if @stack
|
||||
action[:term].gsub! '###stack###', @stack
|
||||
end
|
||||
element.send_keys( action[:term] )
|
||||
sleep 2
|
||||
element = instance.find_element( { :partial_link_text => action[:term] } ).click
|
||||
name = instance.find_elements( { :css => '.active h1' } )[0].text
|
||||
if name !~ /#{action[:term]}/
|
||||
assert( false, "(#{test[:name]}) unable to search/find org #{action[:term]}!" )
|
||||
return
|
||||
end
|
||||
assert( true, "(#{test[:name]}) org #{action[:term]} found" )
|
||||
return
|
||||
|
||||
# search ticket
|
||||
elsif action[:execute] == 'search_ticket'
|
||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
||||
|
|
Loading…
Reference in a new issue