[Rt-commit] [rtir] 01/01: search menu tests for 2.9/edit-search-regressions
? sunnavy
sunnavy at bestpractical.com
Fri Jul 19 13:11:13 EDT 2013
This is an automated email from the git hooks/post-receive script.
sunnavy pushed a commit to branch 3.0/search-menu-tests
in repository rtir.
commit 3814d6eb0f6ebf423ae7a3e45c3783264626cccc
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Jul 20 01:01:47 2013 +0800
search menu tests for 2.9/edit-search-regressions
it's mainly to test "Edit Search" in #page-navigation of pages like Merge,
Link/FromIncident, Link/ToIncident, Incident "Reply to Reporters" and "Reply
to All".
---
t/searches/menu.t | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 214 insertions(+)
diff --git a/t/searches/menu.t b/t/searches/menu.t
new file mode 100644
index 0000000..0cc9f69
--- /dev/null
+++ b/t/searches/menu.t
@@ -0,0 +1,214 @@
+use strict;
+use warnings;
+
+use RT::IR::Test tests => undef;
+
+RT::Test->started_ok;
+my $m = default_agent();
+
+my %ticket;
+
+for my $subject (qw/foo bar baz/) {
+ for my $type ( 'incident', 'ir', 'investigation', 'block' ) {
+ my $create_sub = "create_$type";
+ push @{ $ticket{$type} },
+ $m->$create_sub(
+ {
+ Subject => "$type $subject",
+ $type eq 'incident' ? () : ( Incident => $ticket{incident}[-1] ),
+ }
+ );
+ }
+}
+
+# Merge
+for my $type ( 'incident', 'ir', 'investigation', 'block' ) {
+ $m->display_ticket( $ticket{$type}[0] );
+ $m->follow_link_ok( { text => 'Merge' } );
+ $m->title_like(qr/Merge .+ #$ticket{$type}[0]:/);
+
+ for my $id ( @{ $ticket{$type} }[ 1 .. 2 ] ) {
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$id$} ), "found link to $type $id" );
+ }
+
+ $m->follow_link_ok( { text => "Edit Search", $type eq 'incident' ? () : ( n => 2 ) } );
+ $m->form_name('BuildQuery');
+ $m->submit_form_ok(
+ {
+ with_fields => { idOp => '!=', ValueOfid => $ticket{$type}[1] },
+ button => 'DoSearch'
+ },
+ "add new term 'id != $ticket{$type}[1]'"
+ );
+ ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[1]$} ),
+ "didn't find link to $type $ticket{$type}[1]" );
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[2]$} ),
+ "found link to $type $ticket{$type}[2]" );
+}
+
+# Link ToIncident
+{
+
+ $m->display_ticket( $ticket{ir}[0] );
+ $m->follow_link_ok( { text => '[Link]' } );
+ $m->title_is("Link Report #$ticket{ir}[0] to selected Incident");
+
+ ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{incident}[0]$} ),
+ "didn't find link to incident $ticket{incident}[0]" );
+ for my $incident_id ( @{ $ticket{incident} }[ 1 .. 2 ] ) {
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$incident_id$} ),
+ "found link to incident $incident_id" );
+ }
+
+ $m->follow_link_ok( { text => "Edit Search", n => 2 } );
+ $m->form_name('BuildQuery');
+ my ($input_query) = $m->find_all_inputs( name => 'Query' );
+ is( $input_query->value, q{( Queue = 'Incidents' ) AND Status = 'open'}, 'Query input is correct' );
+
+ $m->submit_form_ok(
+ {
+ with_fields => { idOp => '!=', ValueOfid => $ticket{incident}[1] },
+ button => 'DoSearch'
+ },
+ "add new term 'id != $ticket{incident}[1]'"
+ );
+ ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{incident}[1]$} ),
+ "didn't find link to incident $ticket{incident}[1]" );
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{incident}[2]$} ),
+ "found link to incident $ticket{incident}[2]" );
+}
+
+# Link FromIncident
+{
+ $m->display_ticket( $ticket{incident}[0] );
+ $m->follow_link_ok( { text => 'Link', url_regex => qr{Link/FromIncident} } );
+ $m->title_is("Link selected Report to Incident #$ticket{incident}[0]");
+
+ ok(
+ !$m->find_link(
+ url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$}
+ ),
+ "didn't find link to incident report $ticket{ir}[0]"
+ );
+
+ for my $ir ( @{ $ticket{ir} }[ 1 .. 2 ] ) {
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ir$} ), "found link to incident report $ir" );
+ }
+
+ $m->follow_link_ok( { text => "Edit Search", n => 2 } );
+ $m->form_name('BuildQuery');
+ my ($input_query) = $m->find_all_inputs( name => 'Query' );
+ is(
+ $input_query->value,
+ q{( Queue = 'Incident Reports' ) AND ( Status = 'new' OR Status = 'open' )},
+ 'Query input is correct'
+ );
+
+ $m->submit_form_ok(
+ {
+ with_fields => { idOp => '!=', ValueOfid => $ticket{ir}[1] },
+ button => 'DoSearch'
+ },
+ "add new term 'id != $ticket{ir}[1]'"
+ );
+
+ ok(
+ !$m->find_link(
+ url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[1]$}
+ ),
+ "didn't find link to incident report $ticket{ir}[1]"
+ );
+
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[2]$} ),
+ "found link to incident report $ticket{ir}[2]" );
+}
+
+# Incident Reply to Reporters
+{
+ $m->display_ticket( $ticket{incident}[0] );
+ $m->follow_link_ok( { text => 'Reply to Reporters' } );
+ $m->title_like(qr/#$ticket{incident}[0]: Reply to Reporters/);
+
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$} ),
+ "found link to incident report $ticket{ir}[0]" );
+
+ for my $type (qw/investigation block/) {
+ ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
+ "didn't find link to $type $ticket{$type}[0]" );
+ }
+
+ $m->form_name('TicketUpdate');
+ my ($checkbox) = $m->find_all_inputs( name => 'SelectedReports' );
+ is( $checkbox->value, $ticket{ir}[0], '$ticket{ir}[0] is checked' );
+
+ $m->follow_link_ok( { text => "Edit Search", n => 2 } );
+ $m->form_name('BuildQuery');
+ $m->submit_form_ok(
+ {
+ with_fields => { idOp => '!=', ValueOfid => $ticket{ir}[0] },
+ button => 'DoSearch'
+ },
+ "add new term 'id != $ticket{ir}[0]'"
+ );
+
+ ok(
+ !$m->find_link(
+ url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$},
+ text => $ticket{ir}[0],
+ n => 2, # there is one in "Attach Reports" widget
+ ),
+ "didn't find link to incident report $ticket{ir}[0]"
+ );
+
+ for my $type (qw/investigation block/) {
+ ok( !$m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
+ "didn't find link to $type $ticket{$type}[0]" );
+ }
+}
+
+# Incident Reply to All
+{
+ $m->display_ticket( $ticket{incident}[0] );
+ $m->follow_link_ok( { text => 'Reply to All' } );
+ $m->title_like(qr/#$ticket{incident}[0]: Reply to All/);
+
+ for my $type (qw/ir investigation block/) {
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
+ "found link to $type $ticket{$type}[0]" );
+ }
+ $m->form_name('TicketUpdate');
+ my ($checkbox) = $m->find_all_inputs( name => 'SelectedReports' );
+ is( $checkbox->value, $ticket{ir}[0], '$ticket{ir}[0] is checked' );
+
+ ($checkbox) = $m->find_all_inputs( name => 'SelectedInvestigations' );
+ is( $checkbox->value, $ticket{investigation}[0], '$ticket{investigation}[0] is checked' );
+
+ ($checkbox) = $m->find_all_inputs( name => 'SelectedBlocks' );
+ is( $checkbox->value, $ticket{block}[0], '$ticket{block}[0] is checked' );
+
+ $m->follow_link_ok( { text => "Edit Search", n => 2 } );
+ $m->form_name('BuildQuery');
+ $m->submit_form_ok(
+ {
+ with_fields => { idOp => '!=', ValueOfid => $ticket{ir}[0] },
+ button => 'DoSearch'
+ },
+ "add new term 'id != $ticket{ir}[0]'"
+ );
+
+ ok(
+ !$m->find_link(
+ url_regex => qr{/Ticket/Display.html\?id=$ticket{ir}[0]$},
+ text => $ticket{ir}[0],
+ n => 2, # there is one in "Attach Reports" widget
+ ),
+ "didn't find link to incident report $ticket{ir}[0]"
+ );
+
+ for my $type (qw/investigation block/) {
+ ok( $m->find_link( url_regex => qr{/Ticket/Display.html\?id=$ticket{$type}[0]$} ),
+ "found link to $type $ticket{$type}[0]" );
+ }
+}
+
+done_testing;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Rt-commit
mailing list