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
|
2015-04-27 13:43:34 +00:00
|
|
|
random = 'text_module_test_' + rand(99_999_999).to_s
|
|
|
|
random2 = 'text_module_test_' + rand(99_999_999).to_s
|
2013-05-28 12:24:48 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2015-04-27 13:42:53 +00:00
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# create new text modules
|
|
|
|
text_module_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
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(
|
2015-04-27 13:42:53 +00:00
|
|
|
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
|
2015-04-27 13:42:53 +00:00
|
|
|
click( css: 'a[href="#new"]' )
|
|
|
|
click( css: 'a[href="#ticket/create"]' )
|
2015-02-23 22:37:00 +00:00
|
|
|
sleep 2
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'test ::' + random
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active .shortcut',
|
|
|
|
value: random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2015-04-27 13:42:53 +00:00
|
|
|
click( css: '.active .shortcut > ul> li > a' )
|
2015-02-23 22:37:00 +00:00
|
|
|
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'some content' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2015-04-27 13:42:53 +00:00
|
|
|
tasks_close_all( discard_changes: true )
|
2015-02-23 22:37:00 +00:00
|
|
|
|
|
|
|
# test with two browser windows
|
2015-04-27 13:43:34 +00:00
|
|
|
random = 'text_II_module_test_' + rand(99_999_999).to_s
|
2013-07-17 13:57:12 +00:00
|
|
|
|
2015-04-27 13:43:34 +00:00
|
|
|
user_rand = rand(99_999_999).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(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
tasks_close_all(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# create new ticket
|
|
|
|
ticket_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
data: {
|
|
|
|
title: 'A',
|
2014-08-15 08:59:40 +00:00
|
|
|
},
|
2015-04-27 13:42:53 +00:00
|
|
|
do_not_submit: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
ticket_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
data: {
|
|
|
|
title: 'B',
|
2013-05-28 12:24:48 +00:00
|
|
|
},
|
2015-04-27 13:42:53 +00:00
|
|
|
do_not_submit: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# create new text module
|
|
|
|
text_module_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
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(
|
2015-04-27 13:42:53 +00:00
|
|
|
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(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'test ::' + random
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .shortcut',
|
|
|
|
value: random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .shortcut > ul> li > a',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'some content ' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .newTicket input[name="customer_id_completion"]',
|
|
|
|
value: 'nicole',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sleep 4
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .newTicket .recipientList-entry.js-user.is-active',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: '::' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .shortcut > ul> li > a',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'some content Braun' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# verify zoom
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser1,
|
|
|
|
css: 'a[href="#manage"]',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# create ticket
|
|
|
|
ticket_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
|
|
|
title: 'some subject 123äöü',
|
|
|
|
body: 'some body 123äöü',
|
2015-02-23 22:37:00 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'test',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: '::' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2015-02-23 22:58:05 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2015-02-23 22:58:05 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .shortcut > ul> li > a',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'some content Braun' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# change customer
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser1,
|
|
|
|
css: 'a[href="#manage"]',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-tab="ticket"] .js-actions .select-arrow',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-tab="ticket"] .js-actions a[data-type="customer-change"]',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.modal [name="customer_id_completion"]',
|
|
|
|
value: firstname,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sleep 4
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.modal .recipientList-entry.js-user.is-active',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.modal-content .js-submit',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
watch_for_disappear(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.modal',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
2015-02-24 00:11:10 +00:00
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: '::' + random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2014-08-14 09:04:02 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active .shortcut > ul> li > a',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2014-08-14 09:04:02 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'some content ' + lastname,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2013-05-28 12:24:48 +00:00
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|