2013-04-24 08:59:26 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentUserManageTest < TestCase
|
|
|
|
def test_agent_user
|
2015-04-27 13:43:34 +00:00
|
|
|
customer_user_email = 'customer-test-' + rand(999_999).to_s + '@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',
|
|
|
|
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
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# create customer
|
2015-04-27 13:42:53 +00:00
|
|
|
click( css: 'a[href="#new"]' )
|
|
|
|
click( css: 'a[href="#ticket/create"]' )
|
|
|
|
click( css: '.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
|
2015-05-14 15:33:12 +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
|
2015-04-27 13:42:53 +00:00
|
|
|
sendkey( value: :arrow_down )
|
2015-05-14 14:59:35 +00:00
|
|
|
sleep 0.5
|
2015-10-15 07:16:47 +00:00
|
|
|
click( css: '.active .newTicket .recipientList-entry.js-userNew' )
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[name="firstname"]',
|
|
|
|
value: firstname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[name="lastname"]',
|
|
|
|
value: lastname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[name="email"]',
|
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
|
2015-04-27 13:42:53 +00:00
|
|
|
click( css: '.modal button.js-submit' )
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 4
|
|
|
|
|
|
|
|
# check is used to check selected
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id"]',
|
|
|
|
value: '^\d+$',
|
|
|
|
no_quote: true,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: firstname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: lastname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
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
|
|
|
|
2015-04-27 13:42:53 +00:00
|
|
|
click( css: 'a[href="#new"]' )
|
|
|
|
click( css: 'a[href="#ticket/create"]' )
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 2
|
|
|
|
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id"]',
|
|
|
|
value: '',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: '',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active .newTicket input[name="customer_id_completion"]',
|
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
sleep 3
|
2015-05-14 14:59:35 +00:00
|
|
|
|
2015-04-27 13:42:53 +00:00
|
|
|
click( css: '.active .newTicket .recipientList-entry.js-user.is-active' )
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# check is used to check selected
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id"]',
|
|
|
|
value: '^\d+$',
|
|
|
|
no_quote: true,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: firstname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: lastname,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active input[name="customer_id_completion"]',
|
|
|
|
value: customer_user_email,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
match(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.active 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
|
|
|
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|