X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2Ft%2Fregression%2F02basic_web.t;h=3b8619b6689712c68ac76baed1ba1f2ae5c8418e;hp=d3376d011355733ab73184f032d6b8ee69ac2e77;hb=ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4;hpb=a513c0bef534d05f03c1242831b6f3be19b97dae diff --git a/rt/lib/t/regression/02basic_web.t b/rt/lib/t/regression/02basic_web.t index d3376d011..3b8619b66 100644 --- a/rt/lib/t/regression/02basic_web.t +++ b/rt/lib/t/regression/02basic_web.t @@ -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'));