-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Add missing DOM ids to rails/mailers/email.html template #42470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing DOM ids to rails/mailers/email.html template #42470
Conversation
I think this makes sense, but what is stopping you from using your own template instead of the generated one? |
@@ -56,35 +56,35 @@ | |||
<dl> | |||
<% if @email.respond_to?(:smtp_envelope_from) && Array(@email.from) != Array(@email.smtp_envelope_from) %> | |||
<dt>SMTP-From:</dt> | |||
<dd><%= @email.smtp_envelope_from %></dd> | |||
<dd id="smtp-from"><%= @email.smtp_envelope_from %></dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe namespacing these to email
to ensure their uniqueness?
I'm not sure if we should use underscores or dashes.
<dd id="smtp-from"><%= @email.smtp_envelope_from %></dd> | |
<dd id="email-smtp-from"><%= @email.smtp_envelope_from %></dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p8 I was thinking about this approach but eventually decided not to do it because of existing DOM elements on this page which don't have that email-
prefix in id attributes here, here and here.
Changing it everywhere and adding email-
prefix to each element doesn't make this PR fully backwards-compatible. Let me know what do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p8 PR has been updated to follow existing naming convention for id attributes(underscore). Thanks for noticing the inconsistency
Just trying to reduce the boilerplate - I have several Rails apps and they all have a similar specs/testing stack. |
id attribute values have been updated to follow existing(underscrore) convention.
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Summary
Instead of using Capybara/Selenium my team uses Cypress for all end to end tests. We have a test that checks that all Mailer Preview actions of all mailers could be opened and rendered without an error. This helped us to catch bugs earlier because there are lots of mailer and mailer actions.
The issue that we faced was that important most of the
dd
elements like(to, from, subject etc) were really hard to get to in DOM because they didn't have a unique selector. This PR fixes it.Below is what our Cypress test look like:
Other Information
Attachment elements weren't updated because they already have
download
attribute with a file name.I've used markup validator from https://validator.w3.org/ and it didn't find any errors or warnings related to this update.
Below is a screenshot of a very simplified test run in Cypress: