Description
Preconditions
- Magento 2.3.0 dev
- Manually install MFTF into dev folder (using magento2 2.2-develop latest)
- Virtual Host setup with https and a self signed certificate (in my case it's https://magento22mftfcombine.test/)
Steps to reproduce
- Run a test that uses the Magento API. For example, the checkout test uses the API to create a category and a product before it starts interacting with the UI.
vendor/bin/robo group checkout
Expected result
- Both "checkout" test should run without any errors.
Actual result
I get this result in the cli:
`[Exec] Running ./vendor/bin/codecept run functional --verbose --steps --skip-group skip --group checkout
Codeception PHP Testing Framework v2.3.8
Powered by PHPUnit 6.5.6 by Sebastian Bergmann and contributors.
[Groups] checkout
Magento\FunctionalTestingFramework.functional Tests (2) ------------------
Modules: \Magento\FunctionalTestingFramework\Module\MagentoWebDriver, \Magento\FunctionalTestingFramework\Helper\Acceptance, \Magento\FunctionalTestingFramework\Helper\MagentoFakerData, \Magento\FunctionalTestingFramework\Module\MagentoRestDriver, PhpBrowser, \Magento\FunctionalTestingFramework\Module\MagentoSequence, Asserts
StorefrontCustomerCheckoutTestCest: Storefront customer checkout test
Signature: Magento\AcceptanceTest_generated\Backend\StorefrontCustomerCheckoutTestCest:StorefrontCustomerCheckoutTest
Test: tests/functional/Magento/FunctionalTest/_generated/StorefrontCustomerCheckoutTestCest.php:StorefrontCustomerCheckoutTest
Scenario --
I am going to create entity that has the stepKey: simplecategory
ERROR
StorefrontGuestCheckoutTestCest: Storefront guest checkout test
Signature: Magento\AcceptanceTest_generated\Backend\StorefrontGuestCheckoutTestCest:StorefrontGuestCheckoutTest
Test: tests/functional/Magento/FunctionalTest/_generated/StorefrontGuestCheckoutTestCest.php:StorefrontGuestCheckoutTest
Scenario --
I am going to create entity that has the stepKey: createCategory
ERROR
Time: 3.14 seconds, Memory: 18.00MB
There were 2 errors:
- StorefrontCustomerCheckoutTestCest: Storefront customer checkout test
Test tests/functional/Magento/FunctionalTest/_generated/StorefrontCustomerCheckoutTestCest.php:StorefrontCustomerCheckoutTest
[Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException] SSL: certificate subject name 'localhost' does not match target host name 'magento22mftfcombine.test'
Scenario Steps:
- // I am going to create entity that has the stepKey: simplecategory
#1 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Util/Protocol/CurlTransport.php:173
#2 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php:116
#3 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php:83
#4 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php:65
#5 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/CurlHandler.php:132
#6 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/DataPersistenceHandler.php:72
#7 /var/www/html/magento22mftfcombine/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/StorefrontCustomerCheckoutTestCest.php:48
#8 Magento\AcceptanceTest_generated\Backend\StorefrontCustomerCheckoutTestCest->_before
- StorefrontGuestCheckoutTestCest: Storefront guest checkout test
Test tests/functional/Magento/FunctionalTest/_generated/StorefrontGuestCheckoutTestCest.php:StorefrontGuestCheckoutTest
[Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException] SSL: certificate subject name 'localhost' does not match target host name 'magento22mftfcombine.test'
Scenario Steps:
- // I am going to create entity that has the stepKey: createCategory
#1 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Util/Protocol/CurlTransport.php:173
#2 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php:116
#3 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php:83
#4 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php:65
#5 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/CurlHandler.php:132
#6 /var/www/html/magento22mftfcombine/dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/DataPersistenceHandler.php:72
#7 /var/www/html/magento22mftfcombine/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/StorefrontGuestCheckoutTestCest.php:43
#8 Magento\AcceptanceTest_generated\Backend\StorefrontGuestCheckoutTestCest->_before
ERRORS!
Tests: 2, Assertions: 0, Errors: 2.
[Exec] Exit code 1 Time 3.293s
`
################################################################
I also get the same error in Magento 2.3
It might just be that I don't know how to properly configure MFTF, however I looked into the source code and there doesn't seem to be any way to give curl and parameter to make it ignore insercure certificates.
I found a way to make it work by going inside the core of MFTF, more specifically to the Magento\FunctionalTestingFramework\Util\Protocol\CurlTransport
class and inside the write
method adding CURLOPT_SSL_VERIFYHOST => false
to the initial $options
array. Of courrse this is not a good solution since I shouldn't be editing the core files, but in case this is a real issue, would this be a proper solution? Or am I completely off the mark here?