Skip to content

Add email support test case to mailer shared examples#8017

Merged
aduth merged 2 commits intomainfrom
aduth-test-assert-email-support
Mar 20, 2023
Merged

Add email support test case to mailer shared examples#8017
aduth merged 2 commits intomainfrom
aduth-test-assert-email-support

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Mar 17, 2023

🛠 Summary of changes

Enhances existing mailer shared example specs to include checks for content which may not be broadly supported in email clients. Currently, this includes a check for use of SVG images, which would be encouraged in application views, but which does not have broad support in email clients.

Previously:

📜 Testing Plan

Trigger a failure by adding a violating image to an email template in your local copy of the branch.

Example:

diff --git a/app/views/user_mailer/add_email.html.erb b/app/views/user_mailer/add_email.html.erb
index 6b31c0f2f..527bcd73c 100644
--- a/app/views/user_mailer/add_email.html.erb
+++ b/app/views/user_mailer/add_email.html.erb
@@ -3,6 +3,7 @@
   <%= t('user_mailer.add_email.footer', confirmation_period: @confirmation_period) %>
 </p>
 
+<%= image_tag(asset_url('logo.svg')) %>
 <table class="button expanded large radius">
   <tbody>
     <tr>
$ rspec spec/mailers/user_mailer_spec.rb 

Failures:

  1) UserMailer#add_email behaves like a system email does not include markup or layout with lack of broad email support
     Failure/Error: expect(body).not_to have_css('img[src$=".svg"]')
       expected not to find visible css "img[src$=\".svg\"]", found 1 match: ""
     Shared Example Group: "a system email" called from ./spec/mailers/user_mailer_spec.rb:32
     # ./spec/support/shared_examples_for_mailer.rb:10:in `block (2 levels) in <main>'

changelog: Internal, Automated Testing, Enhance mailer tests to check for email client support features
@aduth aduth requested a review from allthesignals March 17, 2023 18:16
For future recall
Copy link
Contributor

@allthesignals allthesignals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@allthesignals
Copy link
Contributor

Any other common mailer/web support discrepancies that might have come up in the past?

@aduth
Copy link
Contributor Author

aduth commented Mar 20, 2023

Any other common mailer/web support discrepancies that might have come up in the past?

I'm sure there are, but none which come to mind at the moment. But I left the test description intentionally broad so that we can add more assertions as we encounter them.

@aduth aduth merged commit 8259acd into main Mar 20, 2023
@aduth aduth deleted the aduth-test-assert-email-support branch March 20, 2023 12:05
soniaconnolly added a commit that referenced this pull request Mar 20, 2023
* LG-8887: In-Person Proofing: Add Login.gov logo above the Barcode (#7956)

* WIP commit of half-baked changes for showing logo

These are not yet functional

* changelog: User-Facing Improvements, In-Person Proofing, Display Login.gov logo above barcode in email

* Include asset_url

* Revert "Include asset_url"

This reverts commit a4612d2.

* Revert "changelog: User-Facing Improvements, In-Person Proofing, Display Login.gov logo above barcode in email"

This reverts commit 2f5326c.

* Revert "WIP commit of half-baked changes for showing logo"

This reverts commit c8d3af5.

* WIP

* Display miniature logo inside mailer and component view

* Add a little padding

* Drop skip_pipeline; simplify styles

* Add image assertion

* Allow alternative extensions

---------

Co-authored-by: Sheldon Bachstein <sheldon.bachstein@gsa.gov>

* LG-8788: Refactor address search controller (#7820)

* changelog: Internal, In-Person Proofing, refactor some error reporting (analytics

* Add server error to address search controller

* refactor

---------

Co-authored-by: Eileen McFarland <eileenmcfarland@navapbc.com>

* Revert "Remove send link step (#7929)" (#8019)

This reverts commit 8340d0a.

This caused errors in prod from the send_link route, which shouldn't be happening. Possibly because of the 50/50 state. Reverting pending further research.

* Correct analytics name send_link to link_sent (#8022)

* Correct analytics name for link sent event to 'IdV: doc auth link_sent submitted' from 'IdV: doc auth send_link submitted'

[skip changelog]

* Add email support test case to mailer shared examples (#8017)

* Add email support test case to mailer shared examples

changelog: Internal, Automated Testing, Enhance mailer tests to check for email client support features

* Link support reference

For future recall

* Fix spec flake in GpoConfirmationUploader (#8024)


changelog: Internal, Tests, Fix test that flaked due to clock drift

* Clean up spec to stop stubbing .new

* Revert "Merge pull request #8016 from 18F/stages-rc-2023-03-17-revert"

This reverts commit 4c8419f, reversing
changes made to 3741fd7.

---------

Co-authored-by: Matt Gardner <wilburnforce@gmail.com>
Co-authored-by: Sheldon Bachstein <sheldon.bachstein@gsa.gov>
Co-authored-by: Eileen McFarland <eileenmcfarland@navapbc.com>
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants