first pass RT4 merge, RT#13852
[freeside.git] / rt / t / web / attachments.t
index e827b2f..8c75f6c 100644 (file)
@@ -1,15 +1,15 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test tests => 14;
+use RT::Test tests => 25;
 
-use constant LogoFile => $RT::MasonComponentRoot .'/NoAuth/images/bplogo.gif';
+use constant LogoFile => $RT::MasonComponentRoot .'/NoAuth/images/bpslogo.png';
 use constant FaviconFile => $RT::MasonComponentRoot .'/NoAuth/images/favicon.png';
 
 my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'logged in';
 
-my $queue = RT::Queue->new($RT::Nobody);
+my $queue = RT::Queue->new(RT->Nobody);
 my $qid = $queue->Load('General');
 ok( $qid, "Loaded General queue" );
 
@@ -17,7 +17,7 @@ $m->form_name('CreateTicketInQueue');
 $m->field('Queue', $qid);
 $m->submit;
 is($m->status, 200, "request successful");
-$m->content_like(qr/Create a new ticket/, 'ticket create page');
+$m->content_contains("Create a new ticket", 'ticket create page');
 
 $m->form_name('TicketCreate');
 $m->field('Subject', 'Attachments test');
@@ -26,9 +26,9 @@ $m->field('Content', 'Some content');
 $m->submit;
 is($m->status, 200, "request successful");
 
-$m->content_like(qr/Attachments test/, 'we have subject on the page');
-$m->content_like(qr/Some content/, 'and content');
-$m->content_like(qr/Download bplogo\.gif/, 'page has file name');
+$m->content_contains('Attachments test', 'we have subject on the page');
+$m->content_contains('Some content', 'and content');
+$m->content_contains('Download bpslogo.png', 'page has file name');
 
 $m->follow_link_ok({text => 'Reply'}, "reply to the ticket");
 $m->form_name('TicketUpdate');
@@ -42,6 +42,34 @@ $m->field('UpdateContent', 'Message');
 $m->click('SubmitTicket');
 is($m->status, 200, "request successful");
 
-$m->content_like(qr/Download bplogo\.gif/, 'page has file name');
-$m->content_like(qr/Download favicon\.png/, 'page has file name');
+$m->content_contains('Download bpslogo.png', 'page has file name');
+$m->content_contains('Download favicon.png', 'page has file name');
 
+
+diag "test mobile ui";
+$m->get_ok( $baseurl . '/m/ticket/create?Queue=' . $qid );
+
+$m->form_name('TicketCreate');
+$m->field('Subject', 'Attachments test');
+$m->field('Attach',  LogoFile);
+$m->field('Content', 'Some content');
+$m->submit;
+is($m->status, 200, "request successful");
+
+$m->content_contains('Attachments test', 'we have subject on the page');
+$m->content_contains('bpslogo.png', 'page has file name');
+
+$m->follow_link_ok({text => 'Reply'}, "reply to the ticket");
+$m->form_name('TicketUpdate');
+$m->field('Attach',  LogoFile);
+$m->click('AddMoreAttach');
+is($m->status, 200, "request successful");
+
+$m->form_name('TicketUpdate');
+$m->field('Attach',  FaviconFile);
+$m->field('UpdateContent', 'Message');
+$m->click('SubmitTicket');
+is($m->status, 200, "request successful");
+
+$m->content_contains('bpslogo.png', 'page has file name');
+$m->content_contains('favicon.png', 'page has file name');