[Rt-commit] rtir branch, 5.0-trunk, updated. 5.0.0-12-g3aafac3c

? sunnavy sunnavy at bestpractical.com
Thu Jul 16 10:27:20 EDT 2020


The branch, 5.0-trunk has been updated
       via  3aafac3c68370aa61585801784d170795e75a898 (commit)
       via  c41efe25a64c91d18de16ac08be4a694c6c9bba5 (commit)
       via  e12749c5a7402da36e7abc4da19ce16e6a25bf43 (commit)
       via  c96ff4f9e8a48861aaa40b5ea608e7629eb3cbea (commit)
       via  076cd863b275bc057cf6169e0e17301ba50d4581 (commit)
       via  5d4c728552f815b1d117cd6244df423480b71476 (commit)
       via  5655b8754d40ecccc6beb689b9b2a93dee1cc129 (commit)
       via  bb42b466304d86fdf83db0d507e42d38485cbb3e (commit)
       via  092aa3d8666f880194a58f683f88be158dea3151 (commit)
       via  dc3e1497407d7b56d793f5dd87e83f72bf175e40 (commit)
       via  17630f1d3f2d5464c2c56592beee149a7af9ebec (commit)
      from  5f06a45079f48761371af56d73d7db99c639311b (commit)

Summary of changes:
 etc/RTIR_Config.pm                              |   3 +-
 html/Callbacks/RTIR/Elements/MakeClicky/Default |   4 +-
 html/RTIR/Elements/CreateInRTIRQueueModal       |   1 +
 t/015-make-clicky.t                             | 165 +++++++++++++++---------
 4 files changed, 111 insertions(+), 62 deletions(-)

- Log -----------------------------------------------------------------
commit 3aafac3c68370aa61585801784d170795e75a898
Merge: 5f06a450 c41efe25
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jul 16 22:01:27 2020 +0800

    Merge branch '4.0-trunk' into 5.0-trunk

diff --cc html/Callbacks/RTIR/Elements/MakeClicky/Default
index 097d8ab8,e9e7b890..9e08ef2f
--- a/html/Callbacks/RTIR/Elements/MakeClicky/Default
+++ b/html/Callbacks/RTIR/Elements/MakeClicky/Default
@@@ -161,11 -163,11 +163,11 @@@ my %actions
              if ( $r->uri =~ /Lookup.html$/ ) {
                  $result .= qq{<input type="checkbox" name="Requestorbox-$escaped_email" unchecked />};
              }
 -            $result .= qq{<a class="button button-small" href="}.
 -                RT::IR->HREFTo( "CreateInQueue.html"
 +            $result .= qq{ <a class="button btn btn-sm btn-primary" href="}.
 +                RT::IR->HREFTo( "Create.html"
                  . qq{?Incident=$args{'incident'}}
                  . qq{&Lifecycle=}.RT::IR->lifecycle_investigation
-                 . "&Requestors=$escaped_email")
+                 . "&Requestors=$uri_escaped_email")
                  . qq{">}
                  . loc('Investigate to') .qq{</a>};
          }
diff --cc t/015-make-clicky.t
index c064fa95,c8f8d1b6..6ea44da9
--- a/t/015-make-clicky.t
+++ b/t/015-make-clicky.t
@@@ -50,65 -50,120 +50,112 @@@ diag "clicky ip" if $ENV{'TEST_VERBOSE'
  diag "clicky email" if $ENV{'TEST_VERBOSE'};
  {
  
-     for my $email (
-         'foo at example.com',  'foo-bar+baz at example.me',
-         'foo at example.mobi', 'foo at localhost.localhost',
+     for my $create_method_ref (
+         sub { $agent->create_ir( $_[0] ) },
+         sub { $agent->create_incident( $_[0] ) },
+         sub { $agent->create_investigation( $_[0] ) },
+         sub {
+             $_[0]{Incident} = $agent->create_incident(@_);
+             $agent->create_countermeasure( $_[0] );
+         },
        )
      {
-         diag "test valid email $email" if $ENV{TEST_VERBOSE};
-         my ( $name, $domain ) = split /@/, $email, 2;
-         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$/ );
-         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 $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, "not found email link" );
-             ok( !$domain_link, "not found domain link" );
-         }
- 
-     }
- 
-     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.mobi', 'foo at localhost.localhost',
+             )
+         {
+             diag "test valid email $email" if $ENV{TEST_VERBOSE};
+             my ( $name, $domain ) = split /@/, $email, 2;
+             my $uri_escaped_email = $email;
+             RT::Interface::Web::EscapeURI(\$uri_escaped_email);
+ 
+             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=$uri_escaped_email\E/,
+                                                    text_regex => qr/^\Qinvestigate to\E$/i ) if $is_incident;
+ 
+             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=$uri_escaped_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 );
-         if ($email =~ /^(.*)@(.*)$/) {
-             ($name,$domain) = ($1,$2);
          }
-         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, "not found email link for $email" );
-         my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
-         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" );
+ 
+             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 );
-         if ($email =~ /^(.*)@(.*)$/) {
-             ($name,$domain) = ($1,$2);
+         for my $email ( '@example.com' ) {
+             diag "test invalid email (no local part) $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 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, "not found email link for $email" );
-         my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
-         ok( $domain_link, "still found the bare domain for $domain" );
      }
- 
- 
  }
  
  diag "utf8 caching " if $ENV{'TEST_VERBOSE'};

-----------------------------------------------------------------------


More information about the rt-commit mailing list