X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fweb%2Fcharting.t;h=5131f9cefee14a21cd5794759b62cb274adc2885;hb=de9d037528895f7151a9aead6724ce2df95f9586;hp=32d95d99bdf710034461801c3150de8a4d84ee07;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7;p=freeside.git diff --git a/rt/t/web/charting.t b/rt/t/web/charting.t index 32d95d99b..5131f9cef 100644 --- a/rt/t/web/charting.t +++ b/rt/t/web/charting.t @@ -1,16 +1,10 @@ use strict; use warnings; -BEGIN { - require RT::Test; - - if (eval { require GD; 1 }) { - RT::Test->import(plan => 'no_plan'); - } - else { - RT::Test->import(skip_all => 'GD required.'); - } -} +use RT::Test tests => undef; + +plan skip_all => 'GD required' + unless GD->require; for my $n (1..7) { my $ticket = RT::Ticket->new( RT->SystemUser ); @@ -35,8 +29,8 @@ ok( $m->login, "Logged in" ); # Test that defaults work $m->get_ok( "/Search/Chart.html?Query=id>0" ); -$m->content_like(qr{]*>Queue\s*\s*]*>Tickets\s*}, "Grouped by queue"); -$m->content_like(qr{General\s*\s*]*>\s*]*>7}, "Found results in table"); +$m->content_like(qr{]*>Status\s*\s*]*>Ticket count\s*}, "Grouped by status"); +$m->content_like(qr{new\s*\s*]*>\s*]*>7}, "Found results in table"); $m->content_like(qr{get_ok( "/Search/Chart?Query=id>0" ); @@ -45,34 +39,60 @@ ok( length($m->content), "Has content" ); # Group by Queue -$m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Queue" ); -$m->content_like(qr{]*>Queue\s*\s*]*>Tickets\s*}, "Grouped by queue"); -$m->content_like(qr{General\s*\s*]*>\s*]*>7}, "Found results in table"); +$m->get_ok( "/Search/Chart.html?Query=id>0&GroupBy=Queue" ); +$m->content_like(qr{]*>Queue\s*\s*]*>Ticket count\s*}, "Grouped by queue"); +$m->content_like(qr{General\s*\s*]*>\s*]*>7}, "Found results in table"); $m->content_like(qr{get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Queue" ); +$m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Queue" ); is( $m->content_type, "image/png" ); ok( length($m->content), "Has content" ); # Group by Requestor email -$m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Requestor.EmailAddress" ); -$m->content_like(qr{]*>Requestor\.EmailAddress\s*\s*]*>Tickets\s*}, +$m->get_ok( "/Search/Chart.html?Query=id>0&GroupBy=Requestor.EmailAddress" ); +$m->content_like(qr{]*>Requestor\s+EmailAddress\s*]*>Ticket count\s*}, "Grouped by requestor"); -$m->content_like(qr{root0\@localhost\s*\s*]*>\s*]*>3}, "Found results in table"); +$m->content_like(qr{root0\@localhost\s*\s*]*>\s*]*>3}, "Found results in table"); $m->content_like(qr{get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Email" ); +$m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Requestor.EmailAddress" ); is( $m->content_type, "image/png" ); ok( length($m->content), "Has content" ); - # Group by Requestor phone -- which is bogus, and falls back to queue -$m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Requestor.Phone" ); -$m->content_like(qr{General\s*\s*]*>\s*]*>7}, + +$m->get_ok( "/Search/Chart.html?Query=id>0&GroupBy=Requestor.Phone" ); +$m->warning_like( qr{'Requestor\.Phone' is not a valid grouping for reports} ); + +TODO: { + local $TODO = "UI should show that it's group by status"; + $m->content_like(qr{new\s*\s*]*>\s*]*>7}, "Found queue results in table, as a default"); +} $m->content_like(qr{get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Phone" ); +$m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Requestor.Phone" ); +$m->warning_like( qr{'Requestor\.Phone' is not a valid grouping for reports} ); is( $m->content_type, "image/png" ); ok( length($m->content), "Has content" ); + +diag "Confirm subnav links use Query param before saved search in session."; + +$m->get_ok( "/Search/Chart.html?Query=id>0" ); +my $advanced = $m->find_link( text => 'Advanced' )->URI->equery; +like( $advanced, qr{Query=id%3E0}, + 'Advanced link has Query param with id search' + ); + +# Load the session with another search. +$m->get_ok( "/Search/Results.html?Query=Queue='General'" ); + +$m->get_ok( "/Search/Chart.html?Query=id>0" ); +$advanced = $m->find_link( text => 'Advanced' )->URI->equery; +like( $advanced, qr{Query=id%3E0}, + 'Advanced link still has Query param with id search' + ); + +undef $m; +done_testing;