Protractor tests. Loan product tests.
diff --git a/Pages/CustomerLoans.js b/Pages/CustomerLoans.js
new file mode 100644
index 0000000..a32da68
--- /dev/null
+++ b/Pages/CustomerLoans.js
@@ -0,0 +1,358 @@
+//Customers.js
+
+//Actions specific to the Customers section
+
+var Common = require('./Common.js');
+var EC = protractor.ExpectedConditions;
+
+//loan details
+var productSelect = $("mat-select[formcontrolname='productIdentifier'] .mat-select-trigger");
+var shortNameInput = $("fims-id-input[controlname='identifier'] input");
+var principalAmountInput = $("fims-number-input[controlname='principalAmount'] input");
+var interestRateInput = $("fims-number-input[controlname='interest'] input");
+var termInput = $("fims-text-input[controlname='term'] input");
+var termSelect = $("mat-select[formcontrolname='termTemporalUnit'] .mat-select-trigger");
+var paymentPeriod = $("fims-text-input[controlname='paymentPeriod'] input");
+var paymentPeriodSelect = $("mat-select[formcontrolname='termTemporalUnit'] .mat-select-trigger");
+var depositAccountSelect = $("mat-select[formcontrolname='depositAccountIdentifier'] .mat-select-trigger");
+//if "Repay every" is set to "months"
+var radioMonthSetting1 = $$("mat-radio-group[formcontrolname='monthSetting'] mat-radio-button").get(0);
+var dayForMonthlyRepaySelect = $("mat-select[formcontrolname='monthSettingDay'] .mat-select-trigger");
+var radioMonthSetting2 = $$("mat-radio-group[formcontrolname='monthSetting'] mat-radio-button").get(1);
+var numberDaySelectMonthlyRepayment = $("mat-select[formcontrolname='monthSettingWeek'] .mat-select-trigger");
+var weekdaySelectMonthlyRepayment = $("mat-select[formcontrolname='monthSettingDayInWeek'] .mat-select-trigger");
+//if "Repay every" is set to "weeks"
+var dayInWeekSelect = $("mat-select[formcontrolname='dayInWeek'] .mat-select-trigger");
+//if "Repay every" is set to "years"
+var dayForYearlyRepaySelect = $("mat-select[formcontrolname='monthSettingDay'] .mat-select-trigger");
+var numberDaySelectYearlyRepayment = $("mat-select[formcontrolname='monthSettingWeek'] .mat-select-trigger");
+var weekdaySelectYearlyRepayment = $("mat-select[formcontrolname='monthSettingDayInWeek'] .mat-select-trigger");
+var monthSelectYearlyRepayment = $("mat-select[formcontrolname='month'] .mat-select-trigger");
+
+//Debt to income ratio
+var descriptionInputsDebt = $$("fims-case-credit-factor-form").get(0).$$("fims-text-input[controlname='description'] input");
+var amountInputsDebt = $$("fims-case-credit-factor-form").get(0).$$("fims-text-input[controlname='amount'] input");
+var descriptionInputsIncome = $$("fims-case-credit-factor-form").get(1).$$("fims-text-input[controlname='description'] input");
+var amountInputsIncome = $$("fims-case-credit-factor-form").get(1).$$("fims-text-input[controlname='amount'] input");
+var debtsTotal = $$("fims-case-debt-to-income-form h4").get(0);
+var incomeTotal = $$("fims-case-debt-to-income-form h4").get(1);
+var ratio = $("fims-case-debt-to-income-form");
+
+//Co-signer
+var memberSelect = $("fims-customer-select[formcontrolname='customerIdentifier'] input");
+
+//Documents
+var descriptionInputsDocs = $$("fims-case-documents-form fims-text-input[controlname='description'] input");
+
+
+//general elements
+var primaryButton = $$(".mat-raised-button.mat-primary");
+var continueButton = $$(".mat-raised-button.mat-accent");
+var buttons = $$(".mat-button");
+
+module.exports = {
+
+ clickCreateLoanAccountForMember: function (customer) {
+ link = "/customers/detail/" + customer + "/loans/create";
+ browser.wait(EC.visibilityOf($('a[href="' + link + '"]')));
+ $('a[href="' + link + '"]').click();
+ },
+ selectProduct: function (productName) {
+ browser.sleep(2000);
+ browser.wait(EC.elementToBeClickable(productSelect), 3000);
+ productSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', productName));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ browser.wait(EC.invisibilityOf($("mat-tooltip-component")), 4000);
+ },
+ selectProductFromOpenList: function (productName) {
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', productName));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ browser.wait(EC.invisibilityOf($("mat-tooltip-component")), 4000);
+ },
+ verifyStateOfLoanAccountWithIdIs: function (identifier, expectedState) {
+ browser.wait(EC.visibilityOf($("tbody tr")), 5000);
+ //if > page of entries, need to implement way to page in order to find correct row
+ actualState = $$('tbody tr').filter(function (elem, index) {
+ return elem.$(".td-data-table-cell").getText().then(function (text) {
+ return text === identifier;
+ });
+ }).$$(".td-data-table-cell").get(3).getText();
+ expect(actualState).toEqual(expectedState);
+ },
+ enterTextIntoShortNameInputField: function (text) {
+ browser.wait(EC.elementToBeClickable(shortNameInput), 5000);
+ shortNameInput.click().sendKeys(text);
+ },
+ enterTextIntoPrincipalAmountInputField: function (text) {
+ principalAmountInput.click().sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
+ principalAmountInput.sendKeys(text);
+ },
+ enterTextIntoInterestRateInputField: function (text) {
+ interestRateInput.click().sendKeys(protractor.Key.BACK_SPACE);
+ interestRateInput.sendKeys(protractor.Key.BACK_SPACE);
+ interestRateInput.sendKeys(protractor.Key.BACK_SPACE);
+ interestRateInput.sendKeys(protractor.Key.BACK_SPACE);
+ interestRateInput.sendKeys(text);
+ },
+ verifyLoanAccountNotOfferedForSelection: function(accountIdentifier){
+ browser.wait(EC.elementToBeClickable(productSelect), 3000);
+ productSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ expect(element(by.cssContainingText('.mat-option', accountIdentifier)).isPresent()).toBe(false);
+ },
+ verifyDepositAccountNotOfferedForSelection: function(accountIdentifier){
+ browser.executeScript("arguments[0].scrollIntoView();", depositAccountSelect.getWebElement());
+ browser.wait(EC.elementToBeClickable(depositAccountSelect), 3000);
+ depositAccountSelect.click();
+ expect($(".mat-option").isPresent()).toBe(true);
+ expect(element(by.cssContainingText('.mat-option', accountIdentifier)).isPresent()).toBe(false);
+ },
+ enterTextIntoTermInputField: function (text) {
+ termInput.click().clear().sendKeys(text);
+ },
+ selectTemporalUnitForTerm: function (temporalUnit) {
+ browser.executeScript("arguments[0].scrollIntoView();", termSelect.getWebElement());
+ browser.wait(EC.visibilityOf(termSelect), 2000);
+ termSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', temporalUnit));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ },
+ enterTextIntoPaymentPeriodInputField: function (text) {
+ paymentPeriod.click().clear().sendKeys(text);
+ },
+ selectPaymentPeriod: function (paymentPeriod) {
+ browser.executeScript("arguments[0].scrollIntoView();", paymentPeriodSelect.getWebElement());
+ browser.wait(EC.visibilityOf(paymentPeriodSelect), 2000);
+ paymentPeriodSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', paymentPeriod));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ },
+ selectDayForMonthlyRepayment: function (day) {
+ browser.executeScript("arguments[0].scrollIntoView();", dayForMonthlyRepaySelect.getWebElement());
+ browser.wait(EC.visibilityOf(dayForMonthlyRepaySelect), 2000);
+ dayForMonthlyRepaySelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', day));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ },
+ selectSecondRadioOptionForMonthlyRepayment: function(){
+ radioMonthSetting2.click();
+ },
+ selectWeekdayForMonthlyRepayment: function (ordinaryNumber, weekday) {
+ browser.executeScript("arguments[0].scrollIntoView();", numberDaySelectMonthlyRepayment.getWebElement());
+ browser.wait(EC.visibilityOf(numberDaySelectMonthlyRepayment), 2000);
+ numberDaySelectMonthlyRepayment.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', ordinaryNumber));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ weekdaySelectMonthlyRepayment.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', weekday));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ },
+ selectDepositAccount: function (depositAccount) {
+ browser.executeScript("arguments[0].scrollIntoView();", depositAccountSelect.getWebElement());
+ browser.wait(EC.visibilityOf(depositAccountSelect), 2000);
+ depositAccountSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ opt = element(by.cssContainingText('.mat-option', depositAccount));
+ browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
+ browser.wait(EC.elementToBeClickable(opt), 2000);
+ opt.click();
+ },
+ clickEnabledCreateMemberLoanButton: 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 MEMBER LOAN";
+ });
+ }).click();
+ },
+ clickEnabledUpdateMemberLoanButton: 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 MEMBER LOAN";
+ });
+ }).click();
+ },
+ verifyTransactionCharge: function(chargeName, chargeAmount){
+ browser.sleep(1000);
+ 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 === chargeName;
+ });
+ }).$$(".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) {
+ return text === transaction;
+ });
+ }).click();
+ },
+ verifyLoanHasStatus: function (expectedStatus) {
+ browser.wait(EC.visibilityOf($("fims-state-display")), 2000);
+ status = $("fims-state-display .mat-list-text .mat-line").getText();
+ expect(status).toEqual(expectedStatus);
+ },
+ goToStepDebtToIncomeRatio: function(){
+ browser.sleep(100);
+ browser.wait(EC.elementToBeClickable($$(".td-step-label").get(1)), 3000);
+ $$(".td-step-label").get(1).click();
+ },
+ goToStepCoSigner: function(){
+ browser.sleep(100);
+ browser.wait(EC.elementToBeClickable($$(".td-step-label").get(2)), 3000);
+ $$(".td-step-label").get(2).click();
+ },
+ 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) {
+ return text === "CREATE MEMBER LOAN";
+ });
+ }).first().isEnabled()).toBe(false);
+ },
+ verifyButtonCreateMemberLoanEnabled: function(){
+ expect(primaryButton.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "CREATE MEMBER LOAN";
+ });
+ }).first().isEnabled()).toBe(true);
+ },
+ verifyButtonUpdateMemberLoanDisabled: function(){
+ expect(primaryButton.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "UPDATE MEMBER LOAN";
+ });
+ }).first().isEnabled()).toBe(false);
+ },
+ verifyButtonUpdateMemberLoanEnabled: function(){
+ expect(primaryButton.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "UPDATE MEMBER LOAN";
+ });
+ }).first().isEnabled()).toBe(true);
+ },
+ clickButtonAddDebt: function(){
+ browser.sleep(200);
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "ADD DEBT";
+ });
+ }).click();
+ },
+ clickButtonAddIncome: function(){
+ browser.sleep(200);
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "ADD INCOME";
+ });
+ }).click();
+ },
+ removeDebtAtPosition: function(position){
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "REMOVE DEBT";
+ });
+ }).get(position-1).click();
+ },
+ removeIncomeAtPosition: function(position){
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "REMOVE INCOME";
+ });
+ }).get(position-1).click();
+ },
+ enterTextDescriptionInputFieldForDebt: function(text, number) {
+ browser.wait(EC.visibilityOf(descriptionInputsDebt.get(number-1)), 2000)
+ descriptionInputsDebt.get(number-1).clear().click().sendKeys(text);
+ },
+ enterTextIntoAmountInputFieldForDebt: function(text, number) {
+ browser.wait(EC.visibilityOf(amountInputsDebt.get(number-1)), 2000)
+ amountInputsDebt.get(number-1).clear().click().sendKeys(text);
+ },
+ enterTextIntoDescriptionInputFieldForIncome: function(text, number) {
+ browser.wait(EC.visibilityOf(descriptionInputsIncome.get(number-1)), 2000)
+ descriptionInputsIncome.get(number-1).clear().click().sendKeys(text);
+ },
+ enterTextIntoAmountInputFieldForIncome: function(text, number) {
+ browser.wait(EC.visibilityOf(amountInputsIncome.get(number-1)), 2000)
+ amountInputsIncome.get(number-1).clear().click().sendKeys(text);
+ },
+ verifyDebtTotalIs: function(amount) {
+ expect(debtsTotal.getText()).toMatch(amount);
+ },
+ verifyIncomeTotalIs: function(amount) {
+ expect(incomeTotal.getText()).toMatch(amount);
+ },
+ verifyDebtIncomeRatioIs: function(amount) {
+ expect(ratio.getText()).toMatch(amount);
+ },
+ enterTextIntoMemberInputField: function(text) {
+ browser.wait(EC.elementToBeClickable(memberSelect), 5000);
+ memberSelect.click().clear().sendKeys(text);
+ },
+ clickButtonAddDocument: function(){
+ browser.sleep(200);
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "ADD DOCUMENT";
+ });
+ }).click();
+ },
+ removeDocumentAtPosition: function(position){
+ buttons.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "REMOVE DOCUMENT";
+ });
+ }).get(position-1).click();
+ },
+ viewPlannedPaymentForCustomerLoan: function(customer, loanProduct, loanAccount){
+ link = "/customers/detail/" + customer + "/loans/products/" + loanProduct + "/detail/" + loanAccount + "/payments";
+ browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 6000);
+ $('a[href="' + link + '"]').click();
+ },
+ viewDebtIncomeReportForCustomerLoan: function(customer, loanProduct, loanAccount){
+ link = "/customers/detail/" + customer + "/loans/products/" + loanProduct + "/detail/" + loanAccount + "/debtIncome";
+ browser.wait(EC.elementToBeClickable($('a[href="' + link + '"]')), 6000);
+ $('a[href="' + link + '"]').click();
+ }
+};
diff --git a/Pages/Customers.js b/Pages/Customers.js
index 229fd3e..cbb8e88 100644
--- a/Pages/Customers.js
+++ b/Pages/Customers.js
@@ -25,19 +25,6 @@
//create loan account
var shortNameInput = $("fims-id-input[controlname='identifier'] input");
-var principalAmountInput = $("fims-number-input[controlname='principalAmount'] input");
-var interestRateInput = $("fims-number-input[controlname='interest'] input");
-var termInput = $("fims-text-input[controlname='term'] input");
-var termSelect = $("mat-select[formcontrolname='termTemporalUnit'] .mat-select-trigger");
-var paymentPeriod = $("fims-text-input[controlname='paymentPeriod'] input");
-var paymentPeriodSelect = $("mat-select[formcontrolname='termTemporalUnit'] .mat-select-trigger");
-var depositAccountSelect = $("mat-select[formcontrolname='depositAccountIdentifier'] .mat-select-trigger");
-
-var radioMonthSetting1 = $$("mat-radio-group[formcontrolname='monthSetting'] mat-radio-button").get(0);
-var dayForMonthlyRepaySelect = $("mat-select[formcontrolname='monthSettingDay'] .mat-select-trigger");
-var radioMonthSetting2 = $$("mat-radio-group[formcontrolname='monthSetting'] mat-radio-button").get(1);
-var numberDaySelectMonthlyRepayment = $("mat-select[formcontrolname='monthSettingWeek'] .mat-select-trigger");
-var weekdaySelectMonthlyRepayment = $("mat-select[formcontrolname='monthSettingDayInWeek'] .mat-select-trigger");
//identification cards
var identificationCardNumberInput = $("fims-id-input[controlname='number'] input");
@@ -55,9 +42,6 @@
var checkboxMandatory = $("mat-checkbox[formcontrolname='mandatory']");
var checkboxAutoAssign = $("mat-checkbox[formcontrolname='predefined']");
-//payroll
-
-
//general elements
var linkCustomers = $$("a[href='/customers']");
var primaryButton = $$(".mat-raised-button.mat-primary");
@@ -295,112 +279,6 @@
browser.wait(EC.elementToBeClickable(shortNameInput), 5000);
shortNameInput.click().sendKeys(text);
},
- enterTextIntoPrincipalAmountInputField: function (text) {
- principalAmountInput.click().sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(protractor.Key.BACK_SPACE);
- principalAmountInput.sendKeys(text);
- },
- enterTextIntoInterestRateInputField: function (text) {
- interestRateInput.click().sendKeys(protractor.Key.BACK_SPACE);
- interestRateInput.sendKeys(protractor.Key.BACK_SPACE);
- interestRateInput.sendKeys(protractor.Key.BACK_SPACE);
- interestRateInput.sendKeys(protractor.Key.BACK_SPACE);
- interestRateInput.sendKeys(text);
- },
- verifyLoanAccountNotOfferedForSelection: function(accountIdentifier){
- browser.wait(EC.elementToBeClickable(productSelect), 3000);
- productSelect.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- expect(element(by.cssContainingText('.mat-option', accountIdentifier)).isPresent()).toBe(false);
- },
- verifyDepositAccountNotOfferedForSelection: function(accountIdentifier){
- browser.executeScript("arguments[0].scrollIntoView();", depositAccountSelect.getWebElement());
- browser.wait(EC.elementToBeClickable(depositAccountSelect), 3000);
- depositAccountSelect.click();
- expect($(".mat-option").isPresent()).toBe(true);
- expect(element(by.cssContainingText('.mat-option', accountIdentifier)).isPresent()).toBe(false);
- },
- enterTextIntoTermInputField: function (text) {
- termInput.click().clear().sendKeys(text);
- },
- selectTemporalUnitForTerm: function (temporalUnit) {
- browser.executeScript("arguments[0].scrollIntoView();", termSelect.getWebElement());
- browser.wait(EC.visibilityOf(termSelect), 2000);
- termSelect.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- opt = element(by.cssContainingText('.mat-option', temporalUnit));
- browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
- browser.wait(EC.elementToBeClickable(opt), 2000);
- opt.click();
- },
- enterTextIntoPaymentPeriodInputField: function (text) {
- paymentPeriod.click().clear().sendKeys(text);
- },
- selectPaymentPeriod: function (paymentPeriod) {
- browser.executeScript("arguments[0].scrollIntoView();", paymentPeriodSelect.getWebElement());
- browser.wait(EC.visibilityOf(paymentPeriodSelect), 2000);
- paymentPeriodSelect.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- opt = element(by.cssContainingText('.mat-option', paymentPeriod));
- browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
- browser.wait(EC.elementToBeClickable(opt), 2000);
- opt.click();
- },
- selectDayForMonthlyRepayment: function (day) {
- browser.executeScript("arguments[0].scrollIntoView();", dayForMonthlyRepaySelect.getWebElement());
- browser.wait(EC.visibilityOf(dayForMonthlyRepaySelect), 2000);
- dayForMonthlyRepaySelect.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- opt = element(by.cssContainingText('.mat-option', day));
- browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
- browser.wait(EC.elementToBeClickable(opt), 2000);
- opt.click();
- },
- selectSecondRadioOptionForMonthlyRepayment: function(){
- radioMonthSetting2.click();
- },
- selectWeekdayForMonthlyRepayment: function (ordinaryNumber, weekday) {
- browser.executeScript("arguments[0].scrollIntoView();", numberDaySelectMonthlyRepayment.getWebElement());
- browser.wait(EC.visibilityOf(numberDaySelectMonthlyRepayment), 2000);
- numberDaySelectMonthlyRepayment.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- opt = element(by.cssContainingText('.mat-option', ordinaryNumber));
- browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
- browser.wait(EC.elementToBeClickable(opt), 2000);
- opt.click();
- weekdaySelectMonthlyRepayment.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- opt = element(by.cssContainingText('.mat-option', weekday));
- browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
- browser.wait(EC.elementToBeClickable(opt), 2000);
- opt.click();
- },
- selectDepositAccount: function (depositAccount) {
- browser.executeScript("arguments[0].scrollIntoView();", depositAccountSelect.getWebElement());
- browser.wait(EC.visibilityOf(depositAccountSelect), 2000);
- depositAccountSelect.click();
- browser.wait(EC.visibilityOf($(".mat-option")), 5000);
- opt = element(by.cssContainingText('.mat-option', depositAccount));
- browser.executeScript("arguments[0].scrollIntoView();", opt.getWebElement());
- browser.wait(EC.elementToBeClickable(opt), 2000);
- opt.click();
- },
- clickEnabledCreateMemberLoanButton: 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 MEMBER LOAN";
- });
- }).click();
- },
verifyTransactionCharge: function(chargeName, chargeAmount){
browser.sleep(1000);
browser.wait(EC.visibilityOf($("fims-case-command-confirmation-form table tbody")), 3000);
@@ -419,11 +297,6 @@
});
}).click();
},
- verifyLoanHasStatus: function (expectedStatus) {
- browser.wait(EC.visibilityOf($("fims-state-display")), 2000);
- status = $("fims-state-display .mat-list-text .mat-line").getText();
- expect(status).toEqual(expectedStatus);
- },
//customer tasks
goToTasks: function(){
diff --git a/Specs/gate1.js b/Specs/gate1.js
index 3d12ca3..6195ace 100644
--- a/Specs/gate1.js
+++ b/Specs/gate1.js
@@ -34,6 +34,7 @@
var Roles = require('../Pages/Roles');
var Teller = require('../Pages/Teller');
var Customers = require('../Pages/Customers');
+var CustomerLoans = require('../Pages/CustomerLoans');
var Deposits = require('../Pages/Deposits');
var Accounting = require('../Pages/Accounting');
var Loans = require('../Pages/Loans');
@@ -475,12 +476,12 @@
Customers.clickCreateLoanAccountForMember(customerAccount);
Customers.selectProduct("My loan " + loanShortName);
Customers.enterTextIntoShortNameInputField(loanAccountShortName);
- Customers.enterTextIntoPrincipalAmountInputField("5000");
- Customers.enterTextIntoTermInputField("12");
+ CustomerLoans.enterTextIntoPrincipalAmountInputField("5000");
+ CustomerLoans.enterTextIntoTermInputField("12");
//verify correct radio button selected; BUG
- Customers.selectDayForMonthlyRepayment("3.");
- Customers.selectDepositAccount(customerAccount + ".9100.00001(" + depositIdentifier + ")");
- Customers.clickEnabledCreateMemberLoanButton();
+ CustomerLoans.selectDayForMonthlyRepayment("3.");
+ CustomerLoans.selectDepositAccount(customerAccount + ".9100.00001(" + depositIdentifier + ")");
+ CustomerLoans.clickEnabledCreateMemberLoanButton();
Common.verifyMessagePopupIsDisplayed("Case is going to be saved");
Customers.verifyStateOfLoanAccountWithIdIs(loanAccountShortName, "CREATED");
});
@@ -501,7 +502,7 @@
Customers.clickButtonForTask("APPROVE");
Customers.clickButtonForTransaction("APPROVE");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
- Customers.verifyLoanHasStatus("APPROVED");
+ CustomerLoans.verifyLoanHasStatus("APPROVED");
});
it('should be able to disburse loan - no task', function () {
//currently error if this is done too quickly; workaround
@@ -513,7 +514,7 @@
Customers.verifyTransactionCharge("Disbursement fee", "05.00");
Customers.clickButtonForTransaction("DISBURSE");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
- Customers.verifyLoanHasStatus("ACTIVE");
+ CustomerLoans.verifyLoanHasStatus("ACTIVE");
});
it('bookings should be as expected (open/approve/disburse loan)', function () {
//verify fees have been booked as expected
diff --git a/Specs/loans1_creation&assignment.js b/Specs/loans1_creation&assignment.js
index 92653b7..5f3c9a2 100644
--- a/Specs/loans1_creation&assignment.js
+++ b/Specs/loans1_creation&assignment.js
@@ -6,6 +6,7 @@
var Roles = require('../Pages/Roles');
var Teller = require('../Pages/Teller');
var Customers = require('../Pages/Customers');
+var CustomerLoans = require('../Pages/CustomerLoans');
var Deposits = require('../Pages/Deposits');
var Accounting = require('../Pages/Accounting');
var Loans = require('../Pages/Loans');
@@ -312,12 +313,12 @@
Customers.clickManageLoanAccountsForMember(customerAccount);
Customers.clickCreateLoanAccountForMember(customerAccount);
//verify loan product cannot be selected
- Customers.verifyLoanAccountNotOfferedForSelection(loanShortName2);
+ CustomerLoans.verifyLoanAccountNotOfferedForSelection(loanShortName2);
Customers.selectProductFromOpenList(loanShortName);
});
it('should not be able to select deposit account if not enabled', function () {
//verify deposit account cannot be selected
- Customers.verifyDepositAccountNotOfferedForSelection(customerAccount + ".9100.00001(" + depositIdentifier +")");
+ CustomerLoans.verifyDepositAccountNotOfferedForSelection(customerAccount + ".9100.00001(" + depositIdentifier +")");
});
it('should open deposit account', function () {
Teller.goToTellerManagementViaSidePanel();
@@ -356,58 +357,82 @@
Common.verifyFirstRowOfSearchResultHasTextAsId(customerAccount);
Common.clickLinkShowForRowWithId(customerAccount);
Customers.clickManageLoanAccountsForMember(customerAccount);
- Customers.clickCreateLoanAccountForMember(customerAccount);
- Customers.selectProduct("My loan " + loanShortName);
- Customers.enterTextIntoShortNameInputField(loanAccountShortName);
- Customers.enterTextIntoPrincipalAmountInputField("9999.99");
+ CustomerLoans.clickCreateLoanAccountForMember(customerAccount);
+ CustomerLoans.selectProduct("My loan " + loanShortName);
+ CustomerLoans.enterTextIntoShortNameInputField(loanAccountShortName);
+ CustomerLoans.enterTextIntoPrincipalAmountInputField("9999.99");
//invalid input, error
- Customers.enterTextIntoPrincipalAmountInputField("50,000.01");
+ CustomerLoans.enterTextIntoPrincipalAmountInputField("50,000.01");
//invalid input, error
- Customers.enterTextIntoPrincipalAmountInputField("10,000");
- Customers.enterTextIntoInterestRateInputField("3.65");
+ CustomerLoans.enterTextIntoPrincipalAmountInputField("10,000");
+ CustomerLoans.enterTextIntoInterestRateInputField("3.65");
//invalid input, error
- Customers.enterTextIntoInterestRateInputField("0.79");
+ CustomerLoans.enterTextIntoInterestRateInputField("0.79");
//invalid input, error
- Customers.enterTextIntoInterestRateInputField("3.60");
- Customers.enterTextIntoTermInputField("62");
+ CustomerLoans.enterTextIntoInterestRateInputField("3.60");
+ CustomerLoans.enterTextIntoTermInputField("62");
//invalid input, error
- Customers.enterTextIntoTermInputField("60");
+ CustomerLoans.enterTextIntoTermInputField("60");
//valid input, no error
- Customers.selectTemporalUnitForTerm("years");
+ CustomerLoans.selectTemporalUnitForTerm("years");
//invalid input, error
- Customers.enterTextIntoTermInputField("5");
+ CustomerLoans.enterTextIntoTermInputField("5");
//valid input, no error
- Customers.enterTextIntoPaymentPeriodInputField("62");
+ CustomerLoans.enterTextIntoPaymentPeriodInputField("62");
//invalid input, error: Invalid payment period. Maximum allowed are 260 week(s), 60 month(s) or 5 year(s).
- Customers.enterTextIntoPaymentPeriodInputField("6");
+ CustomerLoans.enterTextIntoPaymentPeriodInputField("6");
//valid input, no error
- Customers.selectPaymentPeriod("years");
+ CustomerLoans.selectPaymentPeriod("years");
//invalid input, error
- Customers.selectPaymentPeriod("months");
+ CustomerLoans.selectPaymentPeriod("months");
//valid input, no error
- Customers.selectSecondRadioOptionForMonthlyRepayment();
- Customers.selectWeekdayForMonthlyRepayment("last", "Friday");
- Customers.selectDepositAccount(customerAccount + ".9100.00001(" + depositIdentifier + ")");
+ CustomerLoans.selectSecondRadioOptionForMonthlyRepayment();
+ CustomerLoans.selectWeekdayForMonthlyRepayment("last", "Friday");
+ CustomerLoans.selectDepositAccount(customerAccount + ".9100.00001(" + depositIdentifier + ")");
//change loan product to the other one
- Customers.selectProduct(loanShortName2);
+ CustomerLoans.selectProduct(loanShortName2);
//error for principal: Value must be smaller than or equal to 1500
- Customers.enterTextIntoPrincipalAmountInputField("1500");
+ CustomerLoans.enterTextIntoPrincipalAmountInputField("1500");
//interest rate input is disabled and shows 15%
//error for payment period: Invalid payment period. Maximum allowed are 21 week(s), 5 month(s) or 0 year(s).
- Customers.selectPaymentPeriod("months");
+ CustomerLoans.selectPaymentPeriod("months");
//debt to income ratio
+ CustomerLoans.goToStepDebtToIncomeRatio();
+ CustomerLoans.clickButtonAddDebt();
+ CustomerLoans.enterTextDescriptionInputFieldForDebt("My loan", 1);
+ CustomerLoans.enterTextIntoAmountInputFieldForDebt("10000", 1);
+ CustomerLoans.verifyDebtTotalIs("10,000.00");
+ CustomerLoans.clickButtonAddDebt();
+ CustomerLoans.enterTextDescriptionInputFieldForDebt("My mortgage", 2);
+ CustomerLoans.enterTextIntoAmountInputFieldForDebt("5000", 2);
+ CustomerLoans.verifyDebtTotalIs("15,000.00");
+ CustomerLoans.clickButtonAddIncome();
+ CustomerLoans.enterTextIntoDescriptionInputFieldForIncome("First job", 1);
+ CustomerLoans.enterTextIntoAmountInputFieldForIncome("5000",1);
+ CustomerLoans.verifyIncomeTotalIs("5,000.00");
+ CustomerLoans.verifyDebtIncomeRatioIs("03.00");
+ CustomerLoans.clickButtonAddIncome();
+ CustomerLoans.enterTextIntoDescriptionInputFieldForIncome("Second job", 2);
+ CustomerLoans.enterTextIntoAmountInputFieldForIncome("5000",2);
+ CustomerLoans.verifyIncomeTotalIs("10,000.00");
+ CustomerLoans.verifyDebtIncomeRatioIs("01.50");
+ //browser.pause();
+ CustomerLoans.goToStepCoSigner();
//co-signer
+ //CustomerLoans.enterTextIntoMemberInputField();
//documents
- Customers.clickEnabledCreateMemberLoanButton();
+ CustomerLoans.goToStepDocuments();
+ browser.pause();
+ CustomerLoans.clickEnabledCreateMemberLoanButton();
Common.verifyMessagePopupIsDisplayed("Case is going to be saved");
Customers.verifyStateOfLoanAccountWithIdIs(loanAccountShortName, "CREATED");
//details
});
it('planned payment', function () {
-
+ CustomerLoans.viewPlannedPaymentForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
});
it('debt/income ratio', function () {
-
+ CustomerLoans.viewDebtIncomeReportForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
});
it('editing loan account possible until approved', function () {
//edit loan account to different one (different product, different settings)
@@ -416,9 +441,13 @@
});
it('update/deletion of unassigned/assigned product', function () {
//assigned product cannot be deleted anymore
- //what about disabled/edited? fees/tasks???
+ //what about disabled/edited?
+ //disable assigned product & check customer loan account: ATEN-475
+ //try to edit assigned product: ATEN-507
+ //fees: try to edit fees
+ //tasks: try to edit/add tasks: bug ATEN-318
//unassigned product can be disabled/edited
- //edit product and verify updated
+ //edit product and verify updated, edit fees and add tasks
//unassigned product can be deleted
});
});
\ No newline at end of file