2013-05-28 12:24:48 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
require 'browser_test_helper'
|
|
|
|
|
2014-12-08 09:39:05 +00:00
|
|
|
class AgentTicketActionLevel0Test < TestCase
|
2015-02-23 22:37:00 +00:00
|
|
|
def test_text_modules
|
2014-09-09 23:42:20 +00:00
|
|
|
random = 'text_module_test_' + rand(99999999).to_s
|
|
|
|
random2 = 'text_module_test_' + rand(99999999).to_s
|
2013-05-28 12:24:48 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
:username => 'master@example.com',
|
|
|
|
:password => 'test',
|
|
|
|
:url => browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# create new text modules
|
|
|
|
text_module_create(
|
|
|
|
:data => {
|
|
|
|
:name => 'some name' + random,
|
|
|
|
:keywords => random,
|
|
|
|
:content => 'some content' + random,
|
2013-05-28 12:24:48 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
text_module_create(
|
|
|
|
:data => {
|
|
|
|
:name => 'some name' + random2,
|
|
|
|
:keywords => random2,
|
|
|
|
:content => 'some content' + random2,
|
2013-07-17 13:57:12 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# try to use them
|
|
|
|
click( :css => 'a[href="#new"]' )
|
|
|
|
click( :css => 'a[href="#ticket/create"]' )
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
set(
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'test ::' + random
|
|
|
|
)
|
|
|
|
watch_for(
|
|
|
|
:css => '.active .shortcut',
|
|
|
|
:value => random,
|
|
|
|
)
|
|
|
|
sendkey(
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
|
|
|
click( :css => '.active .shortcut > ul> li > a' )
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'some content' + random,
|
|
|
|
)
|
|
|
|
tasks_close_all( :discard_changes => true )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# test with two browser windows
|
2014-09-09 23:42:20 +00:00
|
|
|
random = 'text_II_module_test_' + rand(99999999).to_s
|
2013-07-17 13:57:12 +00:00
|
|
|
|
2014-09-09 23:42:20 +00:00
|
|
|
user_rand = rand(99999999).to_s
|
2014-08-15 08:59:40 +00:00
|
|
|
login = 'agent-text-module-' + user_rand
|
|
|
|
firstname = 'Text' + user_rand
|
|
|
|
lastname = 'Module' + user_rand
|
|
|
|
email = 'agent-text-module-' + user_rand + '@example.com'
|
|
|
|
password = 'agentpw'
|
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
# use current session
|
|
|
|
browser1 = @browser
|
2014-08-15 08:59:40 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
browser2 = browser_instance
|
|
|
|
login(
|
|
|
|
:browser => browser2,
|
|
|
|
:username => 'agent1@example.com',
|
|
|
|
:password => 'test',
|
|
|
|
:url => browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all(
|
|
|
|
:browser => browser2,
|
|
|
|
)
|
|
|
|
|
|
|
|
# create new ticket
|
|
|
|
ticket_create(
|
|
|
|
:browser => browser2,
|
|
|
|
:data => {
|
|
|
|
:customer => '',
|
|
|
|
:title => 'A',
|
2014-08-15 08:59:40 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
:do_not_submit => true,
|
|
|
|
)
|
|
|
|
ticket_create(
|
|
|
|
:browser => browser2,
|
|
|
|
:data => {
|
|
|
|
:customer => '',
|
|
|
|
:title => 'B',
|
2013-05-28 12:24:48 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
:do_not_submit => true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# create new text module
|
|
|
|
text_module_create(
|
|
|
|
:browser => browser1,
|
|
|
|
:data => {
|
|
|
|
:name => 'some name' + random,
|
|
|
|
:keywords => random,
|
|
|
|
:content => 'some content <%= @ticket.customer.lastname %>' + random,
|
2013-08-19 13:15:49 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# create user to test placeholder
|
|
|
|
user_create(
|
|
|
|
:browser => browser1,
|
|
|
|
:data => {
|
|
|
|
:login => login,
|
|
|
|
:firstname => firstname,
|
|
|
|
:lastname => lastname,
|
|
|
|
:email => email,
|
|
|
|
:password => password,
|
2014-08-14 09:04:02 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# check if text module exists in instance2, for ready to use
|
|
|
|
set(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'test ::' + random
|
|
|
|
)
|
|
|
|
watch_for(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .shortcut',
|
|
|
|
:value => random,
|
|
|
|
)
|
|
|
|
sendkey(
|
|
|
|
:browser => browser2,
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .shortcut > ul> li > a',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'some content' + random,
|
|
|
|
)
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
|
|
|
|
set(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .newTicket input[name="customer_id_completion"]',
|
|
|
|
:value => 'nicole',
|
|
|
|
)
|
|
|
|
sleep 4
|
|
|
|
sendkey(
|
|
|
|
:browser => browser2,
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
|
|
|
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .newTicket .recipientList-entry.js-user.is-active',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => '::' + random,
|
|
|
|
)
|
|
|
|
sendkey(
|
|
|
|
:browser => browser2,
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .shortcut > ul> li > a',
|
|
|
|
)
|
|
|
|
watch_for(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'some content Braun' + random,
|
|
|
|
)
|
|
|
|
|
|
|
|
# verify zoom
|
|
|
|
click(
|
|
|
|
:browser => browser1,
|
|
|
|
:css => 'a[href="#manage"]',
|
|
|
|
)
|
|
|
|
|
|
|
|
# create ticket
|
|
|
|
ticket_create(
|
|
|
|
:browser => browser2,
|
|
|
|
:data => {
|
|
|
|
:group => 'Users',
|
|
|
|
:subject => 'some subject 123äöü',
|
|
|
|
:body => 'some body 123äöü',
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'test',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => '::' + random,
|
|
|
|
)
|
2015-02-23 22:58:05 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
sendkey(
|
|
|
|
:browser => browser2,
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
2015-02-23 22:58:05 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .shortcut > ul> li > a',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'some content Braun' + random,
|
|
|
|
)
|
|
|
|
|
|
|
|
# change customer
|
|
|
|
click(
|
|
|
|
:browser => browser1,
|
|
|
|
:css => 'a[href="#manage"]',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-tab="ticket"] .js-actions .select-arrow',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-tab="ticket"] .js-actions a[data-type="customer-change"]',
|
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
set(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.modal [name="customer_id_completion"]',
|
|
|
|
:value => firstname,
|
|
|
|
)
|
|
|
|
sleep 4
|
|
|
|
sendkey(
|
|
|
|
:browser => browser2,
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.modal .recipientList-entry.js-user.is-active',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.modal-content .js-submit',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for_disappear(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.modal',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => '::' + random,
|
|
|
|
)
|
|
|
|
|
|
|
|
sendkey(
|
|
|
|
:browser => browser2,
|
|
|
|
:value => :arrow_down,
|
|
|
|
)
|
2014-08-14 09:04:02 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
click(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active .shortcut > ul> li > a',
|
|
|
|
)
|
2014-08-14 09:04:02 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
watch_for(
|
|
|
|
:browser => browser2,
|
|
|
|
:css => '.active div[data-name=body]',
|
|
|
|
:value => 'some content ' + lastname,
|
|
|
|
)
|
2013-05-28 12:24:48 +00:00
|
|
|
end
|
2015-02-23 22:37:00 +00:00
|
|
|
end
|