我正在使用代码接收来自动化测试。登录后如何执行操作。
为了更好地理解,我在下面发布了我的代码。
$I->amOnRoute('login');;
$I->sendPOST('/login', ['email' => 'un', 'password' => `enter
code here`'pwd']);
$I->seeResponseCodeIs(200);
上面的代码行工作正常,但是当我继续下面的代码时,我得到401认证错误
$I->sendAjaxPostRequest('/adminproxy/create-entity',[
"name" => 123123123123,
"title" => 123123123,
"realm_id" => 1,
"description" => 123123123123,
"status" => 'ACTIVE',
"entity_type" => 'Workspace' ]);
答案 0 :(得分:0)
混合使用Laravel5模块和REST模块的动作可能是一个问题。
与其使用sendPOST
,不如使用submit a form。
$I->amOnRoute('login');
$I->submitForm('#login-form', ['email' => 'un', 'password' => 'pwd']);
$I->seeResponseCodeIs(200);