6 use RT::Test tests => 18;
8 my $q = RT::Test->load_or_create_queue( Name => 'General' );
9 ok $q && $q->id, 'loaded or created queue';
13 $root = RT::User->new( RT->SystemUser );
15 ok $root_id = $root->id, 'found root';
18 my ($baseurl, $m) = RT::Test->started_ok;
21 # test users auto completer
23 $m->get_ok('/Helpers/Autocomplete/Users?term=eNo');
26 JSON::from_json( $m->content ),
27 [{"value" => "root\@localhost","label" => "Enoch Root"}]
31 # test ticket's People page
33 my $ticket = RT::Test->create_ticket( Queue => $q->id );
34 ok $ticket && $ticket->id, "created ticket";
36 $m->goto_ticket( $ticket->id );
37 $m->follow_link_ok( {text => 'People'} );
39 $m->select( UserField => 'RealName' );
40 $m->field( UserString => 'eNo' );
41 $m->click('OnlySearchForPeople');
43 my $form = $m->form_number(3);
44 my $input = $form->find_input('Ticket-AddWatcher-Principal-'. $root->id );
45 ok $input, 'input is there';
48 # test users' admin UI
50 $m->get_ok('/Admin/Users/');
53 $m->select( UserField => 'RealName' );
54 $m->field( UserString => 'eNo' );
57 like $m->uri, qr{\QAdmin/Users/Modify.html?id=$root_id\E};
60 # create a cf for testing
63 $cf = RT::CustomField->new(RT->SystemUser);
64 my ($id,$msg) = $cf->Create(
72 ($id,$msg) = $cf->AddValue(Name => 'Enoch', Description => 'Root');
76 # test custom field values auto completer
78 $m->get_ok('/Helpers/Autocomplete/CustomFieldValues?term=eNo&Object---CustomField-'. $cf->id .'-Value&ContextId=1&ContextType=RT::Queue');
81 JSON::from_json( $m->content ),
82 [{"value" => "Enoch","label" => "Enoch (Root)"}]