trabajo-afectivo/test/browser/agent_ticket_text_module_test.rb

271 lines
5.7 KiB
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
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
random = "text_module_test_#{rand(99_999_999)}"
random2 = "text_module_test_#{rand(99_999_999)}"
2015-02-23 22:37:00 +00:00
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
2015-02-23 22:37:00 +00:00
)
tasks_close_all
2015-02-23 22:37:00 +00:00
# create new text modules
text_module_create(
data: {
name: "some name#{random}",
keywords: random,
content: "some content#{random}",
},
2015-02-23 22:37:00 +00:00
)
text_module_create(
data: {
name: "some name#{random2}",
keywords: random2,
content: "some content#{random2}",
},
2015-02-23 22:37:00 +00:00
)
# try to use them
click(css: 'a[href="#new"]', only_if_exists: true)
click(css: 'a[href="#ticket/create"]')
2015-02-23 22:37:00 +00:00
sleep 2
set(
css: '.active div[data-name=body]',
value: "test ::#{random}",
2015-02-23 22:37:00 +00:00
)
watch_for(
css: '.active .shortcut',
value: random,
2015-02-23 22:37:00 +00:00
)
sendkey(
value: :arrow_down,
slow: true,
2015-02-23 22:37:00 +00:00
)
click(css: '.active .shortcut > ul> li')
2015-02-23 22:37:00 +00:00
watch_for(
css: '.active div[data-name=body]',
value: "some content#{random}",
2015-02-23 22:37:00 +00:00
)
tasks_close_all
2015-02-23 22:37:00 +00:00
# test with two browser windows
random = "text_II_module_test_#{rand(99_999_999)}"
user_rand = rand(99_999_999).to_s
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(
browser: browser2,
username: 'agent1@example.com',
password: 'test',
url: browser_url,
2015-02-23 22:37:00 +00:00
)
tasks_close_all(
browser: browser2,
2015-02-23 22:37:00 +00:00
)
# create new ticket
ticket_create(
browser: browser2,
data: {
title: 'A',
2014-08-15 08:59:40 +00:00
},
do_not_submit: true,
2015-02-23 22:37:00 +00:00
)
ticket_create(
browser: browser2,
data: {
title: 'B',
},
do_not_submit: true,
2015-02-23 22:37:00 +00:00
)
# create new text module
text_module_create(
browser: browser1,
data: {
name: "some name#{random}",
keywords: random,
content: "some content \#{ticket.customer.lastname}#{random}",
},
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}",
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active .shortcut',
value: random,
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active .shortcut > ul> li',
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
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,
css: '.active .newTicket',
2015-11-29 15:39:56 +00:00
customer: 'nicole',
2015-02-23 22:37:00 +00:00
)
set(
browser: browser2,
css: '.active div[data-name=body]',
value: "::#{random}",
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
value: :arrow_down,
slow: true,
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active .shortcut > ul> li',
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
value: "some content Braun#{random}",
2015-02-23 22:37:00 +00:00
)
# verify zoom
click(
browser: browser1,
css: 'a[href="#manage"]',
2015-02-23 22:37:00 +00:00
)
# create ticket
ticket_create(
browser: browser2,
data: {
customer: 'nico',
group: 'Users',
title: 'some subject 123äöü',
body: 'some body 123äöü',
2015-02-23 22:37:00 +00:00
},
)
set(
browser: browser2,
css: '.active div[data-name=body]',
value: 'test',
no_click: true,
2015-02-23 22:37:00 +00:00
)
set(
browser: browser2,
css: '.active div[data-name=body]',
value: "::#{random}",
no_click: true,
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
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(
browser: browser2,
css: '.active .shortcut > ul> li',
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
value: "some content Braun#{random}",
2015-02-23 22:37:00 +00:00
)
# change customer
click(
browser: browser1,
css: 'a[href="#manage"]',
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down',
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]',
2015-02-23 22:37:00 +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,
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(
browser: browser2,
css: '.modal-content .js-submit',
2015-02-23 22:37:00 +00:00
)
modal_disappear(browser: browser2)
2015-02-23 22:37:00 +00:00
2015-02-24 00:11:10 +00:00
set(
browser: browser2,
css: '.active div[data-name=body]',
value: "::#{random}",
no_click: true,
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
2014-08-14 09:04:02 +00:00
sendkey(
browser: browser2,
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(
browser: browser2,
css: '.active div[data-name=body]',
value: "some content #{lastname}",
2015-02-23 22:37:00 +00:00
)
end
end