4 use Test::More tests => 15;
10 use Test::WWW::Mechanize;
12 use constant BaseURL => $RT::WebURL;
13 use constant ImageFile => $RT::MasonComponentRoot .'/NoAuth/images/bplogo.gif';
14 use constant ImageFileContent => do {
16 open my $fh, '<', ImageFile or die $!;
21 my $m = Test::WWW::Mechanize->new;
22 isa_ok($m, 'Test::WWW::Mechanize');
24 $m->get( BaseURL."?user=root;pass=password" );
25 $m->content_like(qr/Logout/, 'we did log in');
26 $m->follow_link( text => 'Configuration' );
27 $m->title_is(q/RT Administration/, 'admin screen');
28 $m->follow_link( text => 'Custom Fields' );
29 $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
30 $m->follow_link( text => 'New custom field' );
32 form_name => "ModifyCustomField",
34 TypeComposite => 'Image-0',
35 LookupType => 'RT::Queue-RT::Ticket',
40 $m->title_is(q/Created CustomField img/, 'admin-cf created');
41 $m->follow_link( text => 'Queues' );
42 $m->title_is(q/Admin queues/, 'admin-queues screen');
43 $m->follow_link( text => 'General' );
44 $m->title_is(q/Editing Configuration for queue General/, 'admin-queue: general');
45 $m->follow_link( text => 'Ticket Custom Fields' );
47 $m->title_is(q/Edit Custom Fields for General/, 'admin-queue: general tcf');
48 $m->form_name('EditCustomFields');
50 # Sort by numeric IDs in names
51 my @names = map { $_->[1] }
52 sort { $a->[0] <=> $b->[0] }
53 map { /Object-1-CF-(\d+)/ ? [ $1 => $_ ] : () }
54 map $_->name, $m->current_form->inputs;
55 my $tcf = pop(@names);
56 $m->field( $tcf => 1 ); # Associate the new CF with this queue
57 $m->field( $_ => undef ) for @names; # ...and not any other. ;-)
60 $m->content_like( qr/Object created/, 'TCF added to the queue' );
63 form_name => "CreateTicketInQueue",
64 fields => { Queue => 'General' },
67 $m->content_like(qr/Upload multiple images/, 'has a upload image field');
69 $tcf =~ /(\d+)$/ or die "Hey this is impossible dude";
70 my $upload_field = "Object-RT::Ticket--CustomField-$1-Upload";
73 form_name => "TicketCreate",
75 $upload_field => ImageFile,
76 Subject => 'testing img cf creation',
80 $m->content_like(qr/Ticket \d+ created/, "a ticket is created succesfully");
82 my $id = $1 if $m->content =~ /Ticket (\d+) created/;
84 $m->title_like(qr/testing img cf creation/, "its title is the Subject");
86 $m->follow_link( text => 'bplogo.gif' );
87 $m->content_is(ImageFileContent, "it links to the uploaded image");
91 $m->follow_link( text => 'Tickets' );
92 $m->follow_link( text => 'New Query' );
94 $m->title_is(q/Query Builder/, 'Query building');
96 form_name => "BuildQuery",
100 ValueOfQueue => 'General',
102 button => 'AddClause',
105 $m->form_name('BuildQuery');
107 my $col = ($m->current_form->find_input('SelectDisplayColumns'))[-1];
108 $col->value( ($col->possible_values)[-1] );
112 $m->form_name('BuildQuery');
113 $m->click('DoSearch');
115 $m->follow_link( text_regex => qr/bplogo\.gif/ );
116 $m->content_is(ImageFileContent, "it links to the uploaded image");
119 [FC] Bulk Update does not have custom fields.