[Rt-commit] r4929 - rtir/branches/1.9-EXPERIMENTAL/t
glasser at bestpractical.com
glasser at bestpractical.com
Fri Mar 31 15:56:43 EST 2006
Author: glasser
Date: Fri Mar 31 15:56:43 2006
New Revision: 4929
Added:
rtir/branches/1.9-EXPERIMENTAL/t/005-resolve-investigations.t
Modified:
rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t
rtir/branches/1.9-EXPERIMENTAL/t/002-test-reject.t
rtir/branches/1.9-EXPERIMENTAL/t/003-resolve-IR-when-all-incidents-resolved.t
rtir/branches/1.9-EXPERIMENTAL/t/004-rtfm-in-rtir.t
rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl
Log:
test resolving investigations
Modified: rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t Fri Mar 31 15:56:43 2006
@@ -47,7 +47,7 @@
my $id = $args{'id'};
my $incident = $args{'incident'};
- display_ir($agent, $id);
+ display_ticket($agent, $id);
# Select the "Link" link from the Display page
$agent->follow_link_ok({text => "[Link]", n => "1"}, "Followed 'Link(to Incident)' link");
Modified: rtir/branches/1.9-EXPERIMENTAL/t/002-test-reject.t
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/002-test-reject.t (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/002-test-reject.t Fri Mar 31 15:56:43 2006
@@ -36,14 +36,14 @@
}
for my $id ($nobody_quick, $me_quick) {
- display_ir($agent, $id);
+ display_ticket($agent, $id);
$agent->follow_link_ok({text => "Quick Reject"}, "Followed 'Quick Reject' link");
like($agent->content, qr/State changed from new to rejected/, "site says ticket got rejected");
}
for my $id ($nobody_slow, $me_slow) {
- display_ir($agent, $id);
+ display_ticket($agent, $id);
$agent->follow_link_ok({text => "Reject"}, "Followed 'Reject' link");
Modified: rtir/branches/1.9-EXPERIMENTAL/t/003-resolve-IR-when-all-incidents-resolved.t
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/003-resolve-IR-when-all-incidents-resolved.t (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/003-resolve-IR-when-all-incidents-resolved.t Fri Mar 31 15:56:43 2006
@@ -16,20 +16,20 @@
my $inc_1 = create_incident_for_ir($agent, $ir_id, {Subject => $subj1});
my $inc_2 = create_incident_for_ir($agent, $ir_id, {Subject => $subj2});
-display_ir($agent, $ir_id);
+display_ticket($agent, $ir_id);
like($agent->content, qr/\Q$subj1/, "we're linked to the first incident");
like($agent->content, qr/\Q$subj2/, "we're linked to the second incident");
ir_status('new');
-display_ir($agent, $inc_1);
+display_ticket($agent, $inc_1);
$agent->follow_link_ok({text => "Quick Resolve"}, "followed 'Quick Resolve' link for first incident");
like($agent->content, qr/State changed from open to resolved/, "resolved the first incident");
ir_status('new');
-display_ir($agent, $inc_2);
+display_ticket($agent, $inc_2);
$agent->follow_link_ok({text => "Quick Resolve"}, "followed 'Quick Resolve' link for second incident");
like($agent->content, qr/State changed from open to resolved/, "resolved the second incident");
Modified: rtir/branches/1.9-EXPERIMENTAL/t/004-rtfm-in-rtir.t
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/004-rtfm-in-rtir.t (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/004-rtfm-in-rtir.t Fri Mar 31 15:56:43 2006
@@ -10,7 +10,7 @@
my $ir_id = create_ir($agent, {Subject => "looking for rtfm"});
-display_ir($agent, $ir_id);
+display_ticket($agent, $ir_id);
$agent->follow_link_ok({text => "RTFM"}, "followed 'RTFM' overview link");
$agent->title_like(qr/Overview/);
Added: rtir/branches/1.9-EXPERIMENTAL/t/005-resolve-investigations.t
==============================================================================
--- (empty file)
+++ rtir/branches/1.9-EXPERIMENTAL/t/005-resolve-investigations.t Fri Mar 31 15:56:43 2006
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 20;
+
+require "t/rtir-test.pl";
+
+my $agent = default_agent();
+
+my $inv_id = create_investigation($agent, {Subject => "i want to quick-resolve this"});
+
+display_ticket($agent, $inv_id);
+
+$agent->follow_link_ok({text => "Quick Resolve"}, "followed 'RTFM' overview link");
+like($agent->content, qr/State changed from open to resolved/, "it got resolved");
+
+$inv_id = create_investigation($agent, {Subject => "resolve me slower"});
+
+display_ticket($agent, $inv_id);
+
+$agent->follow_link_ok({text => "Resolve"}, "Followed 'Resolve' link");
+
+$agent->form_name("TicketUpdate");
+$agent->field(UpdateContent => "why you are resolved");
+$agent->click("SubmitTicket");
+
+is ($agent->status, 200, "attempt to resolve inv succeeded");
+
+like($agent->content, qr/State changed from open to resolved/, "site says ticket got resolved");
Modified: rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl Fri Mar 31 15:56:43 2006
@@ -66,7 +66,7 @@
}
}
-sub display_ir {
+sub display_ticket {
my $agent = shift;
my $id = shift;
@@ -141,13 +141,55 @@
return $id;
}
+sub create_investigation {
+ my $agent = shift;
+ my $fields = shift || {};
+ my $cfs = shift || {};
+
+ # Must specify a correspondant.
+ $fields->{'Requestors'} ||= $RTIR_TEST_USER;
+
+ go_home($agent);
+
+ $agent->follow_link_ok({text => "Investigations", n => "1"}, "Followed 'Investigations' link");
+
+ $agent->follow_link_ok({text => "New Investigation", n => "1"}, "Followed 'New Investigation' link");
+
+ # set the form
+ $agent->form_number(2);
+
+ while (my ($f, $v) = each %$fields) {
+ $agent->field($f, $v);
+ }
+
+ while (my ($f, $v) = each %$cfs) {
+ set_custom_field($agent, $f, $v);
+ }
+
+ # Create it!
+ $agent->click("Create");
+
+ is ($agent->status, 200, "Attempted to create the ticket");
+
+ # Now see if we succeeded
+ my $content = $agent->content();
+ my $id = -1;
+ if ($content =~ /.*Ticket (\d+) created.*/g) {
+ $id = $1;
+ }
+
+ ok ($id > 0, "Ticket $id created successfully.");
+
+ return $id;
+}
+
sub create_incident_for_ir {
my $agent = shift;
my $ir_id = shift;
my $fields = shift || {};
my $cfs = shift || {};
- display_ir($agent, $ir_id);
+ display_ticket($agent, $ir_id);
# Select the "New" link from the Display page
$agent->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link");
More information about the Rt-commit
mailing list