diff --git a/test/browser/aab_unit_test.rb b/test/browser/aab_unit_test.rb index e3869446b..07d97bdb2 100644 --- a/test/browser/aab_unit_test.rb +++ b/test/browser/aab_unit_test.rb @@ -19,12 +19,14 @@ class AAbUnitTest < TestCase :css => '.result .failed', :value => '0', ) + location( :url => browser_url + '/tests-model' ) sleep 8 match( :css => '.result .failed', :value => '0', ) + location( :url => browser_url + '/tests-model-ui' ) sleep 8 match( @@ -40,15 +42,14 @@ class AAbUnitTest < TestCase :css => '.result .failed', :value => '0', ) + location( :url => browser_url + '/tests-form-extended' ) sleep 8 match( :css => '.result .failed', :value => '0', ) - end - def test_form_validation - @browser = browser_instance + location( :url => browser_url + '/tests-form-validation' ) sleep 4 match( @@ -64,6 +65,7 @@ class AAbUnitTest < TestCase :css => '.result .failed', :value => '0', ) + location( :url => browser_url + '/tests-html-utils' ) sleep 4 match( diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index ff352a683..1ebf068e9 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -2,60 +2,8 @@ require 'browser_test_helper' class AgentOrganizationProfileTest < TestCase - def test_search_and_edit_verify_in_second - message = 'comment 1 ' + rand(99999999999999999).to_s - - browser1 = browser_instance - login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, - ) - 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 - set( - :browser => browser1, - :css => '.active [data-name="note"]', - :value => message, - ) - click( - :browser => browser1, - :css => '.active .profile', - ) - - # verify - watch_for( - :browser => browser2, - :css => '.active .profile-window', - :value => message, - ) - end - - def test_search_and_edit_in_one + def test_org_profile + # work in one browser window message = '1 ' + rand(99999999).to_s @browser = browser_instance @@ -131,5 +79,52 @@ class AgentOrganizationProfileTest < TestCase :css => '.active .profile-window', :value => 'org profile check ' + message, ) + tasks_close_all() + + + + # work with two browser windows + message = 'comment 1 ' + rand(99999999999999999).to_s + + # use current session + browser1 = @browser + + 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 + set( + :browser => browser1, + :css => '.active [data-name="note"]', + :value => message, + ) + click( + :browser => browser1, + :css => '.active .profile', + ) + + # verify + watch_for( + :browser => browser2, + :css => '.active .profile-window', + :value => message, + ) end end \ No newline at end of file diff --git a/test/browser/agent_ticket_actions_level1_test.rb b/test/browser/agent_ticket_actions_level1_test.rb index 3832a9be9..9d23ea13d 100644 --- a/test/browser/agent_ticket_actions_level1_test.rb +++ b/test/browser/agent_ticket_actions_level1_test.rb @@ -3,292 +3,150 @@ require 'browser_test_helper' class AgentTicketActionLevel1Test < TestCase def test_agent_ticket_merge_closed_tab - tests = [ - { - :name => 'agent ticket create 1', - :action => [ - { - :execute => 'close_all_tasks', - }, - # create ticket - { - :execute => 'create_ticket', - :group => 'Users', - :subject => 'some subject 123äöü', - :body => 'some body 123äöü - with closed tab', - }, + # merge ticket with closed tab + @browser = browser_instance + login( + :username => 'agent1@example.com', + :password => 'test', + :url => browser_url, + ) + tasks_close_all() - # check ticket - { - :execute => 'match', - :css => '.content.active .ticket-article', - :value => 'some body 123äöü - with closed tab', - :match_result => true, - }, - - # remember old ticket where we want to merge to - { - :execute => 'match', - :css => '.content.active .page-header .ticket-number', - :value => '^(.*)$', - :no_quote => true, - :match_result => true, - }, - - # update ticket - #{ - # :execute => 'select', - # :css => '.active select[name="type_id"]', - # :value => 'note', - #}, - { - :execute => 'set_ticket_attributes', - :body => 'some body 1234 äöüß - with closed tab', - }, - { - :execute => 'click', - :css => '.content.active button.js-submit', - }, - { - :execute => 'wait', - :value => 2, - }, - { - :execute => 'watch_for', - :area => '.content.active .ticket-article', - :value => 'some body 1234 äöüß - with closed tab', - }, - { - :execute => 'close_all_tasks', - }, - ], + # create new ticket + ticket1 = ticket_create( + :data => { + :customer => 'nico', + :group => 'Users', + :title => 'some subject 123äöü - with closed tab', + :body => 'some body 123äöü - with closed tab', }, + ) + sleep 1 - { - :name => 'agent ticket create 2', - :action => [ - - # create ticket - { - :execute => 'create_ticket', - :group => 'Users', - :subject => 'test to merge', - :body => 'some body 123äöü 222 - test to merge - with closed tab', - }, - - # check ticket - { - :execute => 'watch_for', - :area => '.content.active .ticket-article', - :value => 'some body 123äöü 222 - test to merge - with closed tab', - }, - - # update ticket - #{ - # :execute => 'select', - # :css => '.content_permanent.active select[name="type_id"]', - # :value => 'note', - #}, - { - :execute => 'set_ticket_attributes', - :body => 'some body 1234 äöüß 333 - with closed tab', - }, - { - :execute => 'click', - :css => '.content.active button.js-submit', - }, - { - :execute => 'wait', - :value => 2, - }, - { - :execute => 'watch_for', - :area => '.content.active .ticket-article', - :value => 'some body 1234 äöüß 333 - with closed tab', - }, - - # check if task is shown - { - :execute => 'match', - :css => 'body', - :value => 'test to merge', - :match_result => true, - }, - ], + # update ticket + ticket_update( + :data => { + :body => 'some body 1234 äöüß - with closed tab', }, - { - :name => 'agent ticket merge', - :action => [ - { - :execute => 'click', - :css => '.active div[data-tab="ticket"] .js-actions .select-arrow', - }, - { - :execute => 'click', - :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]', - }, - { - :execute => 'wait', - :value => 4, - }, - { - :execute => 'set', - :css => '.modal input[name="master_ticket_number"]', - :value => '###stack###', - }, - { - :execute => 'click', - :css => '.modal button[type="submit"]', - }, - { - :execute => 'wait', - :value => 6, - }, + ) - # check if merged to ticket is shown now - { - :execute => 'match', - :css => '.active .page-header .ticket-number', - :value => '###stack###', - :match_result => true, - }, + tasks_close_all() - # check if task is now gone - { - :execute => 'match', - :css => 'body', - :value => 'test to merge - with closed tab', - :match_result => true, - }, - - # close task/cleanup - { - :execute => 'close_all_tasks', - }, - ], + # create second ticket to merge + ticket2 = ticket_create( + :data => { + :customer => 'nico', + :group => 'Users', + :title => 'test to merge - with closed tab', + :body => 'some body 123äöü 222 - test to merge - with closed tab', }, - ] - browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) - end + ) - def test_agent_ticket_merge_open_tab - tests = [ - { - :name => 'agent ticket create 1', - :action => [ - { - :execute => 'close_all_tasks', - }, - - # create ticket - { - :execute => 'create_ticket', - :group => 'Users', - :subject => 'some subject 123äöü', - :body => 'some body 123äöü - with open tab', - }, - - # check ticket - { - :execute => 'match', - :css => '.content.active .ticket-article', - :value => 'some body 123äöü - with open tab', - :match_result => true, - }, - - # remember old ticket where we want to merge to - { - :execute => 'match', - :css => '.content.active .page-header .ticket-number', - :value => '^(.*)$', - :no_quote => true, - :match_result => true, - }, - - ], + ticket_update( + :data => { + :body => 'some body 1234 äöüß 333 - with closed tab', }, + ) - { - :name => 'agent ticket create 2', - :action => [ + # check if task is shown + match( + :css => '.tasks', + :value => 'test to merge - with closed tab', + ) - # create ticket - { - :execute => 'create_ticket', - :group => 'Users', - :subject => 'test to merge', - :body => 'some body 123äöü 222 - test to merge - with open tab', - }, + # merge tickets + click( :css => '.active div[data-tab="ticket"] .js-actions .select-arrow' ) + click( :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]' ) + watch_for( + :css => '.modal', + :value => 'merge', + ) - # check ticket - { - :execute => 'watch_for', - :area => '.content.active .ticket-article', - :value => 'some body 123äöü 222 - test to merge - with open tab', - }, + set( + :css => '.modal input[name="master_ticket_number"]', + :value => ticket1[:number], + ) - # check if task is shown - { - :execute => 'match', - :css => 'body', - :value => 'test to merge', - :match_result => true, - }, - ], + click( :css => '.modal button[type="submit"]' ) + + # check if merged to ticket is shown now + watch_for( + :css => '.active .page-header .ticket-number', + :value => ticket1[:number], + ) + watch_for( + :css => '.active .ticket-article', + :value => 'test to merge - with closed tab', + ) + + # check if task is now gone + match_not( + :css => '.tasks', + :value => 'test to merge', + ) + match( + :css => '.tasks', + :value => 'some subject 123äöü - with closed tab', + ) + + # close task/cleanup + tasks_close_all() + + + + # merge ticket with open tabs + ticket3 = ticket_create( + :data => { + :customer => 'nico', + :group => 'Users', + :title => 'some subject 123äöü - with open tab', + :body => 'some body 123äöü - with open tab', }, - { - :name => 'agent ticket merge', - :action => [ - { - :execute => 'click', - :css => '.active div[data-tab="ticket"] .js-actions .select-arrow', - }, - { - :execute => 'click', - :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]', - }, - { - :execute => 'wait', - :value => 4, - }, - { - :execute => 'set', - :css => '.modal input[name="master_ticket_number"]', - :value => '###stack###', - }, - { - :execute => 'click', - :css => '.modal button[type="submit"]', - }, - { - :execute => 'wait', - :value => 6, - }, + ) - # check if merged to ticket is shown now - { - :execute => 'match', - :css => '.active .page-header .ticket-number', - :value => '###stack###', - :match_result => true, - }, - - # check if task is now gone - { - :execute => 'match', - :css => 'body', - :value => 'test to merge - with open tab', - :match_result => true, - }, - - # close task/cleanup - { - :execute => 'close_all_tasks', - }, - ], + ticket4 = ticket_create( + :data => { + :customer => 'nico', + :group => 'Users', + :title => 'test to merge - with open tab', + :body => 'some body 123äöü 222 - test to merge - with open tab', }, - ] - browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) + ) + + # merge tickets + click( :css => '.active div[data-tab="ticket"] .js-actions .select-arrow' ) + click( :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]' ) + watch_for( + :css => '.modal', + :value => 'merge', + ) + + set( + :css => '.modal input[name="master_ticket_number"]', + :value => ticket3[:number], + ) + click( :css => '.modal button[type="submit"]' ) + + # check if merged to ticket is shown now + watch_for( + :css => '.active .page-header .ticket-number', + :value => ticket3[:number], + ) + watch_for( + :css => '.active .ticket-article', + :value => 'test to merge - with open tab', + ) + + # check if task is now gone + match_not( + :css => '.tasks', + :value => 'test to merge', + ) + match( + :css => '.tasks', + :value => 'some subject 123äöü - with open tab', + ) + end end \ No newline at end of file diff --git a/test/browser/agent_ticket_overview_level1_test.rb b/test/browser/agent_ticket_overview_level1_test.rb index 4caf71d5e..f20d261c1 100644 --- a/test/browser/agent_ticket_overview_level1_test.rb +++ b/test/browser/agent_ticket_overview_level1_test.rb @@ -125,7 +125,7 @@ class AgentTicketOverviewLevel1Test < TestCase ) # close ticket - sleep 1 # needed to selenium cache issues + sleep 2 # needed to selenium cache issues ticket_update( :browser => browser2, :data => { diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index 751d6ea71..04d7785db 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -2,59 +2,7 @@ require 'browser_test_helper' class AgentUserProfileTest < TestCase - def test_search_and_edit_verify_in_second - message = 'comment 1 ' + rand(99999999999999999).to_s - - browser1 = browser_instance - login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, - ) - 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, - ) - - user_open_by_search( - :browser => browser1, - :value => 'Braun', - ) - user_open_by_search( - :browser => browser2, - :value => 'Braun', - ) - - # update note - set( - :browser => browser1, - :css => '.active [data-name="note"]', - :value => message, - ) - click( - :browser => browser1, - :css => '.active .profile', - ) - - watch_for( - :browser => browser2, - :css => '.active .profile-window', - :value => message, - ) - end - - def test_search_and_edit_in_one + def test_user_profile message = '1 ' + rand(99999999).to_s @browser = browser_instance @@ -127,5 +75,52 @@ class AgentUserProfileTest < TestCase :css => '.active .profile-window', :value => 'user profile check ' + message, ) + tasks_close_all() + + + + # work with two browser windows + message = 'comment 1 ' + rand(99999999999999999).to_s + + # use current session + browser1 = @browser + + browser2 = browser_instance + login( + :browser => browser2, + :username => 'agent1@example.com', + :password => 'test', + :url => browser_url, + ) + tasks_close_all( + :browser => browser2, + ) + + user_open_by_search( + :browser => browser1, + :value => 'Braun', + ) + user_open_by_search( + :browser => browser2, + :value => 'Braun', + ) + + # update note + set( + :browser => browser1, + :css => '.active [data-name="note"]', + :value => message, + ) + click( + :browser => browser1, + :css => '.active .profile', + ) + + watch_for( + :browser => browser2, + :css => '.active .profile-window', + :value => message, + ) + end end \ No newline at end of file diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index e514b7837..b643564c2 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -725,6 +725,8 @@ class TestCase < Test::Unit::TestCase ticket_update( :browser => browser1, :data => { + :title => '', + :body => 'some body', :group => 'some group', :state => 'closed', }, @@ -737,6 +739,41 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser data = params[:data] + + if data[:title] + #element = instance.find_elements( { :css => '.content.active .page-header .ticket-title-update' } )[0] + #element.clear + #sleep 0.5 + #element = instance.find_elements( { :css => '.content.active .page-header .ticket-title-update' } )[0] + #element.send_keys( data[:title] ) + #sleep 0.5 + #element.send_keys( :tab ) + + instance.execute_script( '$(".content.active .page-header .ticket-title-update").focus()' ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").text("' + data[:title] + '")' ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").blur()' ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").trigger("blur")' ) +# { +# :where => :instance2, +# :execute => 'sendkey', +# :css => '.content.active .page-header .ticket-title-update', +# :value => 'TTT', +# }, +# { +# :where => :instance2, +# :execute => 'sendkey', +# :css => '.content.active .page-header .ticket-title-update', +# :value => :tab, +# }, + end + if data[:body] + #instance.execute_script( '$(".content.active div[data-name=body]").focus()' ) + sleep 0.5 + element = instance.find_elements( { :css => '.content.active div[data-name=body]' } )[0] + element.clear + element.send_keys( data[:body] ) + end + if data[:group] element = instance.find_elements( { :css => '.active .sidebar select[name="group_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element)