[Rt-commit] rt branch, 4.6/ticket-transaction-theme, updated. rt-4.4.4-553-gf45e300180

Blaine Motsinger blaine at bestpractical.com
Fri Dec 13 17:45:50 EST 2019


The branch, 4.6/ticket-transaction-theme has been updated
       via  f45e30018095d37055362275c4575d8254bfbc1a (commit)
      from  d7a15c2265ef8647235ba524887c6a6964e894e9 (commit)

Summary of changes:
 t/web/attach-from-txn.t                  | 14 +++++++-------
 t/web/attachment-with-name-0.t           |  2 +-
 t/web/attachment_dropping.t              |  2 +-
 t/web/attachment_encoding.t              |  6 +++---
 t/web/attachment_truncation.t            |  2 +-
 t/web/attachments.t                      |  4 ++--
 t/web/command_line_ticket_content_type.t |  4 ++--
 t/web/csrf.t                             |  2 +-
 t/web/gnupg-headers.t                    |  4 ++--
 t/web/html_template.t                    |  2 +-
 t/web/ticket_forward.t                   |  8 ++++----
 t/web/ticket_txn_content.t               | 14 +++++++-------
 12 files changed, 32 insertions(+), 32 deletions(-)

- Log -----------------------------------------------------------------
commit f45e30018095d37055362275c4575d8254bfbc1a
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri Dec 13 13:51:17 2019 -0600

    Fix links in tests for icon changes
    
    The change to fontawesome icons for the ticket history links
    removed the text in the links.  This commit updates the tests to
    follow links based on class and url_regex, rather than text.

diff --git a/t/web/attach-from-txn.t b/t/web/attach-from-txn.t
index dd1ebda5c6..8d587b105e 100644
--- a/t/web/attach-from-txn.t
+++ b/t/web/attach-from-txn.t
@@ -40,7 +40,7 @@ $m->content_contains('Attachments test', 'we have subject on the page');
 $m->content_contains('Some content', 'and content');
 
 # Reply with uploaded attachments
-$m->follow_link_ok({text => 'Reply'}, "reply to the ticket");
+$m->follow_link_ok({class => 'reply-link'}, "reply to the ticket");
 $m->content_lacks('AttachExisting');
 $m->form_name('TicketUpdate');
 $m->field('Attach', $LogoFile);
@@ -60,7 +60,7 @@ $m->content_contains("Download $ImageName", 'page has file name');
 RT::Test->fetch_caught_mails;
 
 # Reply to first correspondence, including an attachment
-$m->follow_link_ok({text => 'Reply', n => 3}, "reply to the reply");
+$m->follow_link_ok({class => 'reply-link', n => 2}, "reply to the reply");
 $m->content_contains('AttachExisting');
 $m->content_contains($LogoName);
 $m->content_contains($ImageName);
@@ -82,7 +82,7 @@ $m->content_contains('Here are some attachments');
 $m->content_like(qr/RT-Attach:.+?\Q$ImageName\E/s, 'found rt attach header');
 
 # outgoing looks good
-$m->follow_link_ok({text => 'Show', n => 3}, "found show link");
+$m->follow_link_ok( { url_regex => qr/ShowEmailRecord/, n => 3 } );
 $m->content_like(qr/RT-Attach: \d+/, "found RT-Attach header");
 $m->content_like(qr/RT-Attachment: \d+\/\d+\/\d+/, "found RT-Attachment header");
 $m->content_lacks($ImageName);
@@ -98,7 +98,7 @@ like $mail, qr/RT-Attachment: \d+\/\d+\/\d+/, "found RT-Attachment header";
 like $mail, qr/filename=.?\Q$ImageName\E.?/, "found filename";
 
 # Reply to first correspondence, including an attachment with an uploaded one
-$m->follow_link_ok({text => 'Reply', n => 3}, "reply to the reply");
+$m->follow_link_ok({class => 'reply-link', n => 3}, "reply to the reply");
 $m->form_name('TicketUpdate');
 $m->current_form->find_input('AttachExisting', 'checkbox', 2)->check; # owls.jpg
 $m->field( 'UpdateContent', 'attachments from both list and upload' );
@@ -112,7 +112,7 @@ $m->content_like(qr/(RT-Attach:.+?\Q$ImageName\E).*\1/s, 'found rt attach header
 $m->content_like(qr/Subject:.+?\Q$LogoName\E/s, 'found rt attach header');
 
 # outgoing looks good
-$m->follow_link_ok({text => 'Show', n => 4}, "found show link");
+$m->follow_link_ok( { url_regex => qr/ShowEmailRecord/, n => 4 } );
 $m->content_like(qr/RT-Attach: \d+/, "found RT-Attach header");
 $m->content_like(qr/RT-Attachment: \d+\/\d+\/\d+/, "found RT-Attachment header");
 $m->content_lacks($ImageName);
@@ -130,7 +130,7 @@ like $mail, qr/filename=.?\Q$ImageName\E.?/, "found selected filename";
 like $mail, qr/filename=.?\Q$LogoName\E.?/, "found uploaded filename";
 
 # add header to template, make a normal reply, and see that it worked
-my $link = $m->find_link(text_regex => qr/\Q$LogoName\E/, url_regex => qr/Attachment/);
+my $link = $m->find_link( url_regex => qr/Attachment\/\d+\/\d+\/$LogoName/ );
 ok $link;
 my ($LogoId) = $link->url =~ /Attachment\/\d+\/(\d+)/;
 ok $LogoId;
@@ -142,7 +142,7 @@ $template->SetContent( "RT-Attach: $LogoId\n" . $template->Content );
 like $template->Content, qr/RT-Attach:/, "updated template";
 
 # reply...
-$m->follow_link_ok({text => 'Reply'}, "reply to the ticket");
+$m->follow_link_ok({class => 'reply-link'}, "reply to the ticket");
 $m->form_name('TicketUpdate');
 $m->field('UpdateContent', 'who gives a hoot');
 $m->click('SubmitTicket');
diff --git a/t/web/attachment-with-name-0.t b/t/web/attachment-with-name-0.t
index 12a8dd5485..f128c0abba 100644
--- a/t/web/attachment-with-name-0.t
+++ b/t/web/attachment-with-name-0.t
@@ -19,5 +19,5 @@ $m->submit_form(
     fields => { Subject => 'test att 0', Content => 'test', Attach => $file },
 );
 $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
-$m->follow_link_ok( { text => 'Download 0' } );
+$m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\/0/ } );
 $m->content_contains( 'foobar', 'file content' );
diff --git a/t/web/attachment_dropping.t b/t/web/attachment_dropping.t
index 80a7c6f217..7c7a1e77bc 100644
--- a/t/web/attachment_dropping.t
+++ b/t/web/attachment_dropping.t
@@ -45,7 +45,7 @@ is( $m->status, 200, "request successful" );
 
 $m->content_contains( "File '$name' dropped because its size (1010 bytes) exceeded configured maximum size setting (1000 bytes).", 'dropped message' );
 $m->content_lacks( 'cfaaaa', 'cf value was dropped' );
-$m->follow_link_ok( { text => "Download $name" } );
+$m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\/$name/ } );
 is( $m->content, 'Large attachment dropped', 'dropped $name' );
 
 done_testing;
diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index 3f7d6d1cf9..ecfbe50b08 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -23,7 +23,7 @@ diag 'test without attachments' if $ENV{TEST_VERBOSE};
         fields      => { Subject => $subject, Content => $content },
     );
     $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
-    $m->follow_link_ok( { text => 'with headers' },
+    $m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/ },
         '-> /Ticket/Attachment/WithHeaders/...' );
     $m->content_contains( $subject, "has subject $subject" );
     $m->content_contains( $content, "has content $content" );
@@ -61,7 +61,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
     $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
     $m->content_contains( $filename, 'attached filename' );
     $m->content_lacks( Encode::encode("UTF-8",$filename), 'no double encoded attached filename' );
-    $m->follow_link_ok( { text => 'with headers' },
+    $m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/ },
         '-> /Ticket/Attachment/WithHeaders/...' );
 
     # subject is in the parent attachment, so there is no 标题
@@ -82,7 +82,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
 
     $m->back;
     $m->back;
-    $m->follow_link_ok( { text => "Download $filename" },
+    $m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\// },
         '-> /Ticket/Attachment/...' );
     $m->content_contains( $filename, "has file content $filename" );
 
diff --git a/t/web/attachment_truncation.t b/t/web/attachment_truncation.t
index 1a2356bcb5..0725d444f2 100644
--- a/t/web/attachment_truncation.t
+++ b/t/web/attachment_truncation.t
@@ -45,7 +45,7 @@ is( $m->status, 200, "request successful" );
 $m->content_contains( "File '$name' truncated because its size (1010 bytes) exceeded configured maximum size setting (1000 bytes).", 'truncated message' );
 $m->content_contains( 'cf' . 'a' x 998, 'has the first 1000 cf chars' );
 $m->content_lacks( 'aaacfb', 'lacks cf chars after that' );
-$m->follow_link_ok( { text => "Download $name" } );
+$m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\/$name/ } );
 $m->content_contains( 'a' x 1000, 'has the first 1000 chars' );
 $m->content_lacks( 'b', 'lacks chars after that' );
 
diff --git a/t/web/attachments.t b/t/web/attachments.t
index d03d0a0b58..de7591f94b 100644
--- a/t/web/attachments.t
+++ b/t/web/attachments.t
@@ -466,13 +466,13 @@ diag "check content type and content";
     $m->content_contains('Download bpslogo.png', 'page has file name');
     $m->content_contains('Download mobile.css', 'page has file name');
 
-    $m->follow_link_ok({text => "Download bpslogo.png"});
+    $m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\/bpslogo\.png/ } );
     is($m->response->header('Content-Type'), 'image/png', 'Content-Type of png lacks charset' );
     is($m->content_type, "image/png");
     is($m->content, RT::Test->file_content(LogoFile), "Binary content matches");
     $m->back;
 
-    $m->follow_link_ok( { text => 'Download mobile.css' } );
+    $m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\/mobile\.css/ } );
     is( $m->response->header('Content-Type'),
         'text/css;charset=UTF-8',
         'Content-Type of text has charset',
diff --git a/t/web/command_line_ticket_content_type.t b/t/web/command_line_ticket_content_type.t
index b37d0c4812..8537e49258 100644
--- a/t/web/command_line_ticket_content_type.t
+++ b/t/web/command_line_ticket_content_type.t
@@ -31,7 +31,7 @@ for my $content_type ( 'text/plain', 'text/html' ) {
     ok( $id, "got ticket $id" );
 
     $m->goto_ticket($id);
-    $m->follow_link_ok( { text => 'with headers', n => 1 } );
+    $m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/, n => 1 } );
     $m->content_contains( "Content-Type: $content_type", 'content-type' );
 
     expect_send(
@@ -41,7 +41,7 @@ for my $content_type ( 'text/plain', 'text/html' ) {
     expect_like( qr/Comments added/, "commented the ticket" );
 
     $m->goto_ticket($id);
-    $m->follow_link_ok( { text => 'with headers', n => 2 } );
+    $m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/, n => 2 } );
     $m->content_contains( "Content-Type: $content_type", 'content-type' );
 }
 
diff --git a/t/web/csrf.t b/t/web/csrf.t
index bdd895d92d..4abfb4d14d 100644
--- a/t/web/csrf.t
+++ b/t/web/csrf.t
@@ -197,7 +197,7 @@ $m->content_contains("Possible cross-site request forgery");
 $m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
 $m->follow_link(text_regex => qr{resume your request});
 $m->content_contains('Download bpslogo.png', 'page has file name');
-$m->follow_link_ok({text => "Download bpslogo.png"});
+$m->follow_link_ok( { url_regex => qr/Attachment\/\d+\/\d+\/bpslogo\.png/ } );
 is($m->content, $logo_contents, "Binary content matches");
 
 
diff --git a/t/web/gnupg-headers.t b/t/web/gnupg-headers.t
index 03e60901ea..95f342233c 100644
--- a/t/web/gnupg-headers.t
+++ b/t/web/gnupg-headers.t
@@ -33,7 +33,7 @@ $m->field( 'Subject', 'Signing test' );
 $m->field( 'Content', 'Some other content' );
 $m->submit;
 $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
-$m->follow_link_ok( { text => 'with headers' } );
+$m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/ } );
 $m->content_contains('X-RT-Encrypt: 0');
 $m->content_contains('X-RT-Sign: 0');
 
@@ -47,7 +47,7 @@ $m->tick( 'Encrypt', 1 );
 $m->tick( 'Sign',    1 );
 $m->submit;
 $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
-$m->follow_link_ok( { text => 'with headers' } );
+$m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/ } );
 $m->content_contains('X-RT-Encrypt: 1');
 $m->content_contains('X-RT-Sign: 1');
 
diff --git a/t/web/html_template.t b/t/web/html_template.t
index 1dbe66b00c..89a490d911 100644
--- a/t/web/html_template.t
+++ b/t/web/html_template.t
@@ -46,7 +46,7 @@ diag('create a ticket to see the autoreply mail') if $ENV{TEST_VERBOSE};
         ContentType => 'text/html' },
     );
     $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
-    $m->follow_link( text => 'Show' );
+    $m->follow_link( url_regex => qr/ShowEmailRecord/ );
     $m->content_contains( $template, "html has $template" );
     $m->content_contains( $subject,
         "html has ticket subject $subject" );
diff --git a/t/web/ticket_forward.t b/t/web/ticket_forward.t
index c0c740ec52..93eb85279f 100644
--- a/t/web/ticket_forward.t
+++ b/t/web/ticket_forward.t
@@ -58,7 +58,7 @@ diag "Forward Ticket" if $ENV{TEST_VERBOSE};
 
 diag "Forward Transaction" if $ENV{TEST_VERBOSE};
 {
-    $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+    $m->follow_link_ok( { class => 'forward-link', n => 1 }, 'follow 2nd Forward' );
     $m->submit_form(
         form_name => 'ForwardMessage',
         fields    => {
@@ -130,7 +130,7 @@ diag "Forward Transaction with attachments but empty content" if $ENV{TEST_VERBO
     $m->content_like( qr/image\/png/,       'uploaded image file content type' );
     RT::Test->clean_caught_mails;
 
-    $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+    $m->follow_link_ok( { class => 'forward-link', n => 1 }, 'follow 2nd Forward' );
     $m->submit_form(
         form_name => 'ForwardMessage',
         fields    => {
@@ -187,7 +187,7 @@ diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_V
     RT::Test->clean_caught_mails;
 
     # Forward txn
-    $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+    $m->follow_link_ok( { class => 'forward-link', n => 1 }, 'follow 2nd Forward' );
     $m->submit_form(
         form_name => 'ForwardMessage',
         fields    => {
@@ -263,7 +263,7 @@ diag "Forward Ticket Template with a Subject: line" if $ENV{TEST_VERBOSE};
 
 diag "Forward Transaction with non-ascii subject" if $ENV{TEST_VERBOSE};
 {
-    $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+    $m->follow_link_ok( { class => 'forward-link', n => 1 }, 'follow 2nd Forward' );
     my $subject = Encode::decode("UTF-8", 'test non-ascii äöü');
     $m->submit_form(
         form_name => 'ForwardMessage',
diff --git a/t/web/ticket_txn_content.t b/t/web/ticket_txn_content.t
index 096d78e314..282b8d9451 100644
--- a/t/web/ticket_txn_content.t
+++ b/t/web/ticket_txn_content.t
@@ -57,19 +57,19 @@ for my $type ( 'text/plain', 'text/html' ) {
     $m->content_contains("Download $plain_name", 'download plain file link' );
 
     # Check for Message-IDs
-    follow_parent_with_headers_link($m, text => 'with headers', n => 1);
+    follow_parent_with_headers_link($m, url_regex => qr/Attachment\/WithHeaders\//, n => 1);
     $m->content_like(qr/^Message-ID:/im, 'create content has one Message-ID');
     $m->content_unlike(qr/^Message-ID:.+?Message-ID:/ism, 'but not two Message-IDs');
     $m->back;
 
-    follow_with_headers_link($m, text => "Download $plain_name", n => 1);
+    follow_with_headers_link($m, url_regex => qr/Attachment\/\d+\/\d+\/$plain_name/, n => 1);
     $m->content_unlike(qr/^Message-ID:/im, 'attachment lacks a Message-ID');
     $m->back;
 
     my ( $mail ) = RT::Test->fetch_caught_mails;
     like( $mail, qr/this is main content/, 'email contains main content' );
     # check the email link in page too
-    $m->follow_link_ok( { text => 'Show' }, 'show the email outgoing' );
+    $m->follow_link_ok( { url_regex => qr/ShowEmailRecord/ }, 'show the email outgoing' );
     $m->content_contains('this is main content', 'email contains main content');
     $m->back;
 
@@ -92,23 +92,23 @@ for my $type ( 'text/plain', 'text/html' ) {
     $m->content_contains("Download $html_name", 'download html file link' );
 
     # Check for Message-IDs
-    follow_parent_with_headers_link($m, text => 'with headers', n => 2);
+    follow_parent_with_headers_link($m, url_regex => qr/Attachment\/WithHeaders\//, n => 2);
     $m->content_like(qr/^Message-ID:/im, 'correspondence has one Message-ID');
     $m->content_unlike(qr/^Message-ID:.+?Message-ID:/ism, 'but not two Message-IDs');
     $m->back;
 
-    follow_with_headers_link($m, text => "Download $plain_name", n => 2);
+    follow_with_headers_link($m, url_regex => qr/Attachment\/\d+\/\d+\/$plain_name/, n => 2);
     $m->content_unlike(qr/^Message-ID:/im, 'text/plain attach lacks a Message-ID');
     $m->back;
 
-    follow_with_headers_link($m, text => "Download $html_name", n => 1);
+    follow_with_headers_link($m, url_regex => qr/Attachment\/\d+\/\d+\/$html_name/, n => 1);
     $m->content_unlike(qr/^Message-ID:/im, 'text/html attach lacks a Message-ID');
     $m->back;
 
     ( $mail ) = RT::Test->fetch_caught_mails;
     like( $mail, qr/this is main reply content/, 'email contains main reply content' );
     # check the email link in page too
-    $m->follow_link_ok( { text => 'Show', n => 2 }, 'show the email outgoing' );
+    $m->follow_link_ok( { url_regex => qr/ShowEmailRecord/, n => 2 }, 'show the email outgoing' );
     $m->content_contains("this is main reply content", 'email contains main reply content');
     $m->back;
 }

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


More information about the rt-commit mailing list