trabajo-afectivo/test/browser/agent_user_manage_test.rb

238 lines
6.5 KiB
Ruby
Raw Normal View History

2013-04-24 08:59:26 +00:00
require 'browser_test_helper'
class AgentUserManageTest < TestCase
def test_agent_customer_ticket_create
customer_user_email = "customer-test-#{rand(999_999)}@example.com"
2014-06-05 07:52:56 +00:00
firstname = 'Customer Firstname'
lastname = 'Customer Lastname'
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(
username: 'agent1@example.com',
password: 'test',
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
click(css: 'a[href="#new"]', only_if_exists: true)
click(css: 'a[href="#ticket/create"]')
watch_for(
css: '.content.active .newTicket',
timeout: 1,
)
click(css: '.content.active .newTicket [name="customer_id_completion"]')
# check if pulldown is open, it's not working stable via selenium
@browser.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')")
2015-05-13 14:11:47 +00:00
sleep 1
sendkey(value: :arrow_down)
sleep 0.5
click(css: '.content.active .newTicket .recipientList-entry.js-objectNew')
modal_ready()
2015-02-22 22:20:05 +00:00
set(
css: '.content.active .modal input[name="firstname"]',
value: firstname,
2015-02-22 22:20:05 +00:00
)
set(
css: '.content.active .modal input[name="lastname"]',
value: lastname,
2015-02-22 22:20:05 +00:00
)
set(
css: '.content.active .modal input[name="email"]',
value: customer_user_email,
2015-02-22 22:20:05 +00:00
)
click(css: '.content.active .modal button.js-submit')
modal_disappear()
2015-02-22 22:20:05 +00:00
sleep 4
# check is used to check selected
match(
css: '.content.active .newTicket input[name="customer_id"]',
value: '^\d+$',
no_quote: true,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: firstname,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: lastname,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: fullname,
2015-02-22 22:20:05 +00:00
)
sleep 4
# call new ticket screen again
tasks_close_all()
2015-02-22 22:20:05 +00:00
click(css: 'a[href="#new"]', only_if_exists: true)
click(css: 'a[href="#ticket/create"]')
watch_for(
css: '.content.active .newTicket',
timeout: 1,
)
2015-02-22 22:20:05 +00:00
match(
css: '.content.active .newTicket input[name="customer_id"]',
value: '',
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: '',
2015-02-22 22:20:05 +00:00
)
set(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email,
2015-02-22 22:20:05 +00:00
)
sleep 3
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(
css: '.content.active .newTicket input[name="customer_id"]',
value: '^\d+$',
no_quote: true,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: firstname,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: lastname,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email,
2015-02-22 22:20:05 +00:00
)
match(
css: '.content.active .newTicket input[name="customer_id_completion"]',
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
def test_agent_customer_ticket_zoom
customer_user_email = "customer-test-#{rand(999_999)}@example.com"
firstname = 'Customer Firstname'
lastname = 'Customer Lastname'
fullname = "#{firstname} #{lastname} <#{customer_user_email}>"
@browser = browser_instance
login(
username: 'agent1@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()
ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: 'some changes',
body: 'some body',
},
)
watch_for(
css: '.content.active .ticketZoom-header .ticket-number',
value: '\d',
)
click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]')
match(
css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
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"]')
modal_ready()
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(
css: '.content.active .modal input[name="firstname"]',
timeout: 1,
)
set(
css: '.content.active .modal input[name="firstname"]',
value: firstname,
)
set(
css: '.content.active .modal input[name="lastname"]',
value: lastname,
)
set(
css: '.content.active .modal input[name="email"]',
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(
css: '.content.active .modal input[name="customer_id"]',
value: '^\d+$',
no_quote: true,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: firstname,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: lastname,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: customer_user_email,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: fullname,
)
click(css: '.content.active .modal button.js-submit')
modal_disappear()
watch_for(
css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
value: customer_user_email,
timeout: 4,
)
end
end