2013-05-28 12:24:48 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
2016-09-05 13:18:22 +00:00
|
|
|
class AgentTicketTextModuleTest < TestCase
|
2015-02-23 22:37:00 +00:00
|
|
|
def test_text_modules
|
2020-09-30 09:07:01 +00:00
|
|
|
random = "text_module_test_#{rand(99_999_999)}"
|
|
|
|
random2 = "text_module_test_#{rand(99_999_999)}"
|
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',
|
2018-12-19 17:31:51 +00:00
|
|
|
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: {
|
2020-09-30 09:07:01 +00:00
|
|
|
name: "some name#{random}",
|
2015-04-27 13:42:53 +00:00
|
|
|
keywords: random,
|
2020-09-30 09:07:01 +00:00
|
|
|
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: {
|
2020-09-30 09:07:01 +00:00
|
|
|
name: "some name#{random2}",
|
2015-04-27 13:42:53 +00:00
|
|
|
keywords: random2,
|
2020-09-30 09:07:01 +00:00
|
|
|
content: "some content#{random2}",
|
2013-07-17 13:57:12 +00:00
|
|
|
},
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# try to use them
|
2018-03-06 05:30:12 +00:00
|
|
|
click(css: 'a[href="#new"]', only_if_exists: true)
|
2018-02-12 16:31:02 +00:00
|
|
|
click(css: 'a[href="#ticket/create"]')
|
2015-02-23 22:37:00 +00:00
|
|
|
sleep 2
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "test ::#{random}",
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active .shortcut',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
value: :arrow_down,
|
2018-12-19 17:31:51 +00:00
|
|
|
slow: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2018-02-12 16:31:02 +00:00
|
|
|
click(css: '.active .shortcut > ul> li')
|
2015-02-23 22:37:00 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "some content#{random}",
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2016-02-29 15:00:11 +00:00
|
|
|
tasks_close_all()
|
2015-02-23 22:37:00 +00:00
|
|
|
|
|
|
|
# test with two browser windows
|
2020-09-30 09:07:01 +00:00
|
|
|
random = "text_II_module_test_#{rand(99_999_999)}"
|
2013-07-17 13:57:12 +00:00
|
|
|
|
2015-04-27 13:43:34 +00:00
|
|
|
user_rand = rand(99_999_999).to_s
|
2020-09-30 09:07:01 +00:00
|
|
|
login = "agent-text-module-#{user_rand}"
|
|
|
|
firstname = "Text#{user_rand}"
|
|
|
|
lastname = "Module#{user_rand}"
|
|
|
|
email = "agent-text-module-#{user_rand}@example.com"
|
2014-08-15 08:59:40 +00:00
|
|
|
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(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser2,
|
2015-04-27 13:42:53 +00:00
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
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(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser2,
|
|
|
|
data: {
|
2015-04-27 13:42:53 +00:00
|
|
|
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(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser2,
|
|
|
|
data: {
|
2015-04-27 13:42:53 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2020-09-30 09:07:01 +00:00
|
|
|
name: "some name#{random}",
|
2015-04-27 13:42:53 +00:00
|
|
|
keywords: random,
|
2018-12-19 17:31:51 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
|
|
|
login: login,
|
2015-04-27 13:42:53 +00:00
|
|
|
firstname: firstname,
|
2018-12-19 17:31:51 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "test ::#{random}",
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active .shortcut',
|
|
|
|
value: random,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active .shortcut > ul> li',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "some content -#{random}",
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
2015-11-29 15:39:56 +00:00
|
|
|
ticket_customer_select(
|
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active .newTicket',
|
2015-11-29 15:39:56 +00:00
|
|
|
customer: 'nicole',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "::#{random}",
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
value: :arrow_down,
|
|
|
|
slow: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active .shortcut > ul> li',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2015-04-27 13:42:53 +00:00
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'some subject 123äöü',
|
|
|
|
body: 'some body 123äöü',
|
2015-02-23 22:37:00 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
|
|
|
value: 'test',
|
2015-12-05 19:44:43 +00:00
|
|
|
no_click: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "::#{random}",
|
2015-12-05 19:44:43 +00:00
|
|
|
no_click: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2015-11-29 15:39:56 +00:00
|
|
|
sleep 1
|
2015-02-23 22:37:00 +00:00
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active .shortcut > ul> li',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: 'a[href="#manage"]',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2018-07-25 07:27:36 +00:00
|
|
|
|
|
|
|
modal_ready(browser: browser2)
|
2015-02-23 22:37:00 +00:00
|
|
|
|
2015-11-29 15:39:56 +00:00
|
|
|
ticket_customer_select(
|
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal',
|
2015-11-29 15:39:56 +00:00
|
|
|
customer: firstname,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2015-11-29 15:39:56 +00:00
|
|
|
|
2015-02-23 22:37:00 +00:00
|
|
|
click(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal-content .js-submit',
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
2018-07-25 07:27:36 +00:00
|
|
|
modal_disappear(browser: browser2)
|
2015-02-23 22:37:00 +00:00
|
|
|
|
2015-02-24 00:11:10 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
browser: browser2,
|
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
value: "::#{random}",
|
2015-12-05 19:44:43 +00:00
|
|
|
no_click: true,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
value: :arrow_down,
|
2015-02-23 22:37:00 +00:00
|
|
|
)
|
2014-08-14 09:04:02 +00:00
|
|
|
|
2015-10-18 22:30:38 +00:00
|
|
|
sendkey(
|
2015-04-27 13:42:53 +00:00
|
|
|
browser: browser2,
|
2018-12-19 17:31:51 +00:00
|
|
|
value: :enter,
|
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,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div[data-name=body]',
|
2020-09-30 09:07:01 +00:00
|
|
|
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
|