fix ticketing system error on bootstrap of new install
[freeside.git] / rt / t / web / cf_image.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => 'no_declare';
5
6 my (undef, $m) = RT::Test->started_ok;
7 $m->login;
8 $m->follow_link( id => 'admin-custom-fields-create' );
9 $m->submit_form_ok({
10     form_name => "ModifyCustomField",
11     fields    => {
12         Name          => 'Images',
13         TypeComposite => 'Image-1',
14         LookupType    => 'RT::Queue-RT::Ticket',
15     },
16 });
17 $m->content_contains("Object created");
18 my $cfid = $m->form_name('ModifyCustomField')->value('id');
19 ok $cfid, "Created CF correctly";
20
21 $m->follow_link_ok( {id => "page-applies-to"} );
22 $m->form_with_fields( "AddCustomField-1" );
23 $m->tick( "AddCustomField-1", 0 );
24 $m->click_ok( "UpdateObjs" );
25 $m->content_contains("Object created");
26
27
28 $m->submit_form_ok({
29     form_name => "CreateTicketInQueue",
30     fields    => { Queue => 'General' },
31 });
32 $m->content_contains("Upload one image");
33 $m->submit_form_ok({
34     form_name => "TicketCreate",
35     fields    => {
36         Subject => 'Test ticket',
37         Content => 'test',
38     },
39 });
40 $m->content_like( qr/Ticket \d+ created/,
41                   "a ticket is created succesfully" );
42
43 $m->follow_link_ok( {id => "page-basics"} );
44 $m->content_contains("Upload one image");
45 $m->submit_form_ok({
46     form_name => "TicketModify",
47     fields    => {
48         "Object-RT::Ticket-1-CustomField-1-Upload" =>
49             RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'),
50     },
51 });
52 $m->content_contains("bpslogo.png added");
53 $m->content_contains("/Download/CustomFieldValue/1/bpslogo.png");
54
55 $m->form_name("TicketModify");
56 $m->tick("Object-RT::Ticket-1-CustomField-1-DeleteValueIds", 1);
57 $m->click_ok("SubmitTicket");
58 $m->content_lacks("/Download/CustomFieldValue/1/bpslogo.png");
59
60 undef $m;
61 done_testing;