Added browser tests for signature.
This commit is contained in:
parent
30042e451d
commit
a18157ba4d
4 changed files with 463 additions and 15 deletions
|
@ -1479,10 +1479,10 @@ class ArticleView extends App.Controller
|
|||
e.preventDefault()
|
||||
|
||||
# get reference article
|
||||
article_id = $(e.target).parents('[data-id]').data('id')
|
||||
article = App.TicketArticle.fullLocal( article_id )
|
||||
type = App.TicketArticleType.find( article.type_id )
|
||||
customer = App.User.find( article.created_by_id )
|
||||
article_id = $(e.target).parents('[data-id]').data('id')
|
||||
article = App.TicketArticle.fullLocal( article_id )
|
||||
type = App.TicketArticleType.find( article.type_id )
|
||||
customer = App.User.find( article.created_by_id )
|
||||
|
||||
@ui.el.find('.article-add').ScrollTo()
|
||||
|
||||
|
@ -1511,7 +1511,8 @@ class ArticleView extends App.Controller
|
|||
to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid
|
||||
articleNew.to = to
|
||||
|
||||
else if type.name is 'email'
|
||||
else if type.name is 'email' || type.name is 'phone' || type.name is 'web'
|
||||
|
||||
if article.sender.name is 'Agent'
|
||||
articleNew.to = article.to
|
||||
else
|
||||
|
@ -1655,22 +1656,28 @@ class Article extends App.Controller
|
|||
]
|
||||
#if @article.type.name is 'note'
|
||||
# actions.push []
|
||||
if @article.type.name is 'email'
|
||||
if @article.type.name is 'email' || @article.type.name is 'phone' || @article.type.name is 'web'
|
||||
actions.push {
|
||||
name: 'reply'
|
||||
type: 'reply'
|
||||
href: '#'
|
||||
}
|
||||
recipients = []
|
||||
if @article.to
|
||||
localRecipients = emailAddresses.parseAddressList(@article.to)
|
||||
if localRecipients
|
||||
recipients = recipients.concat localRecipients
|
||||
if @article.sender.name is 'Agent'
|
||||
if @article.to
|
||||
localRecipients = emailAddresses.parseAddressList(@article.to)
|
||||
if localRecipients
|
||||
recipients = recipients.concat localRecipients
|
||||
else
|
||||
if @article.from
|
||||
localRecipients = emailAddresses.parseAddressList(@article.from)
|
||||
if localRecipients
|
||||
recipients = recipients.concat localRecipients
|
||||
if @article.cc
|
||||
localRecipients = emailAddresses.parseAddressList(@article.cc)
|
||||
if localRecipients
|
||||
recipients = recipients.concat localRecipients
|
||||
if recipients.length > 0
|
||||
if recipients.length > 1
|
||||
actions.push {
|
||||
name: 'reply all'
|
||||
type: 'replyAll'
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
<% if article.actions: %>
|
||||
<div>
|
||||
<div class="article-actions horizontal stretch">
|
||||
<div class="article-content article-actions horizontal stretch">
|
||||
<% for action in article.actions: %>
|
||||
<a href="<%= action.href %>" data-type="<%= action.type %>" class="article-action u-clickable<% if action.class: %> <%= action.class %><% end %>">
|
||||
<span class="<%= action.type %> action icon"></span><%- @T( action.name ) %>
|
||||
|
|
362
test/browser/agent_ticket_actions_level5_test.rb
Normal file
362
test/browser/agent_ticket_actions_level5_test.rb
Normal file
|
@ -0,0 +1,362 @@
|
|||
# encoding: utf-8
|
||||
require 'browser_test_helper'
|
||||
|
||||
class AgentTicketActionLevel5Test < TestCase
|
||||
def test_agent_signature_check
|
||||
suffix = rand(99999999999999999).to_s
|
||||
signature_name1 = 'sig name 1 äöüß ' + suffix
|
||||
signature_body1 = "--\nsig body 1 äöüß " + suffix
|
||||
signature_name2 = 'sig name 2 äöüß ' + suffix
|
||||
signature_body2 = "--\nsig body 2 äöüß " + suffix
|
||||
group_name1 = "group name 1 " + suffix
|
||||
group_name2 = "group name 2 " + suffix
|
||||
group_name3 = "group name 3 " + suffix
|
||||
|
||||
tests = [
|
||||
{
|
||||
:name => 'create groups and signatures',
|
||||
:action => [
|
||||
|
||||
{
|
||||
:execute => 'close_all_tasks',
|
||||
},
|
||||
|
||||
# create signatures
|
||||
{
|
||||
:execute => 'create_signature',
|
||||
:name => signature_name1,
|
||||
: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',
|
||||
:action => [
|
||||
|
||||
# reload instances to get new group permissions
|
||||
{
|
||||
: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,
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
]
|
||||
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
|
||||
end
|
||||
end
|
|
@ -30,8 +30,12 @@ class TestCase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
caps = Selenium::WebDriver::Remote::Capabilities.send( browser )
|
||||
caps.platform = ENV['BROWSER_OS'] || 'Windows 2008'
|
||||
caps.version = ENV['BROWSER_VERSION'] || '8'
|
||||
if ENV['BROWSER_OS']
|
||||
caps.platform = ENV['BROWSER_OS']
|
||||
end
|
||||
if ENV['BROWSER_VERSION']
|
||||
caps.version = ENV['BROWSER_VERSION']
|
||||
end
|
||||
local_browser = Selenium::WebDriver.for(
|
||||
:remote,
|
||||
:url => ENV['REMOTE_URL'],
|
||||
|
@ -291,7 +295,6 @@ class TestCase < Test::Unit::TestCase
|
|||
assert( false, "(#{test[:name]} / #{test[:area]}) still exsists" )
|
||||
return
|
||||
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
|
||||
|
@ -329,6 +332,82 @@ class TestCase < Test::Unit::TestCase
|
|||
assert( true, "(#{test[:name]}) user creation failed" )
|
||||
return
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue