bamboo
bamboo copied to clipboard
As a developer using TestAdapter, would like way to access full html of sent emails
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?
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.
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.
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
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.