我有返回申请状态的功能
getDecision: function() {
browser.wait(protractor.ExpectedConditions.visibilityOf(decisionPage), 60000); // verify the decision and proceed further depending upon it.
element(by.xpath(rejectImage)).isPresent().then(function(result) {
if (result) {
console.log('Application is rejected');
finalResult = 'Rejected';
} else {
element(by.xpath(queueImage)).isPresent().then(function(result1) {
if (result1) {
console.log('Application is sent to underwriter for review');
finalResult = 'Queue';
} else {
console.log('Application is approved');
finalResult = 'Approved';
}
});
}
});
}
然后在同一个班级中我将finalResult作为:
返回returnDecision: function() {
console.log('Result is::' + finalResult);
return finalResult;
},
然后再次在管理员门户网站中,我需要根据以上功能的状态做出决定:
takeDecision: function(testData) {
// Verifying if the case is queued or rejected
if (decision.returnDecision() === 'Queue') {
// Approving the case
if (testData.croDecision.apprvDecision === "Approve") {
// basePage.clickElement(approveButton);
utils.sleep(2);
var approveButton = browser.driver.findElement(By.css(croApproveButton));
approveButton.click();
} else {
var declineButton = browser.driver.findElement(By.css(croDeclineButton));
declineButton.click();
utils.sleep(2);
browser.driver.findElement(By.xpath(remarkDecline)).sendKeys('for testing purpose');
}
utils.sleep(2);
browser.driver.findElement(By.linkText("Submit")).click();
utils.sleep(2);
expect(browser.driver.findElement(By.xpath(decisionSuccessMessage)).isDisplayed()).toBe(true);
} else /*if (decision.returnDecision() === 'Rejected')*/ {
console.log("Case is rejected, no further action");
}
},
并且在spec文件中我在使用用户按如下方式打开案例后调用此方法:
fdescribe('Data Entry For Applicant(HL1)', function() {
beforeAll(function() {
this.actionwords = Object.create(require('../actionwords.js').Actionwords);
});
afterAll(function() {
testData.login.username = 'softcellqa1@gmail.com';
//logout of the app
loginPage.logout(testData)
});
fit('test', function() {
testData.loan.existingloan = 'No';
this.actionwords.housingLoanWithoutCoApplicant(testData);
this.actionwords.takeDecision(testData);
});
});
this.actionwords.takeDecision(testData)总是在this.actionwords.housingLoanWithoutCoApplicant之前执行
请让我知道我在这里做错了什么?