Improved tests.
This commit is contained in:
parent
2a19983638
commit
7a686b5c0e
4 changed files with 263 additions and 277 deletions
|
@ -125,6 +125,7 @@ class AgentTicketOverviewLevel1Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# close ticket
|
# close ticket
|
||||||
|
sleep 1 # needed to selenium cache issues
|
||||||
ticket_update(
|
ticket_update(
|
||||||
:browser => browser2,
|
:browser => browser2,
|
||||||
:data => {
|
:data => {
|
||||||
|
|
|
@ -8,215 +8,167 @@ class MaintenanceMessageTest < TestCase
|
||||||
title_text = "test <b>#{string}<\/b>"
|
title_text = "test <b>#{string}<\/b>"
|
||||||
message_html = "message <b>1äöüß</b> #{string}\n\n\nhttp://zammad.org"
|
message_html = "message <b>1äöüß</b> #{string}\n\n\nhttp://zammad.org"
|
||||||
message_text = "message <b>1äöüß<\/b> #{string}\n\nhttp:\/\/zammad.org"
|
message_text = "message <b>1äöüß<\/b> #{string}\n\nhttp:\/\/zammad.org"
|
||||||
tests = [
|
|
||||||
{
|
# check #1
|
||||||
:name => 'check #1',
|
browser1 = browser_instance
|
||||||
:instance1 => browser_instance,
|
login(
|
||||||
:instance2 => browser_instance,
|
:browser => browser1,
|
||||||
:instance1_username => 'master@example.com',
|
:username => 'master@example.com',
|
||||||
:instance1_password => 'test',
|
:password => 'test',
|
||||||
:instance2_username => 'agent1@example.com',
|
:url => browser_url,
|
||||||
:instance2_password => 'test',
|
)
|
||||||
:url => browser_url,
|
|
||||||
:action => [
|
browser2 = browser_instance
|
||||||
{
|
login(
|
||||||
:execute => 'wait',
|
:browser => browser2,
|
||||||
:value => 1,
|
:username => 'agent1@example.com',
|
||||||
},
|
:password => 'test',
|
||||||
{
|
:url => browser_url,
|
||||||
:where => :instance1,
|
)
|
||||||
:execute => 'click',
|
click(
|
||||||
:css => 'a[href="#manage"]',
|
:browser => browser1,
|
||||||
},
|
:css => 'a[href="#manage"]',
|
||||||
{
|
)
|
||||||
:where => :instance1,
|
click(
|
||||||
:execute => 'click',
|
:browser => browser1,
|
||||||
:css => 'a[href="#system/maintenance"]',
|
:css => 'a[href="#system/maintenance"]',
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:where => :instance1,
|
set(
|
||||||
:execute => 'set',
|
:browser => browser1,
|
||||||
:css => '#content input[name="head"]',
|
:css => '#content input[name="head"]',
|
||||||
:value => title_html,
|
:value => title_html,
|
||||||
},
|
)
|
||||||
{
|
set(
|
||||||
:where => :instance1,
|
:browser => browser1,
|
||||||
:execute => 'set',
|
:css => '#content input[name="message"]',
|
||||||
:css => '#content textarea[name="message"]',
|
:value => message_html,
|
||||||
:value => message_html,
|
)
|
||||||
},
|
|
||||||
{
|
click(
|
||||||
:where => :instance1,
|
:browser => browser1,
|
||||||
:execute => 'click',
|
:css => '#content button[type="submit"]',
|
||||||
:css => '#content button[type="submit"]',
|
)
|
||||||
},
|
|
||||||
{
|
watch_for(
|
||||||
:execute => 'wait',
|
:browser => browser2,
|
||||||
:value => 5,
|
:css => '.modal',
|
||||||
},
|
:value => title_text,
|
||||||
{
|
)
|
||||||
:where => :instance2,
|
watch_for(
|
||||||
:execute => 'watch_for',
|
:browser => browser2,
|
||||||
:area => '.modal',
|
:css => '.modal',
|
||||||
:value => title_text,
|
:value => message_text,
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:where => :instance2,
|
match_not(
|
||||||
:execute => 'watch_for',
|
:browser => browser1,
|
||||||
:area => '.modal',
|
:css => 'body',
|
||||||
:value => message_text,
|
:value => message_text,
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:where => :instance1,
|
click(
|
||||||
:execute => 'match',
|
:browser => browser2,
|
||||||
:css => 'body',
|
:css => 'div.modal-header .close',
|
||||||
:value => message_text,
|
)
|
||||||
:match_result => false,
|
|
||||||
},
|
# check #2
|
||||||
{
|
click(
|
||||||
:where => :instance2,
|
:browser => browser1,
|
||||||
:execute => 'click',
|
:css => 'a[href="#manage"]',
|
||||||
:css => 'div.modal-header .close',
|
)
|
||||||
},
|
click(
|
||||||
{
|
:browser => browser1,
|
||||||
:execute => 'wait',
|
:css => 'a[href="#system/maintenance"]',
|
||||||
:value => 2,
|
)
|
||||||
},
|
|
||||||
],
|
set(
|
||||||
},
|
:browser => browser1,
|
||||||
{
|
:css => '#content input[name="head"]',
|
||||||
:name => 'check #2',
|
:value => title_html + ' #2',
|
||||||
:action => [
|
)
|
||||||
{
|
set(
|
||||||
:where => :instance1,
|
:browser => browser1,
|
||||||
:execute => 'click',
|
:css => '#content input[name="message"]',
|
||||||
:css => 'a[href="#manage"]',
|
:value => message_html + ' #2',
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:where => :instance1,
|
click(
|
||||||
:execute => 'click',
|
:browser => browser1,
|
||||||
:css => 'a[href="#system/maintenance"]',
|
:css => '#content button[type="submit"]',
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:where => :instance1,
|
watch_for(
|
||||||
:execute => 'set',
|
:browser => browser2,
|
||||||
:css => '#content input[name="head"]',
|
:css => '.modal',
|
||||||
:value => title_html + ' #2',
|
:value => title_html + ' #2',
|
||||||
},
|
)
|
||||||
{
|
watch_for(
|
||||||
:where => :instance1,
|
:browser => browser2,
|
||||||
:execute => 'set',
|
:css => '.modal',
|
||||||
:css => '#content textarea[name="message"]',
|
:value => message_html + ' #2',
|
||||||
:value => message_html + ' #2',
|
)
|
||||||
},
|
|
||||||
{
|
match_not(
|
||||||
:where => :instance1,
|
:browser => browser1,
|
||||||
:execute => 'click',
|
:css => 'body',
|
||||||
:css => '#content button[type="submit"]',
|
:value => message_text,
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:where => :instance2,
|
click(
|
||||||
:execute => 'watch_for',
|
:browser => browser2,
|
||||||
:area => '.modal',
|
:css => 'div.modal-header .close',
|
||||||
:value => title_text,
|
)
|
||||||
},
|
|
||||||
{
|
# check #3
|
||||||
:where => :instance2,
|
click(
|
||||||
:execute => 'watch_for',
|
:browser => browser1,
|
||||||
:area => '.modal',
|
:css => 'a[href="#manage"]',
|
||||||
:value => message_text + ' #2',
|
)
|
||||||
},
|
click(
|
||||||
{
|
:browser => browser1,
|
||||||
:where => :instance1,
|
:css => 'a[href="#system/maintenance"]',
|
||||||
:execute => 'match',
|
)
|
||||||
:css => 'body',
|
|
||||||
:value => message_text + ' #2',
|
set(
|
||||||
:match_result => false,
|
:browser => browser1,
|
||||||
},
|
:css => '#content input[name="head"]',
|
||||||
{
|
:value => title_html + ' #3',
|
||||||
:where => :instance2,
|
)
|
||||||
:execute => 'click',
|
set(
|
||||||
:css => 'div.modal-header .close',
|
:browser => browser1,
|
||||||
},
|
:css => '#content input[name="message"]',
|
||||||
{
|
:value => message_html + ' #3',
|
||||||
:execute => 'wait',
|
)
|
||||||
:value => 2,
|
check(
|
||||||
},
|
:browser => browser1,
|
||||||
],
|
:css => '#content input[name="reload"][value="1"]',
|
||||||
},
|
)
|
||||||
{
|
click(
|
||||||
:name => 'check #3',
|
:browser => browser1,
|
||||||
:action => [
|
:css => '#content button[type="submit"]',
|
||||||
{
|
)
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'click',
|
watch_for(
|
||||||
:css => 'a[href="#manage"]',
|
:browser => browser2,
|
||||||
},
|
:css => '.modal',
|
||||||
{
|
:value => title_html + ' #3',
|
||||||
:where => :instance1,
|
)
|
||||||
:execute => 'click',
|
watch_for(
|
||||||
:css => 'a[href="#system/maintenance"]',
|
:browser => browser2,
|
||||||
},
|
:css => '.modal',
|
||||||
{
|
:value => message_html + ' #3',
|
||||||
:where => :instance1,
|
)
|
||||||
:execute => 'set',
|
watch_for(
|
||||||
:css => '#content input[name="head"]',
|
:browser => browser2,
|
||||||
:value => title_html + ' #3' ,
|
:css => '.modal',
|
||||||
},
|
:value => 'Reload application',
|
||||||
{
|
)
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'set',
|
match_not(
|
||||||
:css => '#content textarea[name="message"]',
|
:browser => browser1,
|
||||||
:value => message_html + ' #3',
|
:css => 'body',
|
||||||
},
|
:value => message_text,
|
||||||
{
|
)
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'setCheck',
|
|
||||||
:css => '#content input[name="reload"][value="1"]',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '#content button[type="submit"]',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'check',
|
|
||||||
:css => 'div.modal-backdrop.fade.in',
|
|
||||||
:result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance2,
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => '.modal',
|
|
||||||
:value => title_text,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance2,
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => '.modal',
|
|
||||||
:value => message_text + ' #3',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance1,
|
|
||||||
:execute => 'match',
|
|
||||||
:css => 'body',
|
|
||||||
:value => message_text + ' #3',
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:where => :instance2,
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => '.modal',
|
|
||||||
:value => 'Reload application',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
browser_double_test(tests)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -3,75 +3,70 @@ require 'browser_test_helper'
|
||||||
|
|
||||||
class TaskbarSessionTest < TestCase
|
class TaskbarSessionTest < TestCase
|
||||||
def test_current_session_a_same_agent
|
def test_current_session_a_same_agent
|
||||||
tests = [
|
|
||||||
{
|
# check taken over session block screen with same user
|
||||||
:name => 'check taken over session block screen with same user',
|
browser1 = browser_instance
|
||||||
:instance1 => browser_instance,
|
login(
|
||||||
:instance2 => browser_instance,
|
:browser => browser1,
|
||||||
:instance1_username => 'agent1@example.com',
|
:username => 'agent1@example.com',
|
||||||
:instance1_password => 'test',
|
:password => 'test',
|
||||||
:instance2_username => 'agent1@example.com',
|
:url => browser_url,
|
||||||
:instance2_password => 'test',
|
)
|
||||||
:url => browser_url,
|
|
||||||
:action => [
|
browser2 = browser_instance
|
||||||
{
|
login(
|
||||||
:execute => 'wait',
|
:browser => browser2,
|
||||||
:value => 8,
|
:username => 'agent1@example.com',
|
||||||
},
|
:password => 'test',
|
||||||
{
|
:url => browser_url,
|
||||||
:where => :instance1,
|
)
|
||||||
:execute => 'match',
|
|
||||||
:css => 'body',
|
sleep 8
|
||||||
:value => 'Reload application',
|
|
||||||
:match_result => true,
|
match(
|
||||||
},
|
:browser => browser1,
|
||||||
{
|
:css => 'body',
|
||||||
:where => :instance2,
|
:value => 'Reload application',
|
||||||
:execute => 'match',
|
)
|
||||||
:css => 'body',
|
match_not(
|
||||||
:value => 'Reload application',
|
:browser => browser2,
|
||||||
:match_result => false,
|
:css => 'body',
|
||||||
},
|
:value => 'Reload application',
|
||||||
],
|
)
|
||||||
},
|
|
||||||
]
|
|
||||||
browser_double_test(tests)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_current_session_b_different_agent
|
def test_current_session_b_different_agent
|
||||||
tests = [
|
|
||||||
{
|
# check taken over session block screen with same user
|
||||||
:name => 'check taken over session block screen with same user',
|
browser1 = browser_instance
|
||||||
:instance1 => browser_instance,
|
login(
|
||||||
:instance2 => browser_instance,
|
:browser => browser1,
|
||||||
:instance1_username => 'master@example.com',
|
:username => 'master@example.com',
|
||||||
:instance1_password => 'test',
|
:password => 'test',
|
||||||
:instance2_username => 'agent1@example.com',
|
:url => browser_url,
|
||||||
:instance2_password => 'test',
|
)
|
||||||
:url => browser_url,
|
|
||||||
:action => [
|
browser2 = browser_instance
|
||||||
{
|
login(
|
||||||
:execute => 'wait',
|
:browser => browser2,
|
||||||
:value => 8,
|
:username => 'agent1@example.com',
|
||||||
},
|
:password => 'test',
|
||||||
{
|
:url => browser_url,
|
||||||
:where => :instance1,
|
)
|
||||||
:execute => 'match',
|
|
||||||
:css => 'body',
|
sleep 8
|
||||||
:value => 'Reload application',
|
|
||||||
:match_result => false,
|
match_not(
|
||||||
},
|
:browser => browser1,
|
||||||
{
|
:css => 'body',
|
||||||
:where => :instance2,
|
:value => 'Reload application',
|
||||||
:execute => 'match',
|
)
|
||||||
:css => 'body',
|
match_not(
|
||||||
:value => 'Reload application',
|
:browser => browser2,
|
||||||
:match_result => false,
|
:css => 'body',
|
||||||
},
|
:value => 'Reload application',
|
||||||
],
|
)
|
||||||
},
|
|
||||||
]
|
|
||||||
browser_double_test(tests)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -279,6 +279,44 @@ class TestCase < Test::Unit::TestCase
|
||||||
dropdown.select_by(:text, params[:value])
|
dropdown.select_by(:text, params[:value])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
check(
|
||||||
|
:browser => browser1,
|
||||||
|
:css => '.some_class',
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def check(params)
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
|
||||||
|
element = instance.find_elements( { :css => params[:css] } )[0]
|
||||||
|
checked = element.attribute('checked')
|
||||||
|
if !checked
|
||||||
|
element.click
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
uncheck(
|
||||||
|
:browser => browser1,
|
||||||
|
:css => '.some_class',
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def uncheck(params)
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
|
||||||
|
element = instance.find_elements( { :css => params[:css] } )[0]
|
||||||
|
checked = element.attribute('checked')
|
||||||
|
if checked
|
||||||
|
element.click
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
sendkey(
|
sendkey(
|
||||||
|
|
Loading…
Reference in a new issue