Improved speed of tests.
This commit is contained in:
parent
7bf4f3e91c
commit
309369090b
4 changed files with 701 additions and 1377 deletions
|
@ -11,229 +11,156 @@ class AaaGettingStartedTest < TestCase
|
||||||
end
|
end
|
||||||
mailbox_user = ENV['MAILBOX_INIT'].split(':')[0]
|
mailbox_user = ENV['MAILBOX_INIT'].split(':')[0]
|
||||||
mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
|
mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
:name => 'start',
|
|
||||||
:instance => browser_instance,
|
|
||||||
:url => browser_url + '/',
|
|
||||||
:action => [
|
|
||||||
{
|
|
||||||
:execute => 'check',
|
|
||||||
:css => '.setup.wizard',
|
|
||||||
:result => true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:name => 'getting started - master agent',
|
|
||||||
:action => [
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.js-start .btn--primary',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
@browser = browser_instance
|
||||||
:execute => 'set',
|
location( :url => browser_url )
|
||||||
:css => '.js-admin input[name="firstname"]',
|
watch_for(
|
||||||
:value => 'Test Master',
|
:css => '.setup.wizard',
|
||||||
},
|
:value => 'setup new system',
|
||||||
{
|
)
|
||||||
:execute => 'set',
|
click( :css => '.js-start .btn--primary' )
|
||||||
:css => '.js-admin input[name="lastname"]',
|
set(
|
||||||
:value => 'Agent',
|
:css => '.js-admin input[name="firstname"]',
|
||||||
},
|
:value => 'Test Master',
|
||||||
{
|
)
|
||||||
:execute => 'set',
|
set(
|
||||||
:css => '.js-admin input[name="email"]',
|
:css => '.js-admin input[name="lastname"]',
|
||||||
:value => 'master@example.com',
|
:value => 'Agent',
|
||||||
},
|
)
|
||||||
{
|
set(
|
||||||
:execute => 'set',
|
:css => '.js-admin input[name="email"]',
|
||||||
:css => '.js-admin input[name="password"]',
|
:value => 'master@example.com',
|
||||||
:value => 'test1234äöüß',
|
)
|
||||||
},
|
set(
|
||||||
{
|
:css => '.js-admin input[name="firstname"]',
|
||||||
:execute => 'set',
|
:value => 'Test Master',
|
||||||
:css => '.js-admin input[name="password_confirm"]',
|
)
|
||||||
:value => 'test1234äöüß',
|
set(
|
||||||
},
|
:css => '.js-admin input[name="password"]',
|
||||||
{
|
:value => 'test1234äöüß',
|
||||||
:execute => 'click',
|
)
|
||||||
:css => '.js-admin .btn--success',
|
set(
|
||||||
},
|
:css => '.js-admin input[name="password_confirm"]',
|
||||||
{
|
:value => 'test1234äöüß',
|
||||||
:execute => 'watch_for',
|
)
|
||||||
:area => '.js-base h2',
|
click( :css => '.js-admin .btn--success' )
|
||||||
:value => 'Organization',
|
watch_for(
|
||||||
},
|
:css => '.js-base h2',
|
||||||
],
|
:value => 'Organization',
|
||||||
},
|
)
|
||||||
|
|
||||||
# set base
|
# getting started - base
|
||||||
{
|
match(
|
||||||
:name => 'getting started - base',
|
:css => '.js-base h2',
|
||||||
:action => [
|
:value => 'Organization',
|
||||||
{
|
)
|
||||||
:execute => 'match',
|
set(
|
||||||
:css => '.js-base h2',
|
:css => '.js-base input[name="organization"]',
|
||||||
:value => 'Organization',
|
:value => 'Some Organization',
|
||||||
:match_result => true,
|
)
|
||||||
},
|
set(
|
||||||
{
|
:css => '.js-base input[name="url"]',
|
||||||
:execute => 'set',
|
:value => 'some host',
|
||||||
:css => '.js-base input[name="organization"]',
|
)
|
||||||
:value => 'Some Organization',
|
click(
|
||||||
},
|
:css => '.js-base .btn--primary',
|
||||||
{
|
)
|
||||||
:execute => 'set',
|
watch_for(
|
||||||
:css => '.js-base input[name="url"]',
|
:css => 'body',
|
||||||
:value => 'some host',
|
:value => 'A URL looks like',
|
||||||
},
|
)
|
||||||
{
|
set(
|
||||||
:execute => 'click',
|
:css => '.js-base input[name="url"]',
|
||||||
:css => '.js-base .btn--primary',
|
:value => 'http://localhost:3333',
|
||||||
},
|
)
|
||||||
{
|
click(
|
||||||
:execute => 'watch_for',
|
:css => '.js-base .btn--primary',
|
||||||
:area => 'body',
|
)
|
||||||
:value => 'A URL looks like',
|
watch_for(
|
||||||
},
|
:css => 'body',
|
||||||
{
|
:value => 'channel',
|
||||||
:execute => 'set',
|
)
|
||||||
:css => '.js-base input[name="url"]',
|
location_check(
|
||||||
:value => 'http://localhost:3333',
|
:url => '#getting_started/channel',
|
||||||
},
|
)
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.js-base .btn--primary',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => 'body',
|
|
||||||
:value => 'channel',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'check',
|
|
||||||
:element => :url,
|
|
||||||
:result => '#getting_started/channel',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
# create email account
|
# getting started - create email account
|
||||||
{
|
match(
|
||||||
:name => 'getting started - base',
|
:css => '.js-channel h2',
|
||||||
:action => [
|
:value => 'Connect Channels',
|
||||||
{
|
)
|
||||||
:execute => 'match',
|
click(
|
||||||
:css => '.js-channel h2',
|
:css => '.js-channel .email .provider_name',
|
||||||
:value => 'Connect Channels',
|
)
|
||||||
:match_result => true,
|
set(
|
||||||
},
|
:css => '.js-intro input[name="realname"]',
|
||||||
{
|
:value => 'Some Realname',
|
||||||
:execute => 'click',
|
)
|
||||||
:css => '.js-channel .email .provider_name',
|
set(
|
||||||
},
|
:css => '.js-intro input[name="email"]',
|
||||||
{
|
:value => mailbox_user,
|
||||||
:execute => 'set',
|
)
|
||||||
:css => '.js-intro input[name="realname"]',
|
set(
|
||||||
:value => 'Some Realname',
|
:css => '.js-intro input[name="password"]',
|
||||||
},
|
:value => mailbox_password,
|
||||||
{
|
)
|
||||||
:execute => 'set',
|
click(
|
||||||
:css => '.js-intro input[name="email"]',
|
:css => '.js-intro .btn--primary',
|
||||||
:value => mailbox_user,
|
)
|
||||||
},
|
watch_for(
|
||||||
{
|
:css => 'body',
|
||||||
:execute => 'set',
|
:value => 'verify',
|
||||||
:css => '.js-intro input[name="password"]',
|
:timeout => 20,
|
||||||
:value => mailbox_password,
|
)
|
||||||
},
|
watch_for(
|
||||||
{
|
:css => 'body',
|
||||||
:execute => 'click',
|
:value => 'invite',
|
||||||
:css => '.js-intro .btn--primary',
|
:timeout => 100,
|
||||||
},
|
)
|
||||||
{
|
location_check(
|
||||||
:execute => 'watch_for',
|
:url => '#getting_started/agents',
|
||||||
:area => 'body',
|
)
|
||||||
:value => 'verify',
|
|
||||||
:timeout => 20,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => 'body',
|
|
||||||
:value => 'invite',
|
|
||||||
:timeout => 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'check',
|
|
||||||
:element => :url,
|
|
||||||
:result => '#getting_started/agents',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
# invite agent1
|
# invite agent1
|
||||||
{
|
match(
|
||||||
:name => 'getting started - agent 1',
|
:css => 'body',
|
||||||
:action => [
|
:value => 'Invite',
|
||||||
{
|
)
|
||||||
:execute => 'match',
|
set(
|
||||||
:css => 'body',
|
:css => '.js-agent input[name="firstname"]',
|
||||||
:value => 'Invite',
|
:value => 'Agent 1',
|
||||||
:match_result => true,
|
)
|
||||||
},
|
set(
|
||||||
{
|
:css => '.js-agent input[name="lastname"]',
|
||||||
:execute => 'set',
|
:value => 'Test',
|
||||||
:css => '.js-agent input[name="firstname"]',
|
)
|
||||||
:value => 'Agent 1',
|
set(
|
||||||
},
|
:css => '.js-agent input[name="email"]',
|
||||||
{
|
:value => 'agent1@example.com',
|
||||||
:execute => 'set',
|
)
|
||||||
:css => '.js-agent input[name="lastname"]',
|
click(
|
||||||
:value => 'Test',
|
:css => '.js-agent input[name="group_ids"][value="1"]',
|
||||||
},
|
)
|
||||||
{
|
click(
|
||||||
:execute => 'set',
|
:css => '.js-agent .btn--success',
|
||||||
:css => '.js-agent input[name="email"]',
|
)
|
||||||
:value => 'agent1@example.com',
|
watch_for(
|
||||||
},
|
:css => 'body',
|
||||||
{
|
:value => 'Invitation sent',
|
||||||
:execute => 'click',
|
)
|
||||||
:css => '.js-agent input[name="group_ids"][value="1"]',
|
location_check(
|
||||||
},
|
:url => '#getting_started/agents',
|
||||||
{
|
)
|
||||||
:execute => 'click',
|
click(
|
||||||
:css => '.js-agent .btn--success',
|
:css => '.js-agent .btn--primary',
|
||||||
},
|
)
|
||||||
{
|
watch_for(
|
||||||
:execute => 'watch_for',
|
:css => 'body',
|
||||||
:area => 'body',
|
:value => 'My Stats',
|
||||||
:value => 'Invitation sent',
|
)
|
||||||
},
|
location_check(
|
||||||
{
|
:url => '#dashboard',
|
||||||
:execute => 'check',
|
)
|
||||||
:element => :url,
|
|
||||||
:result => '#getting_started/agents',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.js-agent .btn--primary',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => 'body',
|
|
||||||
:value => 'My Stats',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'check',
|
|
||||||
:element => :url,
|
|
||||||
:result => '#dashboard',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
browser_single_test(tests)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_b_accounts_auto
|
def test_b_accounts_auto
|
||||||
|
@ -255,59 +182,47 @@ class AaaGettingStartedTest < TestCase
|
||||||
puts "NOTICE: Need min. MAILBOX_AUTO1 as ENV variable like export MAILBOX_AUTO1='nicole.braun2015@gmail.com:somepass'"
|
puts "NOTICE: Need min. MAILBOX_AUTO1 as ENV variable like export MAILBOX_AUTO1='nicole.braun2015@gmail.com:somepass'"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@browser = browser_instance
|
||||||
|
login(
|
||||||
|
:username => 'master@example.com',
|
||||||
|
:password => 'test',
|
||||||
|
:url => browser_url,
|
||||||
|
)
|
||||||
accounts.each {|account|
|
accounts.each {|account|
|
||||||
tests = [
|
|
||||||
{
|
# getting started - auto mail
|
||||||
:name => 'getting started - auto mail',
|
location( :url => browser_url + '/#getting_started/channel' )
|
||||||
:action => [
|
click(
|
||||||
{
|
:css => '.js-channel .email .provider_name',
|
||||||
:execute => 'navigate',
|
)
|
||||||
:to => browser_url + '/#getting_started/channel',
|
set(
|
||||||
},
|
:css => '.js-intro input[name="realname"]',
|
||||||
{
|
:value => account[:realname],
|
||||||
:execute => 'click',
|
)
|
||||||
:css => '.js-channel .email .provider_name',
|
set(
|
||||||
},
|
:css => '.js-intro input[name="email"]',
|
||||||
{
|
:value => account[:email],
|
||||||
:execute => 'set',
|
)
|
||||||
:css => '.js-intro input[name="realname"]',
|
set(
|
||||||
:value => account[:realname],
|
:css => '.js-intro input[name="password"]',
|
||||||
},
|
:value => account[:password],
|
||||||
{
|
)
|
||||||
:execute => 'set',
|
click(
|
||||||
:css => '.js-intro input[name="email"]',
|
:css => '.js-intro .btn--primary',
|
||||||
:value => account[:email],
|
)
|
||||||
},
|
watch_for(
|
||||||
{
|
:css => 'body',
|
||||||
:execute => 'set',
|
:value => 'verify',
|
||||||
:css => '.js-intro input[name="password"]',
|
:timeout => 20,
|
||||||
:value => account[:password],
|
)
|
||||||
},
|
watch_for(
|
||||||
{
|
:css => 'body',
|
||||||
:execute => 'click',
|
:value => 'invite',
|
||||||
:css => '.js-intro .btn--primary',
|
:timeout => 100,
|
||||||
},
|
)
|
||||||
{
|
location_check(
|
||||||
:execute => 'watch_for',
|
:url => '#getting_started/agents',
|
||||||
:area => 'body',
|
)
|
||||||
:value => 'verify',
|
|
||||||
:timeout => 20,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => 'body',
|
|
||||||
:value => 'invite',
|
|
||||||
:timeout => 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'check',
|
|
||||||
:element => :url,
|
|
||||||
:result => '#getting_started/agents',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -339,98 +254,78 @@ class AaaGettingStartedTest < TestCase
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@browser = browser_instance
|
||||||
|
login(
|
||||||
|
:username => 'master@example.com',
|
||||||
|
:password => 'test',
|
||||||
|
:url => browser_url,
|
||||||
|
)
|
||||||
accounts.each {|account|
|
accounts.each {|account|
|
||||||
tests = [
|
|
||||||
{
|
# getting started - manual mail
|
||||||
:name => 'getting started - manual mail',
|
location( :url => browser_url + '/#getting_started/channel' )
|
||||||
:action => [
|
|
||||||
{
|
click(
|
||||||
:execute => 'navigate',
|
:css => '.js-channel .email .provider_name',
|
||||||
:to => browser_url + '/#getting_started/channel',
|
)
|
||||||
},
|
set(
|
||||||
{
|
:css => '.js-intro input[name="realname"]',
|
||||||
:execute => 'click',
|
:value => account[:realname],
|
||||||
:css => '.js-channel .email .provider_name',
|
)
|
||||||
},
|
set(
|
||||||
{
|
:css => '.js-intro input[name="email"]',
|
||||||
:execute => 'set',
|
:value => account[:email],
|
||||||
:css => '.js-intro input[name="realname"]',
|
)
|
||||||
:value => account[:realname],
|
set(
|
||||||
},
|
:css => '.js-intro input[name="password"]',
|
||||||
{
|
:value => account[:password],
|
||||||
:execute => 'set',
|
)
|
||||||
:css => '.js-intro input[name="email"]',
|
click(
|
||||||
:value => account[:email],
|
:css => '.js-intro .btn--primary',
|
||||||
},
|
)
|
||||||
{
|
watch_for(
|
||||||
:execute => 'set',
|
:css => '.js-inbound h2',
|
||||||
:css => '.js-intro input[name="password"]',
|
:value => 'inbound',
|
||||||
:value => account[:password],
|
:timeout => 220,
|
||||||
},
|
)
|
||||||
{
|
watch_for(
|
||||||
:execute => 'click',
|
:css => '.js-inbound',
|
||||||
:css => '.js-intro .btn--primary',
|
:value => 'manual',
|
||||||
},
|
)
|
||||||
{
|
set(
|
||||||
:execute => 'watch_for',
|
:css => '.js-inbound input[name="options::host"]',
|
||||||
:area => '.js-inbound h2',
|
:value => account[:inbound]['options::host'],
|
||||||
:value => 'inbound',
|
)
|
||||||
:timeout => 220,
|
click(
|
||||||
},
|
:css => '.js-inbound .btn--primary',
|
||||||
{
|
)
|
||||||
:execute => 'watch_for',
|
watch_for(
|
||||||
:area => '.js-inbound',
|
:css => '.js-outbound h2',
|
||||||
:value => 'manual',
|
:value => 'outbound',
|
||||||
},
|
)
|
||||||
{
|
select(
|
||||||
:execute => 'set',
|
:css => '.js-outbound select[name="adapter"]',
|
||||||
:css => '.js-inbound input[name="options::host"]',
|
:value => 'SMTP - configure your own outgoing SMTP settings',
|
||||||
:value => account[:inbound]['options::host'],
|
)
|
||||||
},
|
set(
|
||||||
{
|
:css => '.js-outbound input[name="options::host"]',
|
||||||
:execute => 'click',
|
:value => account[:outbound]['options::host'],
|
||||||
:css => '.js-inbound .btn--primary',
|
)
|
||||||
},
|
click(
|
||||||
{
|
:css => '.js-outbound .btn--primary',
|
||||||
:execute => 'watch_for',
|
)
|
||||||
:area => '.js-outbound h2',
|
watch_for(
|
||||||
:value => 'outbound',
|
:css => 'body',
|
||||||
},
|
:value => 'verify',
|
||||||
{
|
)
|
||||||
:execute => 'select',
|
watch_for(
|
||||||
:css => '.js-outbound select[name="adapter"]',
|
:css => 'body',
|
||||||
:value => 'SMTP - configure your own outgoing SMTP settings',
|
:value => 'invite',
|
||||||
},
|
:timeout => 190,
|
||||||
{
|
)
|
||||||
:execute => 'set',
|
location_check(
|
||||||
:css => '.js-outbound input[name="options::host"]',
|
:url => '#getting_started/agents',
|
||||||
:value => account[:outbound]['options::host'],
|
)
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.js-outbound .btn--primary',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => 'body',
|
|
||||||
:value => 'verify',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'watch_for',
|
|
||||||
:area => 'body',
|
|
||||||
:value => 'invite',
|
|
||||||
:timeout => 190,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'check',
|
|
||||||
:element => :url,
|
|
||||||
:result => '#getting_started/agents',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -3,6 +3,7 @@ require 'browser_test_helper'
|
||||||
|
|
||||||
class AgentTicketActionLevel5Test < TestCase
|
class AgentTicketActionLevel5Test < TestCase
|
||||||
def test_agent_signature_check
|
def test_agent_signature_check
|
||||||
|
|
||||||
suffix = rand(99999999999999999).to_s
|
suffix = rand(99999999999999999).to_s
|
||||||
signature_name1 = 'sig name 1 äöüß ' + suffix
|
signature_name1 = 'sig name 1 äöüß ' + suffix
|
||||||
signature_body1 = "--\nsig body 1 äöüß " + suffix
|
signature_body1 = "--\nsig body 1 äöüß " + suffix
|
||||||
|
@ -12,351 +13,290 @@ class AgentTicketActionLevel5Test < TestCase
|
||||||
group_name2 = "group name 2 " + suffix
|
group_name2 = "group name 2 " + suffix
|
||||||
group_name3 = "group name 3 " + suffix
|
group_name3 = "group name 3 " + suffix
|
||||||
|
|
||||||
tests = [
|
@browser = browser_instance
|
||||||
{
|
login(
|
||||||
:name => 'create groups and signatures',
|
:username => 'master@example.com',
|
||||||
:action => [
|
:password => 'test',
|
||||||
|
:url => browser_url,
|
||||||
|
)
|
||||||
|
tasks_close_all()
|
||||||
|
|
||||||
{
|
#
|
||||||
:execute => 'close_all_tasks',
|
# create groups and signatures
|
||||||
},
|
#
|
||||||
|
|
||||||
# create signatures
|
# create signatures
|
||||||
{
|
signature_create(
|
||||||
:execute => 'create_signature',
|
:data => {
|
||||||
:name => signature_name1,
|
:name => signature_name1,
|
||||||
:body => signature_body1,
|
:body => signature_body1,
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'create_signature',
|
|
||||||
:name => signature_name2,
|
|
||||||
:body => signature_body2,
|
|
||||||
},
|
|
||||||
|
|
||||||
# create groups
|
|
||||||
{
|
|
||||||
:execute => 'create_group',
|
|
||||||
:name => group_name1,
|
|
||||||
:signature => signature_name1,
|
|
||||||
:member => [
|
|
||||||
'master@example.com'
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'create_group',
|
|
||||||
:name => group_name2,
|
|
||||||
:signature => signature_name2,
|
|
||||||
:member => [
|
|
||||||
'master@example.com'
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'create_group',
|
|
||||||
:name => group_name3,
|
|
||||||
:member => [
|
|
||||||
'master@example.com'
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
)
|
||||||
:name => 'check signature in new ticket',
|
signature_create(
|
||||||
:action => [
|
:data => {
|
||||||
|
:name => signature_name2,
|
||||||
# reload instances to get new group permissions
|
:body => signature_body2,
|
||||||
{
|
|
||||||
:execute => 'reload',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
:execute => 'create_ticket',
|
|
||||||
:group => 'Users',
|
|
||||||
:subject => 'some subject 4 - 123äöü',
|
|
||||||
:body => 'some body 4 - 123äöü',
|
|
||||||
:do_not_submit => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# select group
|
|
||||||
{
|
|
||||||
:execute => 'select',
|
|
||||||
:css => '.active [name="group_id"]',
|
|
||||||
:value => group_name1,
|
|
||||||
},
|
|
||||||
|
|
||||||
# select group
|
|
||||||
{
|
|
||||||
:execute => 'select',
|
|
||||||
:css => '.active [name="group_id"]',
|
|
||||||
:value => group_name1,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check signature
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
|
|
||||||
# select create channel
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.active [data-type="email-out"]',
|
|
||||||
},
|
|
||||||
|
|
||||||
# select group
|
|
||||||
{
|
|
||||||
:execute => 'select',
|
|
||||||
:css => '.active select[name="group_id"]',
|
|
||||||
:value => group_name1,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check signature
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
|
|
||||||
# select group
|
|
||||||
{
|
|
||||||
:execute => 'select',
|
|
||||||
:css => '.active select[name="group_id"]',
|
|
||||||
:value => group_name2,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check signature
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# select group
|
|
||||||
{
|
|
||||||
:execute => 'select',
|
|
||||||
:css => '.active select[name="group_id"]',
|
|
||||||
:value => group_name3,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check signature
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
# select group
|
|
||||||
{
|
|
||||||
:execute => 'select',
|
|
||||||
:css => '.active select[name="group_id"]',
|
|
||||||
:value => group_name1,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check signature
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
|
|
||||||
# select create channel
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.active [data-type="phone-out"]',
|
|
||||||
},
|
|
||||||
|
|
||||||
# check content
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => 'some body 4',
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check signature
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
)
|
||||||
:name => 'check signature in zoom ticket',
|
|
||||||
:action => [
|
|
||||||
|
|
||||||
{
|
|
||||||
:execute => 'create_ticket',
|
|
||||||
:group => group_name1,
|
|
||||||
:subject => 'some subject 5 - 123äöü',
|
|
||||||
:body => 'some body 5 - 123äöü',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 3,
|
|
||||||
},
|
|
||||||
|
|
||||||
# execute reply
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.active [data-type="reply"]',
|
|
||||||
},
|
|
||||||
|
|
||||||
# check if signature exists
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
|
|
||||||
# discard changes
|
|
||||||
{
|
|
||||||
:execute => 'click',
|
|
||||||
:css => '.active .js-reset',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 3,
|
|
||||||
},
|
|
||||||
|
|
||||||
# check if signature exists
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body1,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
:execute => 'match',
|
|
||||||
:css => '.active [data-name="body"]',
|
|
||||||
:value => signature_body2,
|
|
||||||
:no_quote => true,
|
|
||||||
:match_result => false,
|
|
||||||
},
|
|
||||||
|
|
||||||
|
# create groups
|
||||||
|
group_create(
|
||||||
|
:data => {
|
||||||
|
:name => group_name1,
|
||||||
|
:signature => signature_name1,
|
||||||
|
:member => [
|
||||||
|
'master@example.com'
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
group_create(
|
||||||
|
:data => {
|
||||||
|
:name => group_name2,
|
||||||
|
:signature => signature_name2,
|
||||||
|
:member => [
|
||||||
|
'master@example.com'
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
group_create(
|
||||||
|
:data => {
|
||||||
|
:name => group_name3,
|
||||||
|
:member => [
|
||||||
|
'master@example.com'
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# check signature in new ticket
|
||||||
|
#
|
||||||
|
|
||||||
|
# reload instances to get new group permissions
|
||||||
|
reload()
|
||||||
|
|
||||||
|
# create ticket
|
||||||
|
ticket_create(
|
||||||
|
:data => {
|
||||||
|
:customer => 'nicole',
|
||||||
|
:group => 'Users',
|
||||||
|
:title => 'some subject 5 - 123äöü',
|
||||||
|
:body => 'some body 5 - 123äöü',
|
||||||
},
|
},
|
||||||
]
|
:do_not_submit => true,
|
||||||
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
|
)
|
||||||
|
|
||||||
|
# select group
|
||||||
|
select(
|
||||||
|
:css => '.active [name="group_id"]',
|
||||||
|
:value => group_name1,
|
||||||
|
)
|
||||||
|
|
||||||
|
# check content
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => 'some body 5',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check signature
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# select create channel
|
||||||
|
click(
|
||||||
|
:css => '.active [data-type="email-out"]',
|
||||||
|
)
|
||||||
|
|
||||||
|
# group 1 is still selected
|
||||||
|
|
||||||
|
# check content
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => 'some body 5',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check signature
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# select group
|
||||||
|
select(
|
||||||
|
:css => '.active [name="group_id"]',
|
||||||
|
:value => group_name2,
|
||||||
|
)
|
||||||
|
|
||||||
|
# check content
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => 'some body 5',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check signature
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
# select group
|
||||||
|
select(
|
||||||
|
:css => '.active [name="group_id"]',
|
||||||
|
:value => group_name3,
|
||||||
|
)
|
||||||
|
|
||||||
|
# check content
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => 'some body 5',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check signature
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
# select group
|
||||||
|
select(
|
||||||
|
:css => '.active [name="group_id"]',
|
||||||
|
:value => group_name1,
|
||||||
|
)
|
||||||
|
|
||||||
|
# check content
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => 'some body 5',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check signature
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
# select create channel
|
||||||
|
click(
|
||||||
|
:css => '.active [data-type="phone-out"]',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check content
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => 'some body 5',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check signature
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# check signature in zoom ticket
|
||||||
|
#
|
||||||
|
ticket_create(
|
||||||
|
:data => {
|
||||||
|
:customer => 'nicole',
|
||||||
|
:group => group_name1,
|
||||||
|
:title => 'some subject 5/2 - 123äöü',
|
||||||
|
:body => 'some body 5/2 - 123äöü',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# execute reply
|
||||||
|
click(
|
||||||
|
:css => '.active [data-type="reply"]',
|
||||||
|
)
|
||||||
|
|
||||||
|
# check if signature exists
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
|
=begin
|
||||||
|
# update group2
|
||||||
|
select(
|
||||||
|
:css => '.active [name="group_id"]',
|
||||||
|
:value => group_name2,
|
||||||
|
)
|
||||||
|
|
||||||
|
# check if signature exists
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
=end
|
||||||
|
|
||||||
|
# discard changes
|
||||||
|
click(
|
||||||
|
:css => '.active .js-reset',
|
||||||
|
)
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# check if signature exists
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body1,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
:css => '.active [data-name="body"]',
|
||||||
|
:value => signature_body2,
|
||||||
|
:no_quote => true,
|
||||||
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -18,22 +18,22 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
:data => {
|
:data => {
|
||||||
:customer => 'nico*',
|
:customer => 'nico*',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:title => 'overview count test #2',
|
:title => 'overview count test #1',
|
||||||
:body => 'overview count test #2',
|
:body => 'overview count test #1',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ticket2 = ticket_create(
|
ticket2 = ticket_create(
|
||||||
:data => {
|
:data => {
|
||||||
:customer => 'nico*',
|
:customer => 'nico*',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:title => 'overview count test #3',
|
:title => 'overview count test #2',
|
||||||
:body => 'overview count test #3',
|
:body => 'overview count test #2',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
sleep 6 # till overview is updated
|
sleep 6 # till overview is updated
|
||||||
click( :css => '#navigation li.overviews a' )
|
click( :css => '#navigation li.overviews a' )
|
||||||
click( :css => '.content.active .sidebar a[href="#ticket/view/all_unassigned"]' )
|
click( :css => '.content.active .sidebar a[href="#ticket/view/all_unassigned"]' )
|
||||||
sleep 2 # till overview is rendered
|
sleep 4 # till overview is rendered
|
||||||
|
|
||||||
# select both via bulk action
|
# select both via bulk action
|
||||||
click(
|
click(
|
||||||
|
@ -62,7 +62,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
click(
|
click(
|
||||||
:css => '.active .bulkAction .js-submit',
|
:css => '.active .bulkAction .js-submit',
|
||||||
)
|
)
|
||||||
sleep 8
|
sleep 6
|
||||||
|
|
||||||
exists_not(
|
exists_not(
|
||||||
:css => '.active table tr td input[value="' + ticket1[:id] + '"]',
|
:css => '.active table tr td input[value="' + ticket1[:id] + '"]',
|
||||||
|
@ -85,11 +85,23 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
check(
|
check(
|
||||||
:css => '.modal input[value="number"]',
|
:css => '.modal input[value="number"]',
|
||||||
)
|
)
|
||||||
|
check(
|
||||||
|
:css => '.modal input[value="title"]',
|
||||||
|
)
|
||||||
|
check(
|
||||||
|
:css => '.modal input[value="customer"]',
|
||||||
|
)
|
||||||
|
check(
|
||||||
|
:css => '.modal input[value="group"]',
|
||||||
|
)
|
||||||
|
check(
|
||||||
|
:css => '.modal input[value="created_at"]',
|
||||||
|
)
|
||||||
check(
|
check(
|
||||||
:css => '.modal input[value="article_count"]',
|
:css => '.modal input[value="article_count"]',
|
||||||
)
|
)
|
||||||
click( :css => '.modal .js-submit' )
|
click( :css => '.modal .js-submit' )
|
||||||
sleep 2
|
sleep 10
|
||||||
|
|
||||||
# check if number and article count is shown
|
# check if number and article count is shown
|
||||||
match(
|
match(
|
||||||
|
@ -103,6 +115,7 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
|
|
||||||
# reload browser
|
# reload browser
|
||||||
reload()
|
reload()
|
||||||
|
sleep 4
|
||||||
|
|
||||||
# check if number and article count is shown
|
# check if number and article count is shown
|
||||||
match(
|
match(
|
||||||
|
@ -144,8 +157,8 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
:data => {
|
:data => {
|
||||||
:customer => 'nico*',
|
:customer => 'nico*',
|
||||||
:group => 'Users',
|
:group => 'Users',
|
||||||
:title => 'overview count test #1',
|
:title => 'overview count test #3',
|
||||||
:body => 'overview count test #1',
|
:body => 'overview count test #3',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
sleep 8
|
sleep 8
|
||||||
|
@ -171,5 +184,8 @@ class AgentTicketOverviewLevel0Test < TestCase
|
||||||
# get current overview count
|
# get current overview count
|
||||||
overview_counter_after = overview_counter()
|
overview_counter_after = overview_counter()
|
||||||
assert_equal( overview_counter_before['#ticket/view/all_unassigned'], overview_counter_after['#ticket/view/all_unassigned'] )
|
assert_equal( overview_counter_before['#ticket/view/all_unassigned'], overview_counter_after['#ticket/view/all_unassigned'] )
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
tasks_close_all()
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -379,7 +379,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def match(params)
|
def match(params, fallback = false)
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
element = instance.find_elements( { :css => params[:css] } )[0]
|
element = instance.find_elements( { :css => params[:css] } )[0]
|
||||||
|
|
||||||
|
@ -418,13 +418,8 @@ class TestCase < Test::Unit::TestCase
|
||||||
rescue
|
rescue
|
||||||
|
|
||||||
# just try again
|
# just try again
|
||||||
element = instance.find_elements( { :css => params[:css] } )[0]
|
if !fallback
|
||||||
if params[:attribute]
|
return match(params, true)
|
||||||
text = element.attribute( params[:attribute] )
|
|
||||||
elsif params[:css] =~ /(input|textarea)/i
|
|
||||||
text = element.attribute('value')
|
|
||||||
else
|
|
||||||
text = element.text
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
match = false
|
match = false
|
||||||
|
@ -554,16 +549,23 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def verify_task(params = {})
|
def verify_task(params = {}, fallback = false)
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
data = params[:data]
|
data = params[:data]
|
||||||
|
|
||||||
if data[:title]
|
begin
|
||||||
title = instance.find_elements( { :css => '.tasks .active' } )[0].text.strip
|
if data[:title]
|
||||||
if title =~ /#{data[:title]}/i
|
title = instance.find_elements( { :css => '.tasks .active' } )[0].text.strip
|
||||||
assert( true, "matching '#{data[:title]}' in title '#{title}'" )
|
if title =~ /#{data[:title]}/i
|
||||||
else
|
assert( true, "matching '#{data[:title]}' in title '#{title}'" )
|
||||||
raise "not matching '#{data[:title]}' in title '#{title}'"
|
else
|
||||||
|
raise "not matching '#{data[:title]}' in title '#{title}'"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
# just try again
|
||||||
|
if !fallback
|
||||||
|
verify_task(params, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
|
@ -906,23 +908,26 @@ wait untill text in selector disabppears
|
||||||
#instance.execute_script( '$(".content.active .newTicket form").submit();' )
|
#instance.execute_script( '$(".content.active .newTicket form").submit();' )
|
||||||
instance.find_elements( { :css => '.active .newTicket button.submit' } )[0].click
|
instance.find_elements( { :css => '.active .newTicket button.submit' } )[0].click
|
||||||
sleep 1
|
sleep 1
|
||||||
(1..16).each {|loop|
|
(1..8).each {|loop|
|
||||||
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
|
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
|
||||||
assert( true, "ticket created" )
|
assert( true, "ticket created" )
|
||||||
sleep 0.5
|
sleep 2.5
|
||||||
id = instance.current_url
|
id = instance.current_url
|
||||||
id.gsub!(//, )
|
id.gsub!(//, )
|
||||||
id.gsub!(/^.+?\/(\d+)$/, "\\1")
|
id.gsub!(/^.+?\/(\d+)$/, "\\1")
|
||||||
|
|
||||||
number = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text
|
element = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0]
|
||||||
ticket = {
|
if element
|
||||||
:id => id,
|
number = element.text
|
||||||
:number => number,
|
ticket = {
|
||||||
}
|
:id => id,
|
||||||
sleep 1
|
:number => number,
|
||||||
return ticket
|
}
|
||||||
|
sleep 1
|
||||||
|
return ticket
|
||||||
|
end
|
||||||
end
|
end
|
||||||
sleep 0.5
|
sleep 1
|
||||||
}
|
}
|
||||||
raise "ticket creation failed, can't get zoom url"
|
raise "ticket creation failed, can't get zoom url"
|
||||||
end
|
end
|
||||||
|
@ -1394,6 +1399,115 @@ wait untill text in selector disabppears
|
||||||
raise "text module creation failed"
|
raise "text module creation failed"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
signature_create(
|
||||||
|
:browser => browser2,
|
||||||
|
:data => {
|
||||||
|
:name => 'some sla' + random,
|
||||||
|
:body => 'some body',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def signature_create(params = {})
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
data = params[:data]
|
||||||
|
|
||||||
|
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
||||||
|
instance.find_elements( { :css => 'a[href="#channels/email"]' } )[0].click
|
||||||
|
instance.find_elements( { :css => 'a[href="#c-signature"]' } )[0].click
|
||||||
|
sleep 8
|
||||||
|
instance.find_elements( { :css => '#content #c-signature a[data-type="new"]' } )[0].click
|
||||||
|
sleep 2
|
||||||
|
element = instance.find_elements( { :css => '.modal input[name=name]' } )[0]
|
||||||
|
element.clear
|
||||||
|
element.send_keys( data[:name] )
|
||||||
|
element = instance.find_elements( { :css => '.modal textarea[name=body]' } )[0]
|
||||||
|
element.clear
|
||||||
|
element.send_keys( data[:body] )
|
||||||
|
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
||||||
|
(1..12).each {|loop|
|
||||||
|
element = instance.find_elements( { :css => 'body' } )[0]
|
||||||
|
text = element.text
|
||||||
|
if text =~ /#{Regexp.quote(data[:name])}/
|
||||||
|
assert( true, "signature created" )
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
raise "signature creation failed"
|
||||||
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
group_create(
|
||||||
|
:browser => browser2,
|
||||||
|
:data => {
|
||||||
|
:name => 'some sla' + random,
|
||||||
|
:signature => 'some signature bame',
|
||||||
|
:member => [
|
||||||
|
'some_user_login',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def group_create(params = {})
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
data = params[:data]
|
||||||
|
|
||||||
|
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
||||||
|
instance.find_elements( { :css => 'a[href="#manage/groups"]' } )[0].click
|
||||||
|
sleep 2
|
||||||
|
instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click
|
||||||
|
sleep 2
|
||||||
|
element = instance.find_elements( { :css => '.modal input[name=name]' } )[0]
|
||||||
|
element.clear
|
||||||
|
element.send_keys( data[:name] )
|
||||||
|
element = instance.find_elements( { :css => '.modal select[name="email_address_id"]' } )[0]
|
||||||
|
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||||
|
dropdown.select_by( :index, 1 )
|
||||||
|
#dropdown.select_by( :text, action[:group])
|
||||||
|
if data[:signature]
|
||||||
|
element = instance.find_elements( { :css => '.modal select[name="signature_id"]' } )[0]
|
||||||
|
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||||
|
dropdown.select_by( :text, data[:signature])
|
||||||
|
end
|
||||||
|
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
||||||
|
(1..12).each {|loop|
|
||||||
|
element = instance.find_elements( { :css => 'body' } )[0]
|
||||||
|
text = element.text
|
||||||
|
if text =~ /#{Regexp.quote(data[:name])}/
|
||||||
|
assert( true, "group created" )
|
||||||
|
|
||||||
|
# add member
|
||||||
|
if data[:member]
|
||||||
|
data[:member].each {|login|
|
||||||
|
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
||||||
|
instance.find_elements( { :css => 'a[href="#manage/users"]' } )[0].click
|
||||||
|
sleep 2
|
||||||
|
element = instance.find_elements( { :css => '#content [name="search"]' } )[0]
|
||||||
|
element.clear
|
||||||
|
element.send_keys( login )
|
||||||
|
sleep 2
|
||||||
|
#instance.find_elements( { :css => '#content table [data-id]' } )[0].click
|
||||||
|
instance.execute_script( '$("#content table [data-id] td").first().click()' )
|
||||||
|
sleep 2
|
||||||
|
#instance.find_elements( { :css => 'label:contains(" ' + action[:name] + '")' } )[0].click
|
||||||
|
instance.execute_script( '$(\'label:contains(" ' + data[:name] + '")\').first().click()' )
|
||||||
|
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sleep 1
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
raise "group creation failed"
|
||||||
|
end
|
||||||
|
|
||||||
def quote(string)
|
def quote(string)
|
||||||
string_quoted = string
|
string_quoted = string
|
||||||
string_quoted.gsub!(/&/, '&')
|
string_quoted.gsub!(/&/, '&')
|
||||||
|
@ -1402,645 +1516,4 @@ wait untill text in selector disabppears
|
||||||
string_quoted
|
string_quoted
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add more helper methods to be used by all tests here...
|
end
|
||||||
def browser_login(data)
|
|
||||||
all_tests = [
|
|
||||||
{
|
|
||||||
:name => 'login',
|
|
||||||
:instance => data[:instance] || browser_instance,
|
|
||||||
:url => data[:url] || browser_url,
|
|
||||||
:action => [
|
|
||||||
{
|
|
||||||
:execute => 'login',
|
|
||||||
:username => data[:username] || 'nicole.braun@zammad.org',
|
|
||||||
:password => data[:password] || 'test'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
return all_tests
|
|
||||||
end
|
|
||||||
|
|
||||||
def browser_signle_test_with_login(tests, login = {})
|
|
||||||
all_tests = browser_login( login )
|
|
||||||
all_tests = all_tests.concat( tests )
|
|
||||||
browser_single_test(all_tests)
|
|
||||||
end
|
|
||||||
|
|
||||||
def browser_double_test(tests)
|
|
||||||
instance1 = browser_single_test( browser_login({
|
|
||||||
:instance => tests[0][:instance1],
|
|
||||||
:username => tests[0][:instance1_username],
|
|
||||||
:password => tests[0][:instance1_password],
|
|
||||||
:url => tests[0][:url],
|
|
||||||
}), true )
|
|
||||||
instance2 = browser_single_test( browser_login({
|
|
||||||
:instance => tests[0][:instance2],
|
|
||||||
:username => tests[0][:instance2_username],
|
|
||||||
:password => tests[0][:instance2_password],
|
|
||||||
:url => tests[0][:url],
|
|
||||||
}), true )
|
|
||||||
tests.each { |test|
|
|
||||||
if test[:action]
|
|
||||||
test[:action].each { |action|
|
|
||||||
|
|
||||||
# wait
|
|
||||||
if action[:execute] == 'wait'
|
|
||||||
sleep action[:value]
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
# ignore no browser defined action
|
|
||||||
next if !action[:where]
|
|
||||||
|
|
||||||
# set current browser
|
|
||||||
if action[:where] == :instance1
|
|
||||||
instance = instance1
|
|
||||||
else
|
|
||||||
instance = instance2
|
|
||||||
end
|
|
||||||
browser_element_action(test, action, instance)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
browser_instance_close(instance1)
|
|
||||||
browser_instance_close(instance2)
|
|
||||||
end
|
|
||||||
|
|
||||||
def browser_single_test(tests, keep_connection = false)
|
|
||||||
instance = nil
|
|
||||||
@stack = nil
|
|
||||||
tests.each { |test|
|
|
||||||
if test[:instance]
|
|
||||||
instance = test[:instance]
|
|
||||||
end
|
|
||||||
if test[:url]
|
|
||||||
instance.get( test[:url] )
|
|
||||||
end
|
|
||||||
if test[:action]
|
|
||||||
test[:action].each { |action|
|
|
||||||
if action[:execute] == 'wait'
|
|
||||||
sleep action[:value]
|
|
||||||
next
|
|
||||||
end
|
|
||||||
browser_element_action(test, action, instance)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
if keep_connection
|
|
||||||
return instance
|
|
||||||
end
|
|
||||||
browser_instance_close(instance)
|
|
||||||
end
|
|
||||||
|
|
||||||
def browser_element_action(test, action, instance)
|
|
||||||
puts "NOTICE #{Time.now.to_s}: " + action.inspect
|
|
||||||
if action[:execute] !~ /accept|dismiss/i
|
|
||||||
#cookies = instance.manage.all_cookies
|
|
||||||
#cookies.each {|cookie|
|
|
||||||
# puts " COOKIE " + cookie.to_s
|
|
||||||
#}
|
|
||||||
end
|
|
||||||
|
|
||||||
sleep 0.1
|
|
||||||
if action[:css]
|
|
||||||
if action[:css].match '###stack###'
|
|
||||||
action[:css].gsub! '###stack###', @stack
|
|
||||||
end
|
|
||||||
begin
|
|
||||||
if action[:range] == 'all'
|
|
||||||
element = instance.find_elements( { :css => action[:css] } )
|
|
||||||
else
|
|
||||||
element = instance.find_element( { :css => action[:css] } )
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
element = nil
|
|
||||||
end
|
|
||||||
if action[:result] == false
|
|
||||||
assert( !element, "(#{test[:name]}) Element with css '#{action[:css]}' exists" )
|
|
||||||
else
|
|
||||||
assert( element, "(#{test[:name]}) Element with css '#{action[:css]}' doesn't exist" )
|
|
||||||
end
|
|
||||||
elsif action[:element] == :url
|
|
||||||
if instance.current_url =~ /#{Regexp.quote(action[:result])}/
|
|
||||||
assert( true, "(#{test[:name]}) url #{instance.current_url} is matching #{action[:result]}" )
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) url #{instance.current_url} is not matching #{action[:result]}" )
|
|
||||||
end
|
|
||||||
elsif action[:element] == :title
|
|
||||||
title = instance.title
|
|
||||||
if title =~ /#{action[:value]}/i
|
|
||||||
assert( true, "(#{test[:name]}) matching '#{action[:value]}' in title '#{title}'" )
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) not matching '#{action[:value]}' in title '#{title}'" )
|
|
||||||
end
|
|
||||||
return
|
|
||||||
elsif action[:element] == :alert
|
|
||||||
element = instance.switch_to.alert
|
|
||||||
elsif action[:execute] == 'login'
|
|
||||||
element = instance.find_elements( { :css => '#login input[name="username"]' } )[0]
|
|
||||||
if !element
|
|
||||||
assert( false, "(#{test[:name]}) no login box found!" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:username] )
|
|
||||||
element = instance.find_elements( { :css => '#login input[name="password"]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:password] )
|
|
||||||
if action[:remember_me]
|
|
||||||
instance.find_elements( { :css => '#login [name="remember_me"]' } )[0].click
|
|
||||||
end
|
|
||||||
instance.find_elements( { :css => '#login button' } )[0].click
|
|
||||||
sleep 4
|
|
||||||
login = instance.find_elements( { :css => '.user-menu .user a' } )[0].attribute('title')
|
|
||||||
if login != action[:username]
|
|
||||||
assert( false, "(#{test[:name]}) login failed" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
assert( true, "(#{test[:name]}) login success" )
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'logout'
|
|
||||||
instance.find_elements( { :css => 'a[href="#current_user"]' } )[0].click
|
|
||||||
sleep 0.1
|
|
||||||
instance.find_elements( { :css => 'a[href="#logout"]' } )[0].click
|
|
||||||
(1..6).each {|loop|
|
|
||||||
login = instance.find_elements( { :css => '#login' } )[0]
|
|
||||||
if login
|
|
||||||
assert( true, "(#{test[:name]}) logout" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
}
|
|
||||||
assert( false, "(#{test[:name]}) no login box found!" )
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'watch_for'
|
|
||||||
timeout = 16
|
|
||||||
if action[:timeout]
|
|
||||||
timeout = action[:timeout]
|
|
||||||
end
|
|
||||||
loops = (timeout).to_i
|
|
||||||
text = ''
|
|
||||||
(1..loops).each { |loop|
|
|
||||||
element = instance.find_elements( { :css => action[:area] } )[0]
|
|
||||||
if element #&& element.displayed?
|
|
||||||
begin
|
|
||||||
text = element.text
|
|
||||||
if text =~ /#{action[:value]}/i
|
|
||||||
assert( true, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
# just try again
|
|
||||||
end
|
|
||||||
end
|
|
||||||
sleep 1
|
|
||||||
}
|
|
||||||
assert( false, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'watch_for_disappear'
|
|
||||||
timeout = 16
|
|
||||||
if action[:timeout]
|
|
||||||
timeout = action[:timeout]
|
|
||||||
end
|
|
||||||
loops = (timeout / 2).to_i
|
|
||||||
text = ''
|
|
||||||
(1..loops).each { |loop|
|
|
||||||
element = instance.find_elements( { :css => action[:area] } )[0]
|
|
||||||
if !element #|| element.displayed?
|
|
||||||
assert( true, "(#{test[:name]}) not found" )
|
|
||||||
sleep 0.2
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 2
|
|
||||||
}
|
|
||||||
assert( false, "(#{test[:name]} / #{test[:area]}) still exsists" )
|
|
||||||
return
|
|
||||||
|
|
||||||
# create user
|
|
||||||
elsif action[:execute] == 'create_user'
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage/users"]' } )[0].click
|
|
||||||
sleep 2
|
|
||||||
instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click
|
|
||||||
sleep 2
|
|
||||||
#element = instance.find_element( { :css => '.modal input[name=login]' } )
|
|
||||||
#element.clear
|
|
||||||
#element.send_keys( action[:login] )
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=firstname]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:firstname] )
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=lastname]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:lastname] )
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=email]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:email] )
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=password]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:password] )
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=password_confirm]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:password] )
|
|
||||||
instance.find_elements( { :css => '.modal input[name="role_ids"][value="3"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
|
||||||
(1..14).each {|loop|
|
|
||||||
element = instance.find_elements( { :css => 'body' } )[0]
|
|
||||||
text = element.text
|
|
||||||
if text =~ /#{Regexp.quote(action[:lastname])}/
|
|
||||||
assert( true, "(#{test[:name]}) user created" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 0.5
|
|
||||||
}
|
|
||||||
assert( true, "(#{test[:name]}) user creation failed" )
|
|
||||||
return
|
|
||||||
|
|
||||||
# create signature
|
|
||||||
elsif action[:execute] == 'create_signature'
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => 'a[href="#channels/email"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => 'a[href="#c-signature"]' } )[0].click
|
|
||||||
sleep 8
|
|
||||||
instance.find_elements( { :css => '#content #c-signature a[data-type="new"]' } )[0].click
|
|
||||||
sleep 2
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=name]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:name] )
|
|
||||||
element = instance.find_elements( { :css => '.modal textarea[name=body]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:body] )
|
|
||||||
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
|
||||||
(1..12).each {|loop|
|
|
||||||
element = instance.find_elements( { :css => 'body' } )[0]
|
|
||||||
text = element.text
|
|
||||||
if text =~ /#{Regexp.quote(action[:name])}/
|
|
||||||
assert( true, "(#{test[:name]}) signature created" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 1
|
|
||||||
}
|
|
||||||
assert( true, "(#{test[:name]}) signature creation failed" )
|
|
||||||
return
|
|
||||||
|
|
||||||
# create group
|
|
||||||
elsif action[:execute] == 'create_group'
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage/groups"]' } )[0].click
|
|
||||||
sleep 2
|
|
||||||
instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click
|
|
||||||
sleep 2
|
|
||||||
element = instance.find_elements( { :css => '.modal input[name=name]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:name] )
|
|
||||||
element = instance.find_elements( { :css => '.modal select[name="email_address_id"]' } )[0]
|
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
|
||||||
dropdown.select_by( :index, 1 )
|
|
||||||
#dropdown.select_by( :text, action[:group])
|
|
||||||
if action[:signature]
|
|
||||||
element = instance.find_elements( { :css => '.modal select[name="signature_id"]' } )[0]
|
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
|
||||||
dropdown.select_by( :text, action[:signature])
|
|
||||||
end
|
|
||||||
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
|
||||||
(1..12).each {|loop|
|
|
||||||
element = instance.find_elements( { :css => 'body' } )[0]
|
|
||||||
text = element.text
|
|
||||||
if text =~ /#{Regexp.quote(action[:name])}/
|
|
||||||
assert( true, "(#{test[:name]}) group created" )
|
|
||||||
|
|
||||||
# add member
|
|
||||||
if action[:member]
|
|
||||||
action[:member].each {|login|
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => 'a[href="#manage/users"]' } )[0].click
|
|
||||||
sleep 2
|
|
||||||
element = instance.find_elements( { :css => '#content [name="search"]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( login )
|
|
||||||
sleep 2
|
|
||||||
#instance.find_elements( { :css => '#content table [data-id]' } )[0].click
|
|
||||||
instance.execute_script( '$("#content table [data-id] td").first().click()' )
|
|
||||||
sleep 2
|
|
||||||
#instance.find_elements( { :css => 'label:contains(" ' + action[:name] + '")' } )[0].click
|
|
||||||
instance.execute_script( '$(\'label:contains(" ' + action[:name] + '")\').first().click()' )
|
|
||||||
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
|
||||||
}
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 1
|
|
||||||
}
|
|
||||||
assert( true, "(#{test[:name]}) group creation failed" )
|
|
||||||
return
|
|
||||||
|
|
||||||
elsif action[:execute] == 'verify_task_attributes'
|
|
||||||
if action[:title]
|
|
||||||
text = instance.find_elements( { :css => '.tasks .active' } )[0].text.strip
|
|
||||||
assert_equal( action[:title], text )
|
|
||||||
end
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'verify_ticket_attributes'
|
|
||||||
if action[:title]
|
|
||||||
text = instance.find_elements( { :css => '.content.active .page-header .ticket-title-update' } )[0].text.strip
|
|
||||||
assert_equal( action[:title], text )
|
|
||||||
end
|
|
||||||
if action[:body]
|
|
||||||
text = instance.find_elements( { :css => '.content.active [data-name="body"]' } )[0].text.strip
|
|
||||||
assert_equal( action[:body], text )
|
|
||||||
end
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'set_ticket_attributes'
|
|
||||||
if action[: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( action[: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("' + action[: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 action[: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( action[:body] )
|
|
||||||
end
|
|
||||||
return
|
|
||||||
|
|
||||||
# create ticket
|
|
||||||
elsif action[:execute] == 'create_ticket'
|
|
||||||
instance.find_elements( { :css => 'a[href="#new"]' } )[0].click
|
|
||||||
instance.find_elements( { :css => 'a[href="#ticket/create"]' } )[0].click
|
|
||||||
element = instance.find_elements( { :css => '.active .newTicket' } )[0]
|
|
||||||
if !element
|
|
||||||
assert( false, "(#{test[:name]}) no ticket create screen found!" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
# check count of agents, should be only 1 / - selection on init screen
|
|
||||||
count = instance.find_elements( { :css => '.active .newTicket select[name="owner_id"] option' } ).count
|
|
||||||
assert_equal( 1, count, 'check if owner selection is empty per default' )
|
|
||||||
|
|
||||||
if action[:group]
|
|
||||||
element = instance.find_elements( { :css => '.active .newTicket select[name="group_id"]' } )[0]
|
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
|
||||||
dropdown.select_by( :text, action[:group])
|
|
||||||
sleep 0.2
|
|
||||||
end
|
|
||||||
if action[:subject]
|
|
||||||
element = instance.find_elements( { :css => '.active .newTicket input[name="title"]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:subject] )
|
|
||||||
sleep 0.2
|
|
||||||
end
|
|
||||||
if action[:body]
|
|
||||||
#instance.execute_script( '$(".active .newTicket div[data-name=body]").focus()' )
|
|
||||||
sleep 0.5
|
|
||||||
element = instance.find_elements( { :css => '.active .newTicket div[data-name=body]' } )[0]
|
|
||||||
element.clear
|
|
||||||
element.send_keys( action[:body] )
|
|
||||||
end
|
|
||||||
if action[:customer] == nil
|
|
||||||
element = instance.find_elements( { :css => '.active .newTicket input[name="customer_id_completion"]' } )[0]
|
|
||||||
element.click
|
|
||||||
element.clear
|
|
||||||
element.send_keys( 'nico*' )
|
|
||||||
sleep 4
|
|
||||||
element.send_keys( :arrow_down )
|
|
||||||
sleep 0.1
|
|
||||||
instance.find_elements( { :css => '.active .newTicket .recipientList-entry.js-user.is-active' } )[0].click
|
|
||||||
sleep 0.3
|
|
||||||
end
|
|
||||||
if action[:do_not_submit]
|
|
||||||
assert( true, "(#{test[:name]}) ticket created without submit" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 0.8
|
|
||||||
#instance.execute_script( '$(".content.active .newTicket form").submit();' )
|
|
||||||
instance.find_elements( { :css => '.active .newTicket button.submit' } )[0].click
|
|
||||||
sleep 1
|
|
||||||
(1..16).each {|loop|
|
|
||||||
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
|
|
||||||
assert( true, "(#{test[:name]}) ticket created" )
|
|
||||||
sleep 1
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sleep 0.5
|
|
||||||
}
|
|
||||||
assert( false, "(#{test[:name]}) ticket creation failed, can't get zoom url" )
|
|
||||||
return
|
|
||||||
|
|
||||||
# search ticket
|
|
||||||
elsif action[:execute] == 'search_ticket'
|
|
||||||
element = instance.find_elements( { :css => '#global-search' } )[0]
|
|
||||||
element.click
|
|
||||||
element.clear
|
|
||||||
action[:number].gsub! '###stack###', @stack
|
|
||||||
element.send_keys( action[:number] )
|
|
||||||
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
|
|
||||||
action[:number].gsub! '###stack###', @stack
|
|
||||||
element.send_keys( action[:number] )
|
|
||||||
sleep 2
|
|
||||||
element = instance.find_element( { :partial_link_text => action[:number] } ).click
|
|
||||||
number = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text
|
|
||||||
if number !~ /#{action[:number]}/
|
|
||||||
assert( false, "(#{test[:name]}) unable to search/find ticket #{action[:number]}!" )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
assert( true, "(#{test[:name]}) ticket #{action[:number]} found" )
|
|
||||||
return
|
|
||||||
|
|
||||||
# close all tasks
|
|
||||||
elsif action[:execute] == 'close_all_tasks'
|
|
||||||
for i in 1..100
|
|
||||||
sleep 1
|
|
||||||
if instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0]
|
|
||||||
instance.mouse.move_to( instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0] )
|
|
||||||
sleep 0.2
|
|
||||||
|
|
||||||
click_element = instance.find_elements( { :css => '.navigation .tasks .task:first-child .js-close' } )[0]
|
|
||||||
if click_element
|
|
||||||
sleep 0.1
|
|
||||||
click_element.click
|
|
||||||
|
|
||||||
# accept task close warning
|
|
||||||
if action[:discard_changes]
|
|
||||||
sleep 1
|
|
||||||
instance.find_elements( { :css => '.modal button.js-submit' } )[0].click
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
assert( true, "(#{test[:name]}) all tasks closed" )
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'navigate'
|
|
||||||
instance.navigate.to( action[:to] )
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'reload'
|
|
||||||
instance.navigate.refresh
|
|
||||||
return
|
|
||||||
elsif action[:execute] == 'js'
|
|
||||||
result = instance.execute_script( action[:value] )
|
|
||||||
elsif action[:execute] == 'sendkey'
|
|
||||||
if action[:value].class == Array
|
|
||||||
action[:value].each {|key|
|
|
||||||
instance.action.send_keys(key).perform
|
|
||||||
}
|
|
||||||
else
|
|
||||||
instance.action.send_keys(action[:value]).perform
|
|
||||||
#instance.action.send_keys(:enter).perform
|
|
||||||
end
|
|
||||||
# element.send_keys( action[:value] )
|
|
||||||
elsif action[:link]
|
|
||||||
if action[:link].match '###stack###'
|
|
||||||
action[:link].gsub! '###stack###', @stack
|
|
||||||
end
|
|
||||||
element = instance.find_element( { :partial_link_text => action[:link] } )
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" )
|
|
||||||
end
|
|
||||||
if action[:execute] == 'setCheck'
|
|
||||||
checked = element.attribute('checked')
|
|
||||||
if !checked
|
|
||||||
element.click
|
|
||||||
end
|
|
||||||
elsif action[:execute] == 'setUncheck'
|
|
||||||
checked = element.attribute('checked')
|
|
||||||
if checked
|
|
||||||
element.click
|
|
||||||
end
|
|
||||||
elsif action[:execute] == 'set'
|
|
||||||
element.clear
|
|
||||||
if action[:value] == '###stack###'
|
|
||||||
element.send_keys( @stack )
|
|
||||||
else
|
|
||||||
if !action[:slow]
|
|
||||||
element.send_keys( action[:value] )
|
|
||||||
else
|
|
||||||
element.send_keys( '' )
|
|
||||||
keys = action[:value].to_s.split('')
|
|
||||||
keys.each {|key|
|
|
||||||
instance.action.send_keys(key).perform
|
|
||||||
}
|
|
||||||
end
|
|
||||||
sleep 0.3
|
|
||||||
end
|
|
||||||
elsif action[:execute] == 'select'
|
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
|
||||||
dropdown.select_by(:text, action[:value])
|
|
||||||
elsif action[:execute] == 'click'
|
|
||||||
if element.class == Array
|
|
||||||
element.each {|item|
|
|
||||||
item.click
|
|
||||||
}
|
|
||||||
else
|
|
||||||
element.click
|
|
||||||
end
|
|
||||||
elsif action[:execute] == 'accept'
|
|
||||||
element.accept
|
|
||||||
elsif action[:execute] == 'dismiss'
|
|
||||||
element.dismiss
|
|
||||||
elsif action[:execute] == 'send_key'
|
|
||||||
element.send_keys action[:value]
|
|
||||||
elsif action[:execute] == 'match'
|
|
||||||
if action[:css] =~ /select/
|
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
|
||||||
success = false
|
|
||||||
if dropdown.selected_options
|
|
||||||
dropdown.selected_options.each {|option|
|
|
||||||
if option.text == action[:value]
|
|
||||||
success = true
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
if action[:match_result]
|
|
||||||
if success
|
|
||||||
assert( true, "(#{test[:name]}) matching '#{action[:value]}' in select list" )
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) not matching '#{action[:value]}' in select list" )
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if success
|
|
||||||
assert( false, "(#{test[:name]}) not matching '#{action[:value]}' in select list" )
|
|
||||||
else
|
|
||||||
assert( true, "(#{test[:name]}) matching '#{action[:value]}' in select list" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if action[:attribute]
|
|
||||||
text = element.attribute( action[:attribute] )
|
|
||||||
elsif action[:css] =~ /(input|textarea)/i
|
|
||||||
text = element.attribute('value')
|
|
||||||
else
|
|
||||||
text = element.text
|
|
||||||
end
|
|
||||||
if action[:value] == '###stack###'
|
|
||||||
action[:value] = @stack
|
|
||||||
end
|
|
||||||
match = false
|
|
||||||
if action[:no_quote]
|
|
||||||
#puts "aaaa #{text}/#{action[:value]}"
|
|
||||||
if text =~ /#{action[:value]}/i
|
|
||||||
if $1
|
|
||||||
@stack = $1
|
|
||||||
end
|
|
||||||
match = $1 || true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if text =~ /#{Regexp.quote(action[:value])}/i
|
|
||||||
match = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if match
|
|
||||||
if action[:match_result]
|
|
||||||
assert( true, "(#{test[:name]}) matching '#{action[:value]}' in content '#{text}'" )
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) matching '#{action[:value]}' in content '#{text}' but should not!" )
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if !action[:match_result]
|
|
||||||
assert( true, "(#{test[:name]}) not matching '#{action[:value]}' in content '#{text}'" )
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) not matching '#{action[:value]}' in content '#{text}' but should not!" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elsif action[:execute] == 'check'
|
|
||||||
elsif action[:execute] == 'js'
|
|
||||||
elsif action[:execute] == 'sendkey'
|
|
||||||
else
|
|
||||||
assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue