[REST] Module does not reset client before each request
What are you trying to achieve?
I write a test which makes several request
$I->sendPOST('/my/url/test');
$I->sendGET('/my/url/test');
What do you get instead?
When I call $I->sendGET('/my/url/test'); it goes to '/my/url/my/url/test' instead of '/my/url/test'
I use REST as follows:
REST:
depends: Symfony
Are you sure that you haven't missed a leading / in the second request?
Absolutely sure
What version of Codeception are you using?
Sorry for not providing the version at the first place. 2.3.6
@Naktibalda any thoughts so far? I think we need to reset the client inside REST module before each sendPOST, sendGET and other send* methods.
Works for me.
I have tried to reproduce your issue: https://github.com/Naktibalda/codeception-symfony-tests/commit/11e34fb1486b527f8aa5e23a176496d6c87fdfd1
$I->sendGET('/posts/1');
$I->seeResponseEquals('Show Post Codeception/Codeception#1');
$I->sendPOST('/doctrine/create-user',['name' => 'John']);
$I->seeResponseEquals('User created');
$I->seeCurrentUrlEquals('/doctrine/create-user');
but I got expected result:
./vendor/bin/codecept run tests/functional/SecondUriIsNotAppendedToFirstUriCept.php --steps
Codeception PHP Testing Framework v2.3.6
Powered by PHPUnit 4.8.36 by Sebastian Bergmann and contributors.
Functional Tests (1) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Testing functional
SecondUriIsNotAppendedToFirstUriCept:
Signature: SecondUriIsNotAppendedToFirstUriCept
Test: tests/functional/SecondUriIsNotAppendedToFirstUriCept.php
Scenario --
I send get "/posts/1"
I see response equals "Show Post Codeception/Codeception#1"
I send post "/doctrine/create-user",{"name":"John"}
I see response equals "User created"
I see current url equals "/doctrine/create-user"
PASSED
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
There was a similar issue report before: Codeception/Codeception#2987
But he had no leading / in uri.
Hej there,
I having the same problem like @ihorsamusenko. I wanted to test an array of different filter options for an api route.
Unfortunately there seems to be an issue with sending multiple (get?) requests within one function. The response is not resetted, so the response data (and also the execution time) will be increase exponentially. The solution seems to be that all requests need to declared in a separate declared function.
(And there is a leading / within the uri)