0

I'm trying to run functional tests on my magento project following this tutorial i'm using selenium docker image by running this command :

docker run -d -p 4444:4444 --shm-size 2g selenium/standalone-chrome:3.9.1

and when i try running an example test vendor/bin/mftf run:test AdminLoginSuccessfulTest --remove

I get this error : Fail Field by name, label, CSS or XPath element with '#username' was not found.

and when i checked the screenshot provided by selenium i get 127.0.0.1 refused to connect enter image description here

I don't how to fix it and allow it to access 127.0.0.1 and while looking for an error i found this under dev/tests/accesptance/tests/_output/allure-results this error

Test filesvendor/magento/module-backend/Test/Mftf/Test/AdminLoginSuccessfulTest.xml
]]> Field by name, label, CSS or XPath element with '#username' was not found. #0 /var/www/html/tajerpro/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php(1201): Codeception\Module\WebDriver->findFields() #1 /var/www/html/tajerpro/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php(1746): Codeception\Module\WebDriver->findField() #2 [internal function]: Codeception\Module\WebDriver->fillField() #3 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Step.php(268): call_user_func_array() #4 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Scenario.php(76): Codeception\Step->run() #5 /var/www/html/tajerpro/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_generated/AcceptanceTesterActions.php(1874): Codeception\Scenario->runStep() #6 /var/www/html/tajerpro/dev/tests/acceptance/tests/functional/Magento/_generated/default/AdminLoginSuccessfulTestCest.php(37): Magento\FunctionalTestingFramework\AcceptanceTester->fillField() #7 [internal function]: Magento\AcceptanceTest_default\Backend\AdminLoginSuccessfulTestCest->AdminLoginSuccessfulTest() #8 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Lib/Di.php(128): ReflectionMethod->invokeArgs() #9 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Test/Cest.php(138): Codeception\Lib\Di->injectDependencies() #10 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Test/Cest.php(150): Codeception\Test\Cest->invoke() #11 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Test/Cest.php(82): Codeception\Test\Cest->executeTestMethod() #12 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Test/Test.php(98): Codeception\Test\Cest->test() #13 /var/www/html/tajerpro/vendor/phpunit/phpunit/src/Framework/TestSuite.php(639): Codeception\Test\Test->run() #14 /var/www/html/tajerpro/vendor/codeception/phpunit-wrapper/src/Runner.php(117): PHPUnit\Framework\TestSuite->run() #15 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/SuiteManager.php(161): Codeception\PHPUnit\Runner->doEnhancedRun() #16 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Codecept.php(208): Codeception\SuiteManager->run() #17 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Codecept.php(162): Codeception\Codecept->runSuite() #18 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Command/Run.php(401): Codeception\Codecept->run() #19 /var/www/html/tajerpro/vendor/symfony/console/Command/Command.php(255): Codeception\Command\Run->execute() #20 /var/www/html/tajerpro/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run() #21 /var/www/html/tajerpro/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand() #22 /var/www/html/tajerpro/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun() #23 /var/www/html/tajerpro/vendor/codeception/codeception/src/Codeception/Application.php(117): Symfony\Component\Console\Application->run() #24 /var/www/html/tajerpro/vendor/codeception/codeception/app.php(46): Codeception\Application->run() #25 /var/www/html/tajerpro/vendor/codeception/codeception/app.php(47): {closure}() #26 /var/www/html/tajerpro/vendor/codeception/codeception/codecept(7): require('/var/www/html/t...') #27 {main}

Is having selenium and my web driver is causing the problem?

1 Answer 1

0

seems to be both issues are different.

  1. Username not found &
  2. 127.0.0.1 refused to connect.

check your files where you have define the URLs to replace 127.0.0.1 with domain you want. this is actually hitting your local server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.