我真的需要帮助解决这个错误,我必须说,我是一个新的测试自动化。我正在尝试从BE侧删除一些内容。前两个函数是调用服务的函数
var beneficiaryId= null;
var result;
wd.addPromiseChainMethod('getBeneficiaryId', (path, searchId, beneficiaryType) => {
return new Promise((resolve, reject) => {
var account;
var requestBody = {
'searchId': searchId,
'beneficiaryType': beneficiaryType,
}
var config = {
headers: {
'Content-Type': 'application/json',
'Authorization': "290TQ..."
}
}
axios.defaults.baseURL = 'https://191.aaa.aa.xy/Mobile/test/app/v1';
axios.post(path, requestBody, config)
.then((response) => {
resolve(response)
driver.log("Beneficiary Name" + response.data.response.nameSurname)
driver.log("Beneficiary ID " + response.data.response.id)
//return beneficiaryId=response.data.response.id
})
.catch((error) => {
driver.log(error);
resolve(null);
})
})
wd.addPromiseChainMethod('deleteBeneficiary', (path, id, beneficiaryType) => {
return new Promise((resolve, reject) => {
var account;
var requestBody = {
'id': id,
'beneficiaryType': beneficiaryType,
}
var config = {
headers: {
'Content-Type': 'application/json',
'Authorization': "290T...."
}
}
axios.defaults.baseURL = 'https://191.aaa.aa.xy/Mobile/test/app/v1';
axios.post(path, requestBody, config)
.then((response) => {
resolve(response)
driver.log("Beneficiary is deleted:" + response.data.response.deleted)
return result=response.data.response.deleted
})
.catch((error) => {
driver.log(error);
resolve(null);
})
})
在这里,我试图从前两个函数中调用的服务获得响应,但每次我运行这个测试时,都会出现超时错误文章源自玩技e族-https://www.playezu.com/179393.html
wd。addPromiseChainMethod('受益人',(searchId,受益人类型,tryCount=0,受益人ID)=>;{文章源自玩技e族-https://www.playezu.com/179393.html
var searchId="CUSTOMER40";
var beneficiaryType= null;
if (tryCount >= 10) {
return driver;
}
tryCount++;
return driver.getBeneficiaryId("", 200000, 1000)
//.text()
.then((value) => {
return driver.getBeneficiaryId("/services2", searchId, beneficiaryType)
.then((response) => {
// var beneficiary=beneficiaryId;
driver.log("Beneficiary id is:" + beneficiaryId)
})
})
return driver.deleteBeneficiary("", 200000, 1000)
//.text()
.then((value) => {
return driver.deleteBeneficiary("/services", beneficiaryId, beneficiaryType)
.then((response) => {
driver.log("Beneficiary is deleted:" + response.data.response.deleted)
return result=response.data.response.deleted
})
})
})文章源自玩技e族-https://www.playezu.com/179393.html 文章源自玩技e族-https://www.playezu.com/179393.html
评论