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'
|
|
|
|
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-02-11 02:43:39 +00:00
|
|
|
:css => 'a[href="#ticket/create/call_inbound"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active .customer_new',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => '.modal input[name="firstname"]',
|
|
|
|
:value => 'Customer Firstname',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => '.modal input[name="lastname"]',
|
|
|
|
:value => 'Customer Lastname',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => '.modal input[name="email"]',
|
|
|
|
:value => customer_user_email,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2013-08-06 20:08:32 +00:00
|
|
|
:css => '.modal button.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"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => '^[0-9].?$',
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active input[name="customer_id_autocompletion"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => 'Customer',
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
|
|
|
|
# call new ticket screen again
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2013-04-24 09:46:48 +00:00
|
|
|
:css => '.taskbar span[data-type="close"]',
|
|
|
|
},
|
2013-06-10 11:59:16 +00:00
|
|
|
{
|
|
|
|
:execute => 'wait',
|
2013-06-24 08:44:38 +00:00
|
|
|
:value => 2,
|
2013-06-10 11:59:16 +00:00
|
|
|
},
|
2013-04-24 09:46:48 +00:00
|
|
|
|
|
|
|
# accept task close warning
|
|
|
|
{
|
2013-06-10 11:59:16 +00:00
|
|
|
:execute => 'click',
|
|
|
|
:css => '.modal .submit',
|
2013-04-24 08:59:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#new"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
2014-02-11 02:43:39 +00:00
|
|
|
:css => 'a[href="#ticket/create/call_inbound"]',
|
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"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => '^[0-9].?$',
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active input[name="customer_id_autocompletion"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => 'Customer',
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
|
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',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => :arrow_down,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'sendkey',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => :tab,
|
|
|
|
},
|
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"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => '^[0-9].?$',
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
2013-06-10 11:00:22 +00:00
|
|
|
:css => '.active input[name="customer_id_autocompletion"]',
|
2013-04-24 08:59:26 +00:00
|
|
|
:value => 'Customer',
|
|
|
|
:no_quote => true,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
|
|
|
|
end
|
|
|
|
end
|