[Rt-commit] rtir branch, 4.0/correspondents-from-makeclicky, repushed
Brian Duggan
brian at bestpractical.com
Fri Jun 8 18:26:31 EDT 2018
The branch 4.0/correspondents-from-makeclicky was deleted and repushed:
was 9e6fce65c33296443245781c6efa163e189ffd09
now d5f3bd2d7d38ae3ee877a75fc6751eca099ea12e
1: bcb13751 < -: ------- Update MakeClicky test text for readability
2: d3de9323 ! 1: e1d3b6a7 Test Correspondents field on 'Investigate to' investigation creation
@@ -1,16 +1,64 @@
Author: Brian C. Duggan <brian at bestpractical.com>
- Test for MakeClicky email links on all RTIR ticket types
-
- All RTIR ticket types get 'Lookup email' and 'Lookup email-domain'
- links when MakeClicky email is enabled. This change tests Incident
- Reports, Incidents, Investigations, and Countermeaures for these links
- instead of just Incident Reports.
+ Test Correspondents field on 'Investigate to' investigation creation
+
+ MakeClicky 'Investigate to' links should load a queue selection page
+ for investigation creation.
+
+ That queue selection page form should lead to an investigation
+ creation page.
+
+ The Correspondents field on that investigation creation page should be
+ populated with the MakeClicky 'Investigate to' email address.
+
+ This change tests all four RTIR ticket types. It also adds tests the
+ 'Investigate to' link workflow. It removes testing the
+ 'foo-bar+baz at example.me' email address because this workflow does not
+ currently properly URI-escape Requestors args.
diff --git a/t/015-make-clicky.t b/t/015-make-clicky.t
--- a/t/015-make-clicky.t
+++ b/t/015-make-clicky.t
@@
+ my @links = $agent->followable_links;
+ if ( $clicky{'ip'} ) {
+ my ($lookup_link) = grep lc($_->text||'') eq 'lookup ip', @links;
+- ok($lookup_link, "found link");
+- ok($lookup_link->url =~ /(?<!\d)1\.0\.0\.0(?!\d)/, 'url has an ip' );
++ ok($lookup_link, "Found link for IP address");
++ ok($lookup_link->url =~ /(?<!\d)1\.0\.0\.0(?!\d)/, 'Found IP address in URL' );
+ } else {
+- ok(!grep( lc $_->text eq 'lookup ip', @links ), "not found link");
++ ok(!grep( lc $_->text eq 'lookup ip', @links ), "Didn't find link for IP address");
+ }
+
+ $id = $agent->create_ir( { Subject => 'clicky ip', Content => '255.255.255.255' } );
+@@
+ @links = $agent->followable_links;
+ if ( $clicky{'ip'} ) {
+ my ($lookup_link) = grep lc($_->text||'') eq 'lookup ip', @links;
+- ok($lookup_link, "found link");
+- ok($lookup_link->url =~ /(?<!\d)255\.255\.255\.255(?!\d)/, 'url has an ip' );
++ ok($lookup_link, "Found link for IP address");
++ ok($lookup_link->url =~ /(?<!\d)255\.255\.255\.255(?!\d)/, 'Found IP address in URL' );
+ } else {
+- ok(!grep( lc $_->text eq 'lookup ip', @links ), "not found link");
++ ok(!grep( lc $_->text eq 'lookup ip', @links ), "Didn't find link for IP address");
+ }
+
+ $id = $agent->create_ir( { Subject => 'clicky ip', Content => '255.255.255.256' } );
+ $agent->display_ticket( $id);
+ @links = $agent->followable_links;
+- ok(!grep( lc($_->text||'') eq 'lookup ip', @links ), "not found link");
++ ok(!grep( lc($_->text||'') eq 'lookup ip', @links ), "Didn't find link for IP address");
+
+ $id = $agent->create_ir( { Subject => 'clicky ip', Content => '355.255.255.255' } );
+ $agent->display_ticket( $id);
+ @links = $agent->followable_links;
+- ok(!grep( lc($_->text||'') eq 'lookup ip', @links ), "not found link");
++ ok(!grep( lc($_->text||'') eq 'lookup ip', @links ), "Didn't find link for IP address");
+ }
+
diag "clicky email" if $ENV{'TEST_VERBOSE'};
{
@@ -36,14 +84,14 @@
- my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
- $agent->save_content('/tmp/x.html');
- if ( $clicky{'email'} ) {
-- ok( $email_link, "Found link for $email_link" );
-- ok( $email_link->url =~ /(?<!\w)\Qq=$email\E(?!\w)/, 'URL link '.$email_link->url.' has an email address: '.$email );
-- ok( $domain_link, "Found link for URL domain" );
-- ok( $domain_link->url =~ /(?<!\w)\Q$domain\E(?!\w)/, 'URL link has a domain' );
+- ok( $email_link, "found link $email_link" );
+- ok( $email_link->url =~ /(?<!\w)\Qq=$email\E(?!\w)/, 'url '.$email_link->url.' has an email - '.$email );
+- ok( $domain_link, "found link" );
+- ok( $domain_link->url =~ /(?<!\w)\Q$domain\E(?!\w)/, 'url has a domain' );
- }
- else {
-- ok( !$email_link, "Didn't find link for email address" );
-- ok( !$domain_link, "Didn't find link for domain" );
+- ok( !$email_link, "not found email link" );
+- ok( !$domain_link, "not found domain link" );
- }
-
- }
@@ -51,27 +99,63 @@
- for my $email ( 'foo at example') {
- diag "test invalid email (invalid domain) $email" if $ENV{TEST_VERBOSE};
+ for my $email (
-+ 'foo at example.com', 'foo-bar+baz at example.me',
++ 'foo at example.com',
+ 'foo at example.mobi', 'foo at localhost.localhost',
+ )
+ {
+ diag "test valid email $email" if $ENV{TEST_VERBOSE};
+ my ( $name, $domain ) = split /@/, $email, 2;
++
+ my $id =
+ $create_method_ref->( { Subject => 'clicky email', Content => $email } );
+ $agent->display_ticket($id);
++
++ my $is_incident = $agent->text() =~ qr/Queue: Incidents/;
++
+ my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
+ my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
++
++ my $investigate_link = $agent->find_link( url_regex => qr/\QRequestors=$email\E/,
++ text_regex => qr/^\Qinvestigate to\E$/i ) if $is_incident;
++
+ $agent->save_content('/tmp/x.html');
+ if ( $clicky{'email'} ) {
+ ok( $email_link, "Found link for $email_link" );
+ ok( $email_link->url =~ /(?<!\w)\Qq=$email\E(?!\w)/, 'URL link '.$email_link->url.' has an email address: '.$email );
+ ok( $domain_link, "Found link for URL domain" );
+ ok( $domain_link->url =~ /(?<!\w)\Q$domain\E(?!\w)/, 'URL link has a domain' );
++
++ # Test that 'Investigate to' links go to the queue selection page for creating incidents.
++ # Then test that the new investigation form on that page loads the investigation creation page.
++ # Then test taht the Correspondents field is populated with the given email address.
++ if ( $is_incident ) {
++ ok( $investigate_link, "found investigate link" );
++ ok( $investigate_link->url =~ /(?<!\w)\QRequestors=$email\E(?!\w)/,
++ 'url '.$investigate_link->url.' has Requestors email' );
++ $agent->follow_link_ok( { url => $investigate_link->url }, 'followed "investigate to" link' );
++ $agent->title_is( 'Select Queue for New Investigation',
++ 'selecting queue for new investigation' );
++ $agent->submit_form_ok(
++ {
++ form_id => 'CreateInQueue',
++ },
++ 'submitted new investigation form',
++ );
++ $agent->title_is( 'Launch a new investigation', 'launching a new investigation' );
++ $agent->form_name( 'TicketCreate' );
++ my @correspondents = $agent->find_all_inputs(
++ name => 'Requestors',
++ type => 'text',
++ value => $email,
++ );
++ ok($correspondents[0], 'Found an email address');
++ is($correspondents[0]->value, $email, 'Email is correct: ' . $correspondents[0]->value);
++ }
+ }
+ else {
+ ok( !$email_link, "Didn't find link for email address" );
+ ok( !$domain_link, "Didn't find link for domain" );
++ ok( !$investigate_link, "Didn't find 'Investigate to' link") if $is_incident;
+ }
- my ( $name, $domain );
@@ -81,27 +165,34 @@
- my $id = $agent->create_ir( { Subject => 'clicky email', Content => $email } );
- $agent->display_ticket($id);
- my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
-- ok( !$email_link, "Didn't find an email link for $email" );
+- ok( !$email_link, "not found email link for $email" );
- my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
-- ok( !$domain_link, "Didn't find a domain link for $domain" );
+- ok( !$domain_link, "not found domain link for $domain" );
- }
+-
+-
+- for my $email ( '@example.com' ) {
+- diag "test invalid email (no local part) $email" if $ENV{TEST_VERBOSE};
+ for my $email ( 'foo at example') {
+ diag "test invalid email (invalid domain) $email" if $ENV{TEST_VERBOSE};
-
++
+ my ( $name, $domain );
+ if ($email =~ /^(.*)@(.*)$/) {
+ ($name,$domain) = ($1,$2);
+ }
+ my $id = $create_method_ref->( { Subject => 'clicky email', Content => $email } );
+ $agent->display_ticket($id);
++ my $is_incident = $agent->text() =~ qr/Queue: Incidents/;
+ my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
+ ok( !$email_link, "Didn't find an email link for $email" );
+ my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
+ ok( !$domain_link, "Didn't find a domain link for $domain" );
-
-- for my $email ( '@example.com' ) {
-- diag "test invalid email (no local part) $email" if $ENV{TEST_VERBOSE};
++
++ my $investigate_link = $agent->find_link( url_regex => qr/\QRequestors=$email\E/,
++ text_regex => qr/^\Qinvestigate to\E$/i )
++ if $is_incident;
++ ok( !$investigate_link, "Didn't find 'Investigate to' link for $email" );
+ }
- my ( $name, $domain );
@@ -116,17 +207,22 @@
+ }
+ my $id = $create_method_ref->( { Subject => 'clicky email', Content => $email } );
+ $agent->display_ticket($id);
++ my $is_incident = $agent->text() =~ qr/Queue: Incidents/;
+ my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
+ ok( !$email_link, "Didn't find link for $email" );
+ my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
+ ok( $domain_link, "Found the bare domain for $domain" );
++ my $investigate_link = $agent->find_link( url_regex => qr/\QRequestors=$email\E/,
++ text_regex => qr/^\Qinvestigate to\E$/i )
++ if $is_incident;
++ ok( !$investigate_link, "Didn't find 'Investigate to' link for $email" );
}
- my $id = $agent->create_ir( { Subject => 'clicky email', Content => $email } );
- $agent->display_ticket($id);
- my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
-- ok( !$email_link, "Didn't find link for $email" );
+- ok( !$email_link, "not found email link for $email" );
- my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
-- ok( $domain_link, "Found the bare domain for $domain" );
+- ok( $domain_link, "still found the bare domain for $domain" );
}
-
-
3: d57c7c59 < -: ------- Do not test emails with special characters for MakeClicky links
4: a512a310 < -: ------- Test for 'Investigate to' links next to MakeClicky email adddresses
5: 6db6e97e < -: ------- Test Correspondents field on 'Investigate to' investigation creation
6: 9e6fce65 ! 2: b8a6415d Pass Requestors through queue selection modal if provided
@@ -30,3 +30,4 @@
+$Requestors => undef
</%ARGS>
+
-: ------- > 3: 515c14ed Test emails with +tags for 'Investigate to' MakeClicky links
-: ------- > 4: d5f3bd2d Handle emails with +tags in 'Investigate to' MakeClicky links
More information about the rt-commit
mailing list