2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2013-04-24 08:59:26 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentUserManageTest < TestCase
|
2018-05-25 05:59:20 +00:00
|
|
|
def test_agent_customer_ticket_create
|
2020-09-30 09:07:01 +00:00
|
|
|
customer_user_email = "customer-test-#{rand(999_999)}@example.com"
|
2014-06-05 07:52:56 +00:00
|
|
|
firstname = 'Customer Firstname'
|
|
|
|
lastname = 'Customer Lastname'
|
2015-07-03 15:18:01 +00:00
|
|
|
fullname = "#{firstname} #{lastname} <#{customer_user_email}>"
|
2013-04-24 08:59:26 +00:00
|
|
|
|
2015-02-22 22:20:05 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
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-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
2013-04-24 09:46:48 +00:00
|
|
|
|
2015-02-22 22:20:05 +00:00
|
|
|
# create customer
|
2018-03-06 05:30:12 +00:00
|
|
|
click(css: 'a[href="#new"]', only_if_exists: true)
|
2017-11-24 15:54:56 +00:00
|
|
|
click(css: 'a[href="#ticket/create"]')
|
2018-05-25 05:59:20 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket',
|
2018-05-25 05:59:20 +00:00
|
|
|
timeout: 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .newTicket [name="customer_id_completion"]')
|
2015-05-14 14:59:35 +00:00
|
|
|
|
|
|
|
# check if pulldown is open, it's not working stable via selenium
|
2018-05-25 05:59:20 +00:00
|
|
|
@browser.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')")
|
2015-05-14 14:59:35 +00:00
|
|
|
|
2015-05-13 14:11:47 +00:00
|
|
|
sleep 1
|
2017-11-24 15:54:56 +00:00
|
|
|
sendkey(value: :arrow_down)
|
2015-05-14 14:59:35 +00:00
|
|
|
sleep 0.5
|
2018-05-25 05:59:20 +00:00
|
|
|
click(css: '.content.active .newTicket .recipientList-entry.js-objectNew')
|
|
|
|
|
2018-07-25 07:27:36 +00:00
|
|
|
modal_ready()
|
2015-02-22 22:20:05 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="firstname"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: firstname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="lastname"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: lastname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="email"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
|
2018-05-25 05:59:20 +00:00
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2018-07-25 07:27:36 +00:00
|
|
|
modal_disappear()
|
|
|
|
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 4
|
|
|
|
|
|
|
|
# check is used to check selected
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id"]',
|
|
|
|
value: '^\d+$',
|
2015-04-27 13:42:53 +00:00
|
|
|
no_quote: true,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: firstname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: lastname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: fullname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
sleep 4
|
|
|
|
|
|
|
|
# call new ticket screen again
|
2016-02-29 15:00:11 +00:00
|
|
|
tasks_close_all()
|
2015-02-22 22:20:05 +00:00
|
|
|
|
2018-03-06 05:30:12 +00:00
|
|
|
click(css: 'a[href="#new"]', only_if_exists: true)
|
2017-11-24 15:54:56 +00:00
|
|
|
click(css: 'a[href="#ticket/create"]')
|
2018-05-25 05:59:20 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket',
|
2018-05-25 05:59:20 +00:00
|
|
|
timeout: 1,
|
|
|
|
)
|
2015-02-22 22:20:05 +00:00
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: '',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: '',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
sleep 3
|
2015-05-14 14:59:35 +00:00
|
|
|
|
2018-05-25 05:59:20 +00:00
|
|
|
click(css: '.content.active .newTicket .recipientList-entry.js-object.is-active')
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# check is used to check selected
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id"]',
|
|
|
|
value: '^\d+$',
|
2015-04-27 13:42:53 +00:00
|
|
|
no_quote: true,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: firstname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: lastname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: fullname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
2013-04-24 08:59:26 +00:00
|
|
|
end
|
2015-02-22 22:20:05 +00:00
|
|
|
|
2018-05-25 05:59:20 +00:00
|
|
|
def test_agent_customer_ticket_zoom
|
2020-09-30 09:07:01 +00:00
|
|
|
customer_user_email = "customer-test-#{rand(999_999)}@example.com"
|
2018-05-25 05:59:20 +00:00
|
|
|
firstname = 'Customer Firstname'
|
|
|
|
lastname = 'Customer Lastname'
|
|
|
|
fullname = "#{firstname} #{lastname} <#{customer_user_email}>"
|
|
|
|
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-25 05:59:20 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'some changes',
|
|
|
|
body: 'some body',
|
2018-05-25 05:59:20 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .ticketZoom-header .ticket-number',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: '\d',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: 'Nicole Braun',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions')
|
|
|
|
click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]')
|
|
|
|
|
2018-07-25 07:27:36 +00:00
|
|
|
modal_ready()
|
2018-05-25 05:59:20 +00:00
|
|
|
click(css: '.content.active .modal [name="customer_id_completion"]')
|
|
|
|
|
|
|
|
# check if pulldown is open, it's not working stable via selenium
|
|
|
|
@browser.execute_script("$('.active .modal .js-recipientDropdown').addClass('open')")
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
sendkey(value: :arrow_down)
|
|
|
|
sleep 0.5
|
|
|
|
click(css: '.content.active .modal .recipientList-entry.js-objectNew')
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="firstname"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
timeout: 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="firstname"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: firstname,
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="lastname"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: lastname,
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="email"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: customer_user_email,
|
|
|
|
)
|
|
|
|
|
|
|
|
# there are 2 models, take the correct one
|
|
|
|
#click(css: '.content.active .modal button.js-submit')
|
|
|
|
@browser.execute_script("$('.content.active .modal input[name=\"firstname\"]').closest('form').find('button.js-submit').click()")
|
|
|
|
|
|
|
|
# check is used to check selected
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="customer_id"]',
|
|
|
|
value: '^\d+$',
|
2018-05-25 05:59:20 +00:00
|
|
|
no_quote: true,
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="customer_id_completion"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: firstname,
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="customer_id_completion"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: lastname,
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="customer_id_completion"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: customer_user_email,
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal input[name="customer_id_completion"]',
|
2018-05-25 05:59:20 +00:00
|
|
|
value: fullname,
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2018-07-25 07:27:36 +00:00
|
|
|
modal_disappear()
|
2018-05-25 05:59:20 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
|
|
|
|
value: customer_user_email,
|
2018-05-25 05:59:20 +00:00
|
|
|
timeout: 4,
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|