bamboo icon indicating copy to clipboard operation
bamboo copied to clipboard

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

Open maryolivier opened this issue 6 years ago • 4 comments

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?

maryolivier avatar Mar 29 '18 22:03 maryolivier

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.

germsvel avatar Oct 26 '20 13:10 germsvel

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.

michelbieleveld avatar Jan 23 '21 19:01 michelbieleveld

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

aleDsz avatar May 12 '21 16:05 aleDsz

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.

germsvel avatar May 14 '21 13:05 germsvel