Protractor tests. Loan product/account tests.
diff --git a/Pages/CustomerLoans.js b/Pages/CustomerLoans.js
index c329df9..2e86ac0 100644
--- a/Pages/CustomerLoans.js
+++ b/Pages/CustomerLoans.js
@@ -46,7 +46,7 @@
var amountInputsIncomeCosigner = $$("fims-case-credit-factor-form").get(3).$$("fims-text-input[controlname='amount'] input");
//Documents
-var descriptionInputsDocs = $$("fims-case-documents-form fims-text-input[controlname='description'] input");
+var descriptionInput = $("textarea[formcontrolname='description']");
//general elements
@@ -211,6 +211,15 @@
});
}).click();
},
+ clickEnabledCreateDocumentButton: function(){
+ browser.executeScript("arguments[0].scrollIntoView();", primaryButton.first().getWebElement());
+ browser.wait(EC.elementToBeClickable(primaryButton.first()), 3000);
+ primaryButton.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "CREATE DOCUMENT";
+ });
+ }).click();
+ },
clickEnabledUpdateMemberLoanButton: function(){
browser.executeScript("arguments[0].scrollIntoView();", primaryButton.first().getWebElement());
browser.wait(EC.elementToBeClickable(primaryButton.first()), 3000);
@@ -231,6 +240,16 @@
return text === chargeAmount;
})).toBe(true);
},
+ verifyTransactionChargeTotal: function(chargeAmount){
+ browser.wait(EC.visibilityOf($("fims-case-command-confirmation-form table tbody")), 3000);
+ expect($$("fims-case-command-confirmation-form table tbody .td-data-table-row").filter(function(elem, index){
+ return elem.$(".td-data-table-cell").getText().then(function(text){
+ return text === "Total";
+ });
+ }).$$(".td-data-table-cell").last().getText().then(function(text){
+ return text === chargeAmount;
+ })).toBe(true);
+ },
clickButtonForTransaction: function (transaction) {
$$('.mat-raised-button.mat-primary').filter(function (elem, index) {
return elem.$("span").getText().then(function (text) {
@@ -558,5 +577,33 @@
return text === action;
});
}).click();
- }
+ },
+ createDocumentForLoanAccount: function(customer, loanProduct, loanAccount){
+ link = "/customers/detail/" + customer + "/loans/products/" + loanProduct + "/detail/" + loanAccount + "/documents/create";
+ browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 6000);
+ $('a[href="' + link + '"]').click();
+ },
+ enterTextIntoDescriptionInputField: function(text) {
+ browser.wait(EC.visibilityOf(descriptionInput), 2000)
+ descriptionInput.clear().click().sendKeys(text);
+ },
+ verifyCreatedByForDocumentIs: function(createdBy){
+ expect($$("fims-layout-card-over .mat-list-text").filter(function (elem, index) {
+ return elem.$("h3").getText().then(function (text) {
+ return text === "Created by";
+ });
+ }).first().$("p").getText().then(function (text) {
+ return text.indexOf(createdBy) >= 0;
+ })).toBe(true);
+ },
+ verifyDescriptionForDocumentIs: function(descr) {
+ expect($$("fims-layout-card-over .mat-list-text").filter(function (elem, index) {
+ return elem.$("h3").getText().then(function (text) {
+ return text === "Description";
+ });
+ }).first().$("p").getText().then(function (text) {
+ return text === descr;
+ })).toBe(true);
+ },
+
};
diff --git a/Specs/loans1_creation&assignment.js b/Specs/loans1_creation&assignment.js
index e46b86c..bca7f7f 100644
--- a/Specs/loans1_creation&assignment.js
+++ b/Specs/loans1_creation&assignment.js
@@ -551,32 +551,46 @@
//open loan; can still be edited
CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
CustomerLoans.clickButtonForTask("OPEN");
- browser.pause();
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
CustomerLoans.verifyLoanStatusIs("PENDING");
CustomerLoans.verifyEditLoanButtonIsDisplayed();
//approve loan; can no longer be edited
CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
- //ToDo: task DENY
+ //ToDo: task DENY offered here too
CustomerLoans.clickButtonForTask("APPROVE");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
CustomerLoans.verifyLoanStatusIs("APPROVED");
+ CustomerLoans.verifyMessagesAreDisplayed("Member loan approved", "To activate this loan you need to disburse");
CustomerLoans.verifyEditLoanButtonIsNotDisplayed();
//disburse loan; default fees & loss provision configured
CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
- browser.pause();
- //ToDo: task CLOSE
+ //ToDo: task CLOSE offered here too
+ CustomerLoans.verifyTransactionCharge("Loan origination fee", "05.00");
+ CustomerLoans.verifyTransactionCharge("Disbursement fee", "00.50");
+ CustomerLoans.verifyTransactionCharge("Processing fee", "05.00");
+ CustomerLoans.verifyTransactionChargeTotal("10.50");
CustomerLoans.clickButtonForTask("DISBURSE");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
CustomerLoans.verifyLoanStatusIs("ACTIVE");
CustomerLoans.verifyEditLoanButtonIsNotDisplayed();
- browser.pause();
- //ToDo: task CLOSE
+ //ToDo: taskCLOSE --> bug; closing seems successful but isn't (should not be possible or should work)
});
it('should be able to add documents to loan', function () {
CustomerLoans.viewLoanDocumentsForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
+ CustomerLoans.createDocumentForLoanAccount(customerAccount, loanShortName2, loanAccountShortName);
+ CustomerLoans.enterTextIntoDescriptionInputField("My document #1");
+ CustomerLoans.clickEnabledCreateDocumentButton();
+ Common.verifyMessagePopupIsDisplayed("Document is going to be saved");
+ Common.clickLinkShowForFirstRowInTable();
+ CustomerLoans.verifyMessagesAreDisplayed("Document not locked", "You can lock this document");
+ //ToDo: details
+ CustomerLoans.verifyCreatedByForDocumentIs(employeeIdentifier);
+ CustomerLoans.verifyDescriptionForDocumentIs("My document #1");
+ //ToDo: can be edited & deleted
+ //ToDo: lock
+ //ToDo: cannot be edited & deleted
});
-
+ //ToDo: check loan loss day 0 correctly booked
it('update/deletion of unassigned/assigned product', function () {
//assigned product cannot be deleted anymore
//what about disabled/edited?