first pass RT4 merge, RT#13852
[freeside.git] / rt / t / web / attachments.t
1 #!/usr/bin/perl -w
2 use strict;
3
4 use RT::Test tests => 25;
5
6 use constant LogoFile => $RT::MasonComponentRoot .'/NoAuth/images/bpslogo.png';
7 use constant FaviconFile => $RT::MasonComponentRoot .'/NoAuth/images/favicon.png';
8
9 my ($baseurl, $m) = RT::Test->started_ok;
10 ok $m->login, 'logged in';
11
12 my $queue = RT::Queue->new(RT->Nobody);
13 my $qid = $queue->Load('General');
14 ok( $qid, "Loaded General queue" );
15
16 $m->form_name('CreateTicketInQueue');
17 $m->field('Queue', $qid);
18 $m->submit;
19 is($m->status, 200, "request successful");
20 $m->content_contains("Create a new ticket", 'ticket create page');
21
22 $m->form_name('TicketCreate');
23 $m->field('Subject', 'Attachments test');
24 $m->field('Attach',  LogoFile);
25 $m->field('Content', 'Some content');
26 $m->submit;
27 is($m->status, 200, "request successful");
28
29 $m->content_contains('Attachments test', 'we have subject on the page');
30 $m->content_contains('Some content', 'and content');
31 $m->content_contains('Download bpslogo.png', 'page has file name');
32
33 $m->follow_link_ok({text => 'Reply'}, "reply to the ticket");
34 $m->form_name('TicketUpdate');
35 $m->field('Attach',  LogoFile);
36 $m->click('AddMoreAttach');
37 is($m->status, 200, "request successful");
38
39 $m->form_name('TicketUpdate');
40 $m->field('Attach',  FaviconFile);
41 $m->field('UpdateContent', 'Message');
42 $m->click('SubmitTicket');
43 is($m->status, 200, "request successful");
44
45 $m->content_contains('Download bpslogo.png', 'page has file name');
46 $m->content_contains('Download favicon.png', 'page has file name');
47
48
49 diag "test mobile ui";
50 $m->get_ok( $baseurl . '/m/ticket/create?Queue=' . $qid );
51
52 $m->form_name('TicketCreate');
53 $m->field('Subject', 'Attachments test');
54 $m->field('Attach',  LogoFile);
55 $m->field('Content', 'Some content');
56 $m->submit;
57 is($m->status, 200, "request successful");
58
59 $m->content_contains('Attachments test', 'we have subject on the page');
60 $m->content_contains('bpslogo.png', 'page has file name');
61
62 $m->follow_link_ok({text => 'Reply'}, "reply to the ticket");
63 $m->form_name('TicketUpdate');
64 $m->field('Attach',  LogoFile);
65 $m->click('AddMoreAttach');
66 is($m->status, 200, "request successful");
67
68 $m->form_name('TicketUpdate');
69 $m->field('Attach',  FaviconFile);
70 $m->field('UpdateContent', 'Message');
71 $m->click('SubmitTicket');
72 is($m->status, 200, "request successful");
73
74 $m->content_contains('bpslogo.png', 'page has file name');
75 $m->content_contains('favicon.png', 'page has file name');