-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fixes unstable email integration tests, by decoding the raw contents … #25296
Fixes unstable email integration tests, by decoding the raw contents … #25296
Conversation
Hi @hostep. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
I've just noticed that this problem was most likely caused by #23649, where most integration tests got fixed by using Should I update my PR, so it's more consistent with those other replacements? |
Hi @hostep, |
…which had a maximum line length of 76 to a parseable string without a maximum line length, so there is no chance a particular string used in an assertion is getting splitted over multiple lines.
36f482a
to
27e8916
Compare
Changed all occurrences I could find, including the one which was originally already using There is one case left where it's still using |
@magento run Functional Tests |
Looks like functional tests failures not related to your changes. |
Hi @ihor-sviziev, thank you for the review.
|
✔️ QA Passed |
Hi @hostep, thank you for your contribution! |
…which had a maximum line length of 76 to a parseable string without a maximum line length, so there is no chance a particular string used in an assertion is getting splitted over multiple lines.
Description (*)
This problem was discovered during the contribution day in Amsterdam during Magento Live EU 2019
Here are some failing tests which shouldn't fail: https://testing-service.magento-community.engineering/reports/magento/magento2/pull/25183/7ec3a4e1ee9c98d60a692831691dfa57/Integration/allure-report-ce/index.html (only in
Magento\Newsletter\Model\SubscriberTest
&Magento\ProductAlert\Model\ObserverTest
) related to PR #25183The problem here, is that the tests are trying to find a string (for example
You have been successfully subscribed to our newsletter.
) in the html of the email output. But the email output is Quoted-printable. One of the characteristics of this, is that all lines of the email should be maximum 76 characters long. This means that sometimes the string which is being searched for in the integration tests, can be splitted over multiple lines and thus the integration test to fail if some parts of the email get changed by an unrelated change which shifts the characters a bit to the left or the right and causing the searched string to get splitted over 2 lines. So these integration tests are quite unstable.This PR fixes this.
There are actually at least 2 solutions which could work:
quoted_printable_decode
, example test where this already used in Magento$transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
instead of$transportBuilder->getSentMessage()->getRawMessage()
, example test where this already used in MagentoI've chosen the first one, but if it would be better to use the second one, or even another alternative, let me know!
/cc: @okorshenko, @Echron
Difference between the output:
vs
Fixed Issues (if relevant)
None that I could find
Manual testing scenarios (*)
Magento\Newsletter\Model\SubscriberTest::testConfirm
before the assert linecd dev/tests/integration
../../../vendor/bin/phpunit ../../../dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php
Contribution checklist (*)