0
我正在使用Codeception测试Yii2中的表单,当我点击提交按钮并希望在通过Ajax接收到ok后重定向到另一个url(通过javascript)时。 我用wait(3)
方法给它一些时间做重定向,但是当我用dontSeeInCurrentUrl()
方法检查url时,我总是在同一页面上。点击提交按钮后,代码隐藏仍然在同一页
这是怎么发生的?
<?php
$newFamily = [
'name' => 'testFamily'
];
$I->amOnPage('/backend/web/index.php/foobar/create');
$I->seeInCurrentUrl('create');
$I->amGoingTo('try to submit without having enter a name');
$I->click('#submitBtn');
$I->expect('not to have changed of location');
$I->seeInCurrentUrl('create');
$I->amGoingTo('check that parent family select is unchecked');
$I->dontSeeCheckboxIsChecked('#isSuperior');
$I->fillField('#familynutriment-name', $newFamily['name']);
$I->click('#submitBtn');
$I->expectTo('be in another location');
$I->wait(3);
$I->dontSeeInCurrentUrl('create');
$I->seeInDatabase('family_nutriment', $newFamily);