Protractor tests. Loan product/account tests.
diff --git a/Pages/CustomerLoans.js b/Pages/CustomerLoans.js
index 3f23c2b..c329df9 100644
--- a/Pages/CustomerLoans.js
+++ b/Pages/CustomerLoans.js
@@ -260,11 +260,6 @@
$$(".td-step-label").get(2).click();
browser.sleep(1000);
},
- goToStepDocuments: function(){
- browser.sleep(100);
- browser.wait(EC.elementToBeClickable($$(".td-step-label").get(3)), 3000);
- $$(".td-step-label").get(3).click();
- },
verifyButtonCreateMemberLoanDisabled: function(){
expect(primaryButton.filter(function(elem, index) {
return elem.$("span").getText().then(function(text) {
@@ -388,12 +383,22 @@
browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 6000);
$('a[href="' + link + '"]').click();
},
+ goToTasksForCustomerLoan: function (customer, productIdentifier, accountIdentifier) {
+ link = "/customers/detail/" + customer + "/loans/products/" + productIdentifier + "/detail/" + accountIdentifier + "/tasks";
+ browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 5000);
+ $('a[href="' + link + '"]').click();
+ },
viewDebtIncomeReportForCustomerLoan: function(customer, productIdentifier, accountIdentifier){
link = "/customers/detail/" + customer + "/loans/products/" + productIdentifier + "/detail/" + accountIdentifier + "/debtIncome";
browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 5000);
$('a[href="' + link + '"]').click();
browser.wait(EC.visibilityOf($("fims-layout-card-over")), 2000);
},
+ viewLoanDocumentsForCustomerLoan: function(customer, loanProduct, loanAccount){
+ link = "/customers/detail/" + customer + "/loans/products/" + loanProduct + "/detail/" + loanAccount + "/documents";
+ browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 6000);
+ $('a[href="' + link + '"]').click();
+ },
//table
verifyPrincipalForLoanAccountInRow: function(principalAmount, row){
browser.wait(EC.visibilityOf($("table tbody")), 3000);
@@ -477,7 +482,7 @@
})).toBe(true);
},
verifyMemberRatioIs:function (text){
- expect($$("mat-tab-header div[role='tab']").get(0).getText()).toMatch("Member(Ratio: " + text + ")");
+ expect($$("mat-tab-header div[role='tab']").get(0).getText()).toEqual("Member(Ratio: " + text + ")");
},
verifyCoSignerRatioIs:function (text){
expect($$("mat-tab-header div[role='tab']").get(1).getText()).toEqual("Co-signer(Ratio: " + text + ")");
@@ -508,9 +513,50 @@
verifyCreateLoanButtonIsNotDisplayed: function(){
expect($("a[title='Create new loan for member ']").isPresent()).toBe(false);
},
+ verifyEditLoanButtonIsNotDisplayed: function(){
+ expect($("a[title='Edit member loan']").isPresent()).toBe(false);
+ },
+ verifyEditLoanButtonIsDisplayed: function(){
+ expect($("a[title='Edit member loan']").isPresent()).toBe(true);
+ },
verifyMessagesAreDisplayed: function(message, message2){
browser.wait(EC.visibilityOf($("td-message")), 2500);
expect($("td-message .td-message-label").getText()).toEqual(message);
expect($("td-message .td-message-sublabel").getText()).toEqual(message2);
+ },
+ //planned payments
+ verifyDateForPlannedPaymentsInRow: function(date, row){
+ browser.wait(EC.visibilityOf($("table tbody")), 3000);
+ expect($$("table tbody tr").get(row - 1).$$(".td-data-table-cell").get(0).getText()).toEqual(date);
+ },
+ verifyBalanceForPlannedPaymentsInRow: function(balance, row){
+ browser.wait(EC.visibilityOf($("table tbody tr")), 4000);
+ expect($$("table tbody tr").get(row - 1).$$(".td-data-table-cell").get(4).getText()).toEqual(balance);
+ },
+ verifyPaymentForPlannedPaymentsInRow: function(payment, row){
+ browser.wait(EC.visibilityOf($("table tbody")), 3000);
+ expect($$("table tbody tr").get(row - 1).$$(".td-data-table-cell").get(1).getText()).toEqual(payment);
+ },
+ verifyInterestForPlannedPaymentsInRow: function(interest, row){
+ browser.wait(EC.visibilityOf($("table tbody")), 3000);
+ expect($$("table tbody tr").get(row - 1).$$(".td-data-table-cell").get(2).getText()).toEqual(interest);
+ },
+ verifyPrincipalForPlannedPaymentsInRow: function(principal, row){
+ browser.wait(EC.visibilityOf($("table tbody")), 3000);
+ expect($$("table tbody tr").get(row - 1).$$(".td-data-table-cell").get(3).getText()).toEqual(principal);
+ },
+ //tasks
+ selectExecuteTaskCheckbox: function(){
+ browser.wait(EC.visibilityOf($("mat-checkbox[title='Execute task']")), 3000);
+ $("mat-checkbox[title='Execute task']").click();
+ expect($("mat-checkbox[title='Execute task']").getAttribute("class")).toMatch("mat-checkbox-checked");
+ },
+ clickButtonForTask: function (action) {
+ browser.sleep(500);
+ $$('.mat-raised-button.mat-primary').filter(function (elem, index) {
+ return elem.$("span").getText().then(function (text) {
+ return text === action;
+ });
+ }).click();
}
};
diff --git a/Pages/Customers.js b/Pages/Customers.js
index 60135f6..5451cf6 100644
--- a/Pages/Customers.js
+++ b/Pages/Customers.js
@@ -313,11 +313,6 @@
browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 5000);
$('a[href="' + link + '"]').click();
},
- clickLinkTasks: function (customer, productIdentifier, accountIdentifier) {
- link = "/customers/detail/" + customer + "/loans/products/" + productIdentifier + "/detail/" + accountIdentifier + "/tasks";
- browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 5000);
- $('a[href="' + link + '"]').click();
- },
selectExecuteTaskCheckbox: function(){
browser.wait(EC.visibilityOf($("mat-checkbox[title='Execute task']")), 3000);
$("mat-checkbox[title='Execute task']").click();
diff --git a/Pages/Loans.js b/Pages/Loans.js
index 46e41fd..61d7a26 100644
--- a/Pages/Loans.js
+++ b/Pages/Loans.js
@@ -36,6 +36,7 @@
var arrearsAllowanceAccountInput = $("fims-account-select[formcontrolname='account'] input");
var primaryButton = $$(".mat-raised-button.mat-primary");
+var buttons = $$(".mat-button");
var feeAmountInput = $("fims-text-input[controlname='amount'] input");
var feeProportionalToSelect = $("mat-select[formcontrolname='proportionalTo'] .mat-select-trigger");
@@ -50,6 +51,9 @@
var actionSelect1 = $("mat-select[formcontrolname='action'] .mat-select-trigger");
var actionSelect2 = $$("mat-select[formcontrolname='action'] .mat-select-trigger").get(1);
+var daysLateInputs = $$("fims-text-input[controlname='daysLate'] input");
+var percentProvisions = $$("fims-text-input[controlname='percentProvision'] input");
+
module.exports = {
goToLoanProductsViaSidePanel: function() {
$("a[href='/loans']").click();
@@ -210,6 +214,15 @@
});
}).click();
},
+ clickEnabledUpdateLossProvisionButton: 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 === "UPDATE LOSS PROVISION";
+ });
+ }).click();
+ },
clickLinkManageFeesForLoanProduct: function(identifier){
link = "/loans/detail/" + identifier + "/charges";
browser.wait(EC.visibilityOf($('a[href="'+ link + '"]')));
@@ -225,6 +238,32 @@
browser.wait(EC.visibilityOf($('a[href="'+ link + '"]')));
$('a[href="'+ link + '"]').click();
},
+ clickLinkLossProvisionConfigurationForLoanProduct: function(identifier){
+ link = "/loans/detail/" + identifier + "/lossProvision";
+ browser.wait(EC.visibilityOf($('a[href="'+ link + '"]')));
+ $('a[href="'+ link + '"]').click();
+ },
+ clickButtonAddStep: function(){
+ browser.sleep(200);
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "ADD STEP";
+ });
+ }).first().click();
+ },
+ enterTextIntoDaysLateInputField: function(text, number) {
+ browser.wait(EC.visibilityOf(daysLateInputs.get(number-1)), 2000)
+ daysLateInputs.get(number-1).clear().click().sendKeys(text);
+ },
+ enterTextIntoPercentProvisionInputField: function(text, number) {
+ browser.wait(EC.visibilityOf(percentProvisions.get(number-1)), 2000)
+ percentProvisions.get(number-1).clear().click().sendKeys(text);
+ },
+ clickButtonEditLossProvisionConfigurationForLoanProduct: function(identifier){
+ link = "/loans/detail/" + identifier + "/lossProvision/edit" ;
+ browser.wait(EC.visibilityOf($('a[href="'+ link + '"]')));
+ $('a[href="'+ link + '"]').click();
+ },
clickButtonCreateTaskForLoanProduct: function(identifier){
link = "/loans/detail/" + identifier + "/tasks/create";
browser.wait(EC.visibilityOf($('a[href="'+ link + '"]')));
diff --git a/Specs/gate1.js b/Specs/gate1.js
index 6195ace..02fc42a 100644
--- a/Specs/gate1.js
+++ b/Specs/gate1.js
@@ -487,7 +487,7 @@
});
it('should be able to open loan - mandatory task', function () {
Common.clickLinkShowForRowWithId(loanAccountShortName);
- Customers.clickLinkTasks(customerAccount, loanShortName, loanAccountShortName);
+ CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
Customers.selectExecuteTaskCheckbox();
Common.verifyMessagePopupIsDisplayed("Task executed successfully");
Customers.clickButtonForTask("OPEN");
@@ -497,7 +497,7 @@
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
});
it('should be able to approve loan - mandatory task already executed', function () {
- Customers.clickLinkTasks(customerAccount, loanShortName, loanAccountShortName);
+ CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
//checkbox already selected since one task only that already has been executed
Customers.clickButtonForTask("APPROVE");
Customers.clickButtonForTransaction("APPROVE");
@@ -507,7 +507,7 @@
it('should be able to disburse loan - no task', function () {
//currently error if this is done too quickly; workaround
browser.sleep("10000");
- Customers.clickLinkTasks(customerAccount, loanShortName, loanAccountShortName);
+ CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
Customers.clickButtonForTask("DISBURSE");
Customers.verifyTransactionCharge("Processing fee", "150.00");
Customers.verifyTransactionCharge("Loan origination fee", "50.00");
diff --git a/Specs/loans1_creation&assignment.js b/Specs/loans1_creation&assignment.js
index 32d3c36..e46b86c 100644
--- a/Specs/loans1_creation&assignment.js
+++ b/Specs/loans1_creation&assignment.js
@@ -286,6 +286,7 @@
});
it('should enable the first loan product', function () {
Common.clickLinkShowForRowWithId(loanShortName);
+ //ToDo: details
CustomerLoans.verifyMessagesAreDisplayed("Product not enabled", "To assign this product to a member it needs to be enabled first");
Loans.clickButtonEnableProduct();
Common.verifyMessagePopupIsDisplayed("Product is going to be enabled");
@@ -329,6 +330,19 @@
Loans.clickEnabledCreateProductButton();
Common.verifyMessagePopupIsDisplayed("Product is going to be saved");
});
+ it('should configure loan loss provision', function () {
+ Common.clickLinkShowForRowWithId(loanShortName2);
+ //ToDo: details
+ Loans.clickLinkLossProvisionConfigurationForLoanProduct(loanShortName2);
+ Loans.clickButtonEditLossProvisionConfigurationForLoanProduct(loanShortName2);
+ Loans.clickButtonAddStep();
+ Loans.enterTextIntoPercentProvisionInputField("5", 1);
+ Loans.clickButtonAddStep();
+ Loans.enterTextIntoDaysLateInputField("10", 2);
+ Loans.enterTextIntoPercentProvisionInputField("25", 2);
+ Loans.clickEnabledUpdateLossProvisionButton();
+ Common.verifyMessagePopupIsDisplayed("oss provision configuration is going to be saved");
+ });
it('should not be able to select loan product if not enabled', function () {
Customers.goToManageCustomersViaSidePanel();
Common.clickSearchButtonToMakeSearchInputFieldAppear();
@@ -485,31 +499,84 @@
CustomerLoans.verifyCreatedByForLoanIs(employeeIdentifier);
});
it('planned payment', function () {
- CustomerLoans.viewPlannedPaymentForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
- //error, ATEN-474
+ // CustomerLoans.viewPlannedPaymentForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
+ // error, ATEN-474
+ // CustomerLoans.verifyBalanceForPlannedPaymentsInRow("1500" ,"1");
+ // Common.clickBackButtonInTitleBar();
});
it('debt/income ratio', function () {
CustomerLoans.viewDebtIncomeReportForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
CustomerLoans.verifyMemberRatioIs("01.50");
+ //ToDo: more details
CustomerLoans.verifyCoSignerRatioIs("00.42");
+ //ToDo: more details
Common.clickBackButtonInTitleBar();
});
it('should be able to edit loan account until it has been approved', function () {
CustomerLoans.clickUpdateLoanAccountForMember(customerAccount, loanShortName2, loanAccountShortName);
- browser.pause();
- //edit loan account to different one (different product, different settings)
- CustomerLoans.selectProduct(loanShortName);
- //error principal & interest rate, bug
- CustomerLoans.verifyButtonUpdateMemberLoanDisabled();
- CustomerLoans.enterTextIntoPrincipalAmountInputField(10000);
- CustomerLoans.enterTextIntoInterestRateInputField("3.60");
- CustomerLoans.verifyButtonUpdateMemberLoanDisabled();
+ //edit loan account settings
+ //ToDo: different loan product - should not be possible or work as expected (currently error on saving)
+ CustomerLoans.enterTextIntoPrincipalAmountInputField("500");
+ CustomerLoans.verifyInterestRateInputFieldIsDisabledAndHasText("15.00");
+ CustomerLoans.enterTextIntoTermInputField("50");
+ CustomerLoans.selectTemporalUnitForTerm("weeks");
+ CustomerLoans.enterTextIntoPaymentPeriodInputField("10");
+ CustomerLoans.selectPaymentPeriod("weeks");
CustomerLoans.clickEnabledUpdateMemberLoanButton();
- //unexpected error, bug
Common.verifyMessagePopupIsDisplayed("Case is going to be saved");
//planned payment
- //...
+ CustomerLoans.viewPlannedPaymentForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
+ CustomerLoans.verifyBalanceForPlannedPaymentsInRow("500" ,"1");
+ CustomerLoans.verifyBalanceForPlannedPaymentsInRow("0" ,"6");
+ Common.clickBackButtonInTitleBar();
+ //edit loan account again and update debt to income ratio
+ CustomerLoans.clickUpdateLoanAccountForMember(customerAccount, loanShortName2, loanAccountShortName);
+ CustomerLoans.goToStepDebtToIncomeRatio();
+ CustomerLoans.removeDebtAtPosition(1);
+ CustomerLoans.verifyDebtTotalIs("5,000.00");
+ CustomerLoans.verifyDebtIncomeRatioIs("00.50");
+ CustomerLoans.enterTextIntoAmountInputFieldForIncome("100000", 2);
+ CustomerLoans.verifyIncomeTotalIs("105,000.00");
+ CustomerLoans.verifyDebtIncomeRatioIs("00.05");
+ CustomerLoans.clickEnabledUpdateMemberLoanButton();
+ Common.verifyMessagePopupIsDisplayed("Case is going to be saved");
+ //debt to income report
+ CustomerLoans.viewDebtIncomeReportForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
+ CustomerLoans.verifyMemberRatioIs("00.05");
+ CustomerLoans.verifyCoSignerRatioIs("00.42");
+ //ToDo: more details
+ Common.clickBackButtonInTitleBar();
});
+ it('should not be able to edit loan account once it has been approved', function () {
+ //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
+ CustomerLoans.clickButtonForTask("APPROVE");
+ Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
+ CustomerLoans.verifyLoanStatusIs("APPROVED");
+ CustomerLoans.verifyEditLoanButtonIsNotDisplayed();
+ //disburse loan; default fees & loss provision configured
+ CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
+ browser.pause();
+ //ToDo: task CLOSE
+ CustomerLoans.clickButtonForTask("DISBURSE");
+ Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
+ CustomerLoans.verifyLoanStatusIs("ACTIVE");
+ CustomerLoans.verifyEditLoanButtonIsNotDisplayed();
+ browser.pause();
+ //ToDo: task CLOSE
+ });
+ it('should be able to add documents to loan', function () {
+ CustomerLoans.viewLoanDocumentsForCustomerLoan(customerAccount, loanShortName2, loanAccountShortName);
+ });
+
it('update/deletion of unassigned/assigned product', function () {
//assigned product cannot be deleted anymore
//what about disabled/edited?
diff --git a/conf.js b/conf.js
index 3339ef4..8c0bb55 100644
--- a/conf.js
+++ b/conf.js
@@ -6,7 +6,7 @@
framework: 'jasmine',
specs: [
- 'Specs/teller_management.js'
+ 'Specs/loans1_creation&assignment.js'
],
directConnect: true,
allScriptsTimeout: 45000,
@@ -31,6 +31,7 @@
browser.ignoreSynchronization = true;
//browser.driver.get('https://pilot.kuelap.io/index.html');
browser.driver.get('http://localhost:4200');
+ //browser.driver.get(' https://sandbox.kuelap.io/index.html');
browser.driver.findElement(by.css(".mat-input-element[formcontrolname='tenant']")).sendKeys('playground');
browser.driver.findElement(by.css(".mat-input-element[formcontrolname='username']")).sendKeys('operator');