trabajo-afectivo/test/browser/agent_ticket_email_signature_test.rb

319 lines
6.4 KiB
Ruby
Raw Normal View History

2015-01-23 22:24:03 +00:00
require 'browser_test_helper'
2016-09-05 13:18:22 +00:00
class AgentTicketEmailSignatureTest < TestCase
2015-01-23 22:24:03 +00:00
def test_agent_signature_check
2015-03-01 23:16:36 +00:00
suffix = rand(99_999_999_999_999_999).to_s
2015-01-23 22:24:03 +00:00
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
2015-01-23 22:24:03 +00:00
2015-03-01 23:16:36 +00:00
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
2015-03-01 23:16:36 +00:00
)
tasks_close_all()
#
# create groups and signatures
#
# create signatures
signature_create(
data: {
name: signature_name1,
body: signature_body1,
2015-01-23 22:24:03 +00:00
},
2015-03-01 23:16:36 +00:00
)
signature_create(
data: {
name: signature_name2,
body: signature_body2,
2015-01-23 22:24:03 +00:00
},
2015-03-01 23:16:36 +00:00
)
# create groups
group_create(
data: {
name: group_name1,
signature: signature_name1,
member: [
{
login: 'master@example.com',
access: 'full',
},
2015-01-23 22:24:03 +00:00
],
2015-03-01 23:16:36 +00:00
}
)
group_create(
data: {
name: group_name2,
signature: signature_name2,
member: [
{
login: 'master@example.com',
access: 'full',
},
2015-03-01 23:16:36 +00:00
],
}
)
group_create(
data: {
name: group_name3,
member: [
{
login: 'master@example.com',
access: 'full',
},
2015-03-01 23:16:36 +00:00
],
}
)
sleep 6
2015-03-01 23:16:36 +00:00
#
# 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äöü',
2015-01-23 22:24:03 +00:00
},
do_not_submit: true,
2015-03-01 23:16:36 +00:00
)
# select group
select(
css: '.active [name="group_id"]',
value: group_name1,
2015-03-01 23:16:36 +00:00
)
# check content
match(
css: '.active [data-name="body"]',
value: 'some body 5',
2015-03-01 23:16:36 +00:00
)
# check signature
match_not(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# select create channel
click(
css: '.active [data-type="email-out"]',
2015-03-01 23:16:36 +00:00
)
# group 1 is still selected
# check content
match(
css: '.active [data-name="body"]',
value: 'some body 5',
2015-03-01 23:16:36 +00:00
)
# check signature
match(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# select group
select(
css: '.active [name="group_id"]',
value: group_name2,
2015-03-01 23:16:36 +00:00
)
# check content
match(
css: '.active [data-name="body"]',
value: 'some body 5',
2015-03-01 23:16:36 +00:00
)
# check signature
match_not(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# select group
select(
css: '.active [name="group_id"]',
value: group_name3,
2015-03-01 23:16:36 +00:00
)
# check content
match(
css: '.active [data-name="body"]',
value: 'some body 5',
2015-03-01 23:16:36 +00:00
)
# check signature
match_not(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# select group
select(
css: '.active [name="group_id"]',
value: group_name1,
2015-03-01 23:16:36 +00:00
)
# check content
match(
css: '.active [data-name="body"]',
value: 'some body 5',
2015-03-01 23:16:36 +00:00
)
# check signature
match(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# select create channel
click(
css: '.active [data-type="phone-out"]',
2015-03-01 23:16:36 +00:00
)
# check content
match(
css: '.active [data-name="body"]',
value: 'some body 5',
2015-03-01 23:16:36 +00:00
)
# check signature
match_not(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
#
# 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äöü',
2015-03-01 23:16:36 +00:00
},
)
# execute reply
click(
2015-12-14 16:09:09 +00:00
css: '.active [data-type="emailReply"]',
2015-03-01 23:16:36 +00:00
)
# check if signature exists
match(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# update group2
select(
css: '.active [name="group_id"]',
value: group_name2,
)
# execute reply
sleep 5 # time to recognice form changes
scroll_to(
position: 'botton',
css: '.active [data-type="emailReply"]',
)
click(
2015-12-14 16:09:09 +00:00
css: '.active [data-type="emailReply"]',
2015-03-01 23:16:36 +00:00
)
# check if signature exists
match_not(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
# discard changes
2015-06-06 07:22:14 +00:00
sleep 2
2015-03-01 23:16:36 +00:00
click(
css: '.active .js-reset',
2015-03-01 23:16:36 +00:00
)
sleep 3
# check if signature exists
match_not(
css: '.active [data-name="body"]',
value: signature_body1,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
match_not(
css: '.active [data-name="body"]',
value: signature_body2,
no_quote: true,
2015-03-01 23:16:36 +00:00
)
2015-01-23 22:24:03 +00:00
end
end