import rt 3.8.7
[freeside.git] / rt / t / web / cf_onqueue.t
1 #!/usr/bin/perl -w
2 use strict;
3
4 use RT::Test tests => 14;
5 my ($baseurl, $m) = RT::Test->started_ok;
6
7 ok $m->login, 'logged in';
8
9 diag "Create a queue CF" if $ENV{'TEST_VERBOSE'};
10 {
11     $m->follow_link( text => 'Configuration' );
12     $m->title_is(q/RT Administration/, 'admin screen');
13     $m->follow_link( text => 'Custom Fields' );
14     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
15     $m->follow_link( text => 'Create' );
16     $m->submit_form(
17         form_name => "ModifyCustomField",
18         fields => {
19             TypeComposite => 'Freeform-1',
20             LookupType => 'RT::Queue',
21             Name => 'QueueCFTest',
22             Description => 'QueueCFTest',
23         },
24     );
25     $m->content_like( qr/Object created/, 'CF QueueCFTest created' );
26 }
27
28 diag "Apply the new CF globally" if $ENV{'TEST_VERBOSE'};
29 {
30     $m->follow_link( text => 'Global' );
31     $m->title_is(q!Admin/Global configuration!, 'global configuration screen');
32     $m->follow_link( url_regex => qr!Admin/Global/CustomFields/index! );
33     $m->title_is(q/Global custom field configuration/, 'global custom field configuration screen');
34     $m->follow_link( url => 'Queues.html' );
35     $m->title_is(q/Edit Custom Fields for all queues/, 'global custom field for all queues configuration screen');
36     $m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on page' );
37     $m->submit_form(
38         form_name => "EditCustomFields",
39         fields => {
40             'Object--CF-1' => '1',
41         },
42     );
43     $m->content_like( qr/Object created/, 'CF QueueCFTest enabled globally' );
44 }
45
46 diag "Edit the CF value for default queue" if $ENV{'TEST_VERBOSE'};
47 {
48     $m->follow_link( url => '/Admin/Queues/' );
49     $m->title_is(q/Admin queues/, 'queues configuration screen');
50     $m->follow_link( text => "1" );
51     $m->title_is(q/Editing Configuration for queue General/, 'default queue configuration screen');
52     $m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on default queue' );
53     $m->submit_form(
54         form_number => 3,
55         # The following doesn't want to works :(
56         #with_fields => { 'Object-RT::Queue-1-CustomField-1-Value' },
57         fields => {
58             'Object-RT::Queue-1-CustomField-1-Value' => 'QueueCFTest content',
59         },
60     );
61     $m->content_like( qr/QueueCFTest QueueCFTest content added/, 'Content filed in CF QueueCFTest for default queue' );
62
63 }
64
65
66 __END__