import rt 3.6.4
[freeside.git] / rt / lib / t / regression / 02basic_web.t
index d3376d0..3b8619b 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-use Test::More tests => 17;
+use Test::More tests => 19;
 use WWW::Mechanize;
 use HTTP::Request::Common;
 use HTTP::Cookies;
@@ -16,10 +16,10 @@ my $agent = WWW::Mechanize->new();
 $agent->cookie_jar($cookie_jar);
 
 use RT;
-RT::LoadConfig;
-
+RT::LoadConfig();
 # get the top page
 my $url = $RT::WebURL;
+diag $url;
 $agent->get($url);
 
 is ($agent->{'status'}, 200, "Loaded a page");
@@ -44,17 +44,20 @@ ok( $agent->{'content'} =~ /Logout/i, "Found a logout link");
 
 $agent->get($url."Ticket/Create.html?Queue=1");
 is ($agent->{'status'}, 200, "Loaded Create.html");
-$agent->form(3);
+$agent->form_number(3);
 # Start with a string containing characters in latin1
 my $string = "I18N Web Testing æøå";
 Encode::from_to($string, 'iso-8859-1', 'utf8');
 $agent->field('Subject' => "Ticket with utf8 body");
 $agent->field('Content' => $string);
 ok($agent->submit(), "Created new ticket with $string as Content");
-ok( $agent->{'content'} =~ qr{$string} , "Found the content");
+like( $agent->{'content'}, qr{$string} , "Found the content");
+ok($agent->{redirected_uri}, "Did redirection");
+
+
 $agent->get($url."Ticket/Create.html?Queue=1");
 is ($agent->{'status'}, 200, "Loaded Create.html");
-$agent->form(3);
+$agent->form_number(3);
 # Start with a string containing characters in latin1
 my $string = "I18N Web Testing æøå";
 Encode::from_to($string, 'iso-8859-1', 'utf8');
@@ -62,9 +65,15 @@ $agent->field('Subject' => $string);
 $agent->field('Content' => "Ticket with utf8 subject");
 ok($agent->submit(), "Created new ticket with $string as Subject");
 
-ok( $agent->{'content'} =~ qr{$string} , "Found the content");
+like( $agent->{'content'}, qr{$string} , "Found the content");
 
+# Update time worked in hours
+$agent->follow_link( text_regex => qr/Basics/ );
+$agent->submit_form( form_number => 3,
+    fields => { TimeWorked => 5, 'TimeWorked-TimeUnits' => "hours" }
+);
 
+like ($agent->{'content'}, qr/to '300'/, "5 hours is 300 minutes");
 
 # }}}
 
@@ -82,14 +91,14 @@ ok($agent->form_name('BuildQuery'));
 $agent->field("AttachmentField", "Subject");
 $agent->field("AttachmentOp", "LIKE");
 $agent->field("ValueOfAttachment", "aaa");
-$agent->submit();
+$agent->submit("AddClause");
 
 # set the next value
 ok($agent->form_name('BuildQuery'));
 $agent->field("AttachmentField", "Subject");
 $agent->field("AttachmentOp", "LIKE");
 $agent->field("ValueOfAttachment", "bbb");
-$agent->submit();
+$agent->submit("AddClause");
 
 ok($agent->form_name('BuildQuery'));