Skip to content

Expected HTTP Status Code: 200 (OK). Actual Status Code: 404 (Not Found) #47

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

Closed
Jeroenhuisjes opened this issue Mar 7, 2018 · 13 comments

Comments

@Jeroenhuisjes
Copy link

It does work with a fresh magento dev version. It seems like it can't find the webshop url and perform an assertion.

Preconditions

  1. Ubuntu 7.10
  2. Selenium 3.9
  3. Magento 2.2-master. Installed the testing framework manually.

Steps to reproduce

  1. Local Magento installation with nginx

Expected result

  1. The default functional tests should run

Actual result

In IsEqual.php line 140:

Expected HTTP Status Code: 200 (OK). Actual Status Code: 404 (Not Found)
Failed asserting that 404 matches expected 200.

run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--coverage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--] [] []

PHP Fatal error: Uncaught RuntimeException: Command Did Not Finish Properly in /home/jeroen/public_html/magento2/dev/tests/acceptance/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:101
Stack trace:
#0 [internal function]: Codeception\Subscriber\ErrorHandler->shutdownHandler()
#1 {main}
thrown in /home/jeroen/public_html/magento2/dev/tests/acceptance/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php on line 101

@Jeroenhuisjes
Copy link
Author

Any ideas?

@okolesnyk
Copy link
Member

okolesnyk commented Mar 15, 2018

Hi @Jeroenhuisjes.
We'll figure it out.
Can provide command you used to run tests?
There are lots of possible issues can be and first of all I want to be sure you didn't try to run skipped tests.

@okolesnyk
Copy link
Member

Also this error can occur if Magento is not using URL Rewrites.
If your link to Magento backend is : magento.local/index.php/admin then you should specify in .env file MAGENTO_BASE_URL=http://magento.local/index.php/.
Otherwise it should be MAGENTO_BASE_URL=http://magento.local/

@Jeroenhuisjes
Copy link
Author

Jeroenhuisjes commented Mar 16, 2018

Hi @okolesnyk!
Hmm we do use url rewrites on our local environments so that doesn't seem to be the problem. They run with nginx though. On my own laptop where I just run Apache it seems to work just fine.

We tried vendor/bin/codecept run and variations of this and we tried different vendor/bin/robo commands.
We use a local Selenium install. Looks like phpunit fails some kind of assertion or can't make a connection with the shop?

@okolesnyk
Copy link
Member

Hey @Jeroenhuisjes
I finally figured out what is wrong.
This is our bug we should resolve.
The problem is in this file: https://github.com/magento/magento2-functional-testing-framework/blob/develop/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php#L120

We didn't properly test it with nginx. Because I can only reproduce this with nginx webserver.

@okolesnyk okolesnyk added the TECH label Mar 22, 2018
@okolesnyk
Copy link
Member

Hi @Jeroenhuisjes. Thank you for the report. We created internal ticket MQE-897 to track the progress. We will update you here about progress on this issue.

@okolesnyk okolesnyk removed the TECH label Mar 23, 2018
@Jeroenhuisjes
Copy link
Author

@okolesnyk Thanks!

@okolesnyk okolesnyk self-assigned this Apr 4, 2018
@okolesnyk
Copy link
Member

okolesnyk commented Apr 5, 2018

Hi @Jeroenhuisjes
After a while I can not reproduce this issue anymore.
We did some changes and probably we fixed it.
Can you please verify that this issue has gone?
If you still facing same problem, please make sure you using latest MFTF v. 2.1.2.

@Jeroenhuisjes
Copy link
Author

@okolesnyk
Seems to be working! Thanks 👍

@sshrewz
Copy link

sshrewz commented Apr 13, 2018

Thanks for confirming, @Jeroenhuisjes! We'll go ahead and close this issue.

@sshrewz sshrewz closed this as completed Apr 13, 2018
@alinlupoiu
Copy link

alinlupoiu commented Jul 18, 2018

Hi.
I have the same issue on magento 2.2.5 enterprise endition and my MFTF version is 2.1.2(the last one)

My base url is: magento.test.
If i change the MAGENTO_BASE_URL from: magento.test to magento.test/index.php/admin in (/dev/tests/acceptance/.env) the error dissapear and the tests start running but it doesen't know the correct base url and the test(s) fails.
Somehow the real base url returns 404 and the backend address return 200
Does anyone know how i can solve this issue?

@fgoppelt
Copy link

Hi, we are running into the same problem in 2.2.0. After some investigation we found out that the first API call made by vendor/bin/codecept run to get the API token goes to BASE_URL/rest//default/V1/integration/admin/token. On this url we are getting a 404 with postman too. After removing "default" from the url we could successfully receive a token. We checked all configuration options in the .env file but could not find any configuration regarding this default value in the url.

@alinlupoiu
Copy link

Hi.
Meanwhile i solve the problem, and as you said, i remove "default" from the API call link.
You can do that in this path: dev/tests/acceptance/tests/functional.suite.dist.yml:18.

After you do that you should run: vendor/bin/robo build:project command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants