beam-community / bamboo

Testable, composable, and adapter based Elixir email library for devs that love piping.
https://hex.pm/packages/bamboo
MIT License
1.91k stars 345 forks source link

As a developer using TestAdapter, would like way to access full html of sent emails #357

Closed maryolivier closed 3 weeks ago

maryolivier commented 6 years ago

My unit tests use TestAdapter, but I have a few integration test scenarios where I need to check the generated text within the email (not assert that there is an argument match), and I can only seemingly do this through the SentEmailViewerPlug, which requires the LocalAdapter.

Is there a way to check generated html of an email within TestAdapter?

germsvel commented 4 years ago

Hi @maryolivier thanks for opening this issue and thanks for the patience. I'm beginning to maintain Bamboo, and I'm going through all the issues.

Is this still something you're interested in? If so, could you provide more context as to what you're trying to do with the full email? I'd be happy to review a PR if you feel up for it and if it's still relevant to you.

michelbieleveld commented 3 years ago

I will likely implement a work around, but just adding that I have the same need. An example use case is for an integration test for a password reset function. The function sends an email to the requested address with a token in the body. Ideally I would be able to extract this token from the email so the reset function can be tested.

My preference would be something similar as assert_email_delivered_with except that it wouldn't assert only returns a list of emails that match the criteria.

aleDsz commented 3 years ago

A good implementation would extract the full html and test the element using floki and get the element by tags and assert if content has the token, right? @michelbieleveld

germsvel commented 3 years ago

Yeah, I see how that would be a good use case @michelbieleveld. If someone is up for it, I'd be happy to review a PR for this.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet. If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.

github-actions[bot] commented 3 weeks ago

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!