[Rt-commit] r8212 - in rtir/branches/2.3-EXPERIMENTAL: . t

thayes at bestpractical.com thayes at bestpractical.com
Wed Jul 18 17:12:03 EDT 2007


Author: thayes
Date: Wed Jul 18 17:12:02 2007
New Revision: 8212

Modified:
   rtir/branches/2.3-EXPERIMENTAL/   (props changed)
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
   rtir/branches/2.3-EXPERIMENTAL/t/018-bulk-abandon.t
   rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl

Log:
 r8338 at toth:  toth | 2007-07-18 17:11:45 -0400
 * Added paging to the Bulk Abandon page
 * Accomodated paging in 018-bulk-abandon.t
 


Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html	Wed Jul 18 17:12:02 2007
@@ -49,6 +49,8 @@
     OrderBy       => $OrderBy,
     Order         => $Order,
     Page          => $Page,
+    ShowNavigation  => 1,
+    ShowListActions => 0
 );
 </%PERL>
 

Modified: rtir/branches/2.3-EXPERIMENTAL/t/018-bulk-abandon.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/018-bulk-abandon.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/018-bulk-abandon.t	Wed Jul 18 17:12:02 2007
@@ -78,15 +78,27 @@
 	$agent->follow_link_ok({text => "Incidents", n => '1'}, "Followed 'Incidents' link");
 	$agent->follow_link_ok({text => "Bulk Abandon", n => '1'}, "Followed 'Bulk Abandon' link");
 	
+	# Check that the desired incident occurs in the list of available incidents; if not, keep
+	# going to the next page until you find it (or get to the last page and don't find it,
+	# whichever comes first)
+    while($agent->content() !~ qr{<a href="/Ticket/Display.html\?id=$to_abandon[0]">$to_abandon[0]</a>}) {
+    	last unless $agent->follow_link(text => 'Next Page');
+    }
+	
 	$agent->form_number(3);
 	foreach my $id (@to_abandon) {
+		diag("Ticking incident " . $id);
 		$agent->tick('SelectedTickets', $id);
 	}
 	
 	$agent->click('BulkAbandon');
 	
+	open OF, "> /home/toth/contents" or die "Cannot open file contents for writing: $!";
+	print OF $agent->content();
+	#diag("\nContent:\n\n" . $agent->content());
+	
 	foreach my $id (@to_abandon) {
-		ok_and_content_like($agent, qr/Ticket $id: State changed from \w+ to abandoned/, "Incident $id abandoned");
+		ok_and_content_like($agent, qr{<li>Ticket $id: State changed from \w+ to abandoned</li>}i, "Incident $id abandoned");
 	}
 	
 	$agent->form_number(3);

Modified: rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl	Wed Jul 18 17:12:02 2007
@@ -266,7 +266,8 @@
     my $desc = shift || "looks good";
     
     is($agent->status, 200, "request successful");
-    like($agent->content, $re, $desc);
+    #like($agent->content, $re, $desc);
+    $agent->content_like($re, $desc);
 }
 
 
@@ -310,14 +311,32 @@
 	
 	display_ticket($agent, $id);
 	
+	$agent->timeout(600);
+	
 	$agent->follow_link_ok({text => 'Merge', n => '1'}, "Followed 'Merge' link");
 	
 	$agent->content() =~ /Merge ([\w ]+) #$id:/i;
 	my $type = $1 || 'Ticket';
 	
+
+	# Check that the desired incident occurs in the list of available incidents; if not, keep
+	# going to the next page until you find it (or get to the last page and don't find it,
+	# whichever comes first)
+    while($agent->content() !~ m|<a href="/Ticket/Display.html\?id=$id_to_merge_to">$id_to_merge_to</a>|) {
+    	my @ids = sort map s|<b>\s*<a href="/Ticket/Display.html?id=(\d+)">\1</a>\s*</b>|$1|, split /<td/, $agent->content();
+		my $max = pop @ids;
+		my $url = "Merge.html?id=$id&Order=ASC&Query=( 'CF.{_RTIR_State}' = 'new' OR 'CF.{_RTIR_State}' = 'open' AND 'id' > $max)";
+		my $weburl = RT->Config->Get('WebURL');
+		diag("IDs found: " . join ', ', @ids);
+		diag("Max ID: " . $max);
+		diag ("URL: " . $url);
+    	$agent->get("$weburl/RTIR/$url");
+    	last unless $agent->content() =~ qr|<b>\s*<a href="/Ticket/Display.html?id=(\d+)">\1</a>\s*</b>|sm;
+    }
+    
+	
 	$agent->form_number(3);
 	
-	#print "Content:\n\n" . $agent->content() . "\n\n";
 	
 	$agent->field("SelectedTicket", $id_to_merge_to);
     $agent->click_button(value => 'Merge');


More information about the Rt-commit mailing list