123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- # 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'
- firstname = 'Customer Firstname'
- lastname = 'Customer Lastname'
- fullname = "#{ firstname } #{ lastname } <#{ customer_user_email }>"
- tests = [
- {
- :name => 'create customer',
- :action => [
- {
- :execute => 'close_all_tasks',
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'click',
- :css => 'a[href="#new"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#ticket/create"]',
- },
- {
- :execute => 'click',
- :css => '.active [name="customer_id_completion"]',
- },
- {
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'set',
- :css => '.modal input[name="firstname"]',
- :value => firstname,
- },
- {
- :execute => 'set',
- :css => '.modal input[name="lastname"]',
- :value => lastname,
- },
- {
- :execute => 'set',
- :css => '.modal input[name="email"]',
- :value => customer_user_email,
- },
- {
- :execute => 'click',
- :css => '.modal button.js-submit',
- },
- {
- :execute => 'wait',
- :value => 4,
- },
- # check is used is selected
- {
- :execute => 'match',
- :css => '.active input[name="customer_id"]',
- :value => '^\d+$',
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => firstname,
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => lastname,
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => customer_user_email,
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => fullname,
- :no_quote => true,
- :match_result => true,
- },
- # call new ticket screen again
- {
- :execute => 'close_all_tasks',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- # accept task close warning
- {
- :execute => 'click',
- :css => '.modal button.js-submit',
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'click',
- :css => 'a[href="#new"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#ticket/create"]',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id"]',
- :value => '^\d+$',
- :no_quote => true,
- :match_result => false,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => firstname,
- :no_quote => true,
- :match_result => false,
- },
- {
- :execute => 'set',
- :css => '.active .newTicket input[name="customer_id_completion"]',
- :value => customer_user_email,
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id"]',
- :value => '^\d+$',
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => firstname,
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => lastname,
- :no_quote => true,
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => '.active input[name="customer_id_completion"]',
- :value => fullname,
- :no_quote => true,
- :match_result => true,
- },
- ],
- },
- ]
- browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
- end
- end
|