V
V
v3shin2019-12-11 17:31:42
Yii
v3shin, 2019-12-11 17:31:42

How to fix sendAjaxPostRequest() behavior?

Hello. I am writing a functional test under YII2, to "click" on the button I use sendAjaxPostRequest():

$I->sendAjaxPostRequest('/some/action', ['id' => $id]);
$I->amOnPage('/');
$I->seeElement('body');

As a result, the test fails:
Test  tests\functional\myСest.php:tryToTest
Step  See element "body"
Fail  Element located either by name, CSS or XPath element with 'body' was not found.

After sendAjaxPostRequest() all pages are read as a json string. Sample output from myСest.php.tryToTest.fail.html:
"<!DOCTYPE html>\r\n<html lang=\"ru-RU\">\r\n    <head>\r\n        <meta charset=\"UTF-8\">\r\n... "

Can you please tell me how to return the behavior of the test to normal? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question