Answer the question
In order to leave comments, you need to log in
How to send a POST request to codeception using a button?
There is a page with the following button
<a href="/user/delete?id=1" data-method="post" id="mybutton"></a>
/user/delete?id=1
using the POST method. Then some action is performed on the server, and in response it returns a redirect back to the page with the button ( /user
) public function deleteUser(\FunctionalTester $I)
{
$I->amOnRoute('user');
$I->see('myuser_stay');
$I->see('myuser_delete');
$I->click('#mybutton');
$I->see('myuser_stay');
$I->dontSee('myuser_delete');
}
myuser_delete
, but not the user myuser_stay
. $I->see('myuser_stay');
Fail Failed asserting that on page /user/delete?id=1
--> Method Not Allowed: Method Not Allowed. This URL can only handle the following request methods: POST.
--> contains "myuser_stay".
/user/delete?id=1
data-method
$I->sendAjaxPostRequest()
Answer the question
In order to leave comments, you need to log in
Perhaps the problem is that the attribute data-method
is processed by JS, which does not work in functional tests, respectively, and is data-method
ignored .
Acceptance tests pass this moment normally?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question