2013-04-24 08:59:26 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentUserManageTest < TestCase
|
|
|
|
def test_agent_user
|
|
|
|
customer_user_email = 'customer-test-' + rand(999999).to_s + '@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
|
|
|
tests = [
|
|
|
|
{
|
|
|
|
:name => 'create customer',
|
|
|
|
:action => [
|
2013-06-10 11:00:22 +00:00
|
|
|
{
|
|
|
|
:execute => 'close_all_tasks',
|
|
|
|
},
|
2013-06-10 15:18:40 +00:00
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
2013-04-24 08:59:26 +00:00
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#new"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2014-09-15 09:06:13 +00:00
|
|
|
:css => 'a[href="#ticket/create"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2014-12-02 21:34:46 +00:00
|
|
|
:css => '.active .newTicket [name="customer_id_completion"]',
|
2014-10-03 22:39:54 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'sendkey',
|
2014-12-02 21:34:46 +00:00
|
|
|
:value => [:arrow_down]
|
|
|
|
},
|
2014-12-03 18:53:42 +00:00
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
2014-12-02 21:34:46 +00:00
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => '.active .newTicket .recipientList-entry.js-user-new',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
2014-12-03 18:53:42 +00:00
|
|
|
:value => 1,
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => '.modal input[name="firstname"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => firstname,
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => '.modal input[name="lastname"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => lastname,
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => '.modal input[name="email"]',
|
|
|
|
:value => customer_user_email,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2014-09-16 18:57:55 +00:00
|
|
|
:css => '.modal button.js-submit',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 4,
|
|
|
|
},
|
|
|
|
|
|
|
|
# check is used is selected
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active input[name="customer_id"]',
|
2014-10-03 22:39:54 +00:00
|
|
|
:value => '^\d+$',
|
2013-04-24 08:59:26 +00:00
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => firstname,
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => lastname,
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => customer_user_email,
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => fullname,
|
2013-04-24 08:59:26 +00:00
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
2013-06-10 11:59:16 +00:00
|
|
|
{
|
|
|
|
:execute => 'wait',
|
2014-12-09 19:10:38 +00:00
|
|
|
:value => 4,
|
2013-06-10 11:59:16 +00:00
|
|
|
},
|
2013-04-24 09:46:48 +00:00
|
|
|
|
2014-12-09 19:10:38 +00:00
|
|
|
# call new ticket screen again
|
2013-04-24 08:59:26 +00:00
|
|
|
{
|
2014-12-09 19:10:38 +00:00
|
|
|
:execute => 'close_all_tasks',
|
|
|
|
:discard_changes => 1,
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#new"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2014-09-15 09:06:13 +00:00
|
|
|
:css => 'a[href="#ticket/create"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active input[name="customer_id"]',
|
2014-10-03 22:39:54 +00:00
|
|
|
:value => '^\d+$',
|
2013-04-24 08:59:26 +00:00
|
|
|
:no_quote => true,
|
|
|
|
:match_result => false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => firstname,
|
2013-04-24 08:59:26 +00:00
|
|
|
:no_quote => true,
|
|
|
|
:match_result => false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
2014-10-11 23:35:53 +00:00
|
|
|
:css => '.active .newTicket input[name="customer_id_completion"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => customer_user_email,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
2013-06-10 11:00:22 +00:00
|
|
|
:value => 3,
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'sendkey',
|
2014-12-02 21:34:46 +00:00
|
|
|
:value => [:arrow_down]
|
|
|
|
},
|
2014-12-03 18:53:42 +00:00
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
2014-12-02 21:34:46 +00:00
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => '.active .newTicket .recipientList-entry.js-user.is-active',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
2013-08-08 12:19:05 +00:00
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
2013-04-24 08:59:26 +00:00
|
|
|
{
|
|
|
|
:execute => 'match',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active input[name="customer_id"]',
|
2014-10-03 22:39:54 +00:00
|
|
|
:value => '^\d+$',
|
2013-04-24 08:59:26 +00:00
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => firstname,
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => lastname,
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2014-10-03 22:39:54 +00:00
|
|
|
:css => '.active input[name="customer_id_completion"]',
|
2014-06-05 07:52:56 +00:00
|
|
|
:value => fullname,
|
2013-04-24 08:59:26 +00:00
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
|
|
|
|
end
|
|
|
|
end
|