Protractor tests.
diff --git a/Pages/Teller.js b/Pages/Teller.js
index 7aea997..5a320ab 100644
--- a/Pages/Teller.js
+++ b/Pages/Teller.js
@@ -10,6 +10,8 @@
var primaryButton = $$(".mat-raised-button.mat-primary");
var checkboxChargesInCash = $("md-checkbox");
+var loanAccountSelect = $("md-select[formcontrolname='caseInstance'] .mat-select-trigger");
+
module.exports = {
goToTellerManagementViaSidePanel: function() {
browser.wait(EC.elementToBeClickable($("a[href='/teller']")), 5000);
@@ -135,7 +137,7 @@
a = $('a[href= "' + link +'"]');
browser.wait(EC.elementToBeClickable(a), 3000);
a.click();
- browser.wait(EC.visibilityOf($("fims-teller-transaction-form")), 2000);
+ browser.wait(EC.visibilityOf($("fims-loan-transaction-form")), 2000);
},
verifyActionRepayLoanNotOfferedForCustomer: function(customerAccount){
link = "/teller/customers/detail/" + customerAccount + "/transaction/deposit?transactionType=PPAY";
@@ -150,6 +152,14 @@
//browser.executeScript("arguments[0].scrollIntoView();", element(by.cssContainingText('.mat-option', accountIdentifier)).getWebElement());
element(by.cssContainingText('.mat-option', accountIdentifier)).click();
},
+ selectLoanAccountToBeAffected: function(loanAccountIdentifier){
+ browser.sleep(2000);
+ browser.wait(EC.elementToBeClickable(loanAccountSelect), 3000);
+ loanAccountSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ //browser.executeScript("arguments[0].scrollIntoView();", element(by.cssContainingText('.mat-option', accountIdentifier)).getWebElement());
+ element(by.cssContainingText('.mat-option', loanAccountIdentifier)).click();
+ },
enterTextIntoAmountInputField: function(text) {
browser.wait(EC.elementToBeClickable(amountInput), 5000);
amountInput.click().clear().sendKeys(text);
@@ -224,5 +234,7 @@
verifyCashdrawLimitHintIsDisplayed: function(text){
browser.wait(EC.textToBePresentInElement($(".text-md"), text), 2000);
},
-
+ verifyExpectedPaymentAmount: function(text) {
+ browser.wait(EC.textToBePresentInElement($("fims-loan-transaction-form p"), text), 2000)
+ },
};
\ No newline at end of file
diff --git a/Specs/gate1.js b/Specs/gate1.js
index 5bc5500..614a9b1 100644
--- a/Specs/gate1.js
+++ b/Specs/gate1.js
@@ -133,7 +133,7 @@
Offices.enterTextIntoCashWithdrawalLimitInputField("1000");
Offices.enterTextIntoTellerAccountInputFieldAndSelectMatchingEntry(tellerAccount);
Offices.enterTextIntoVaultAccountInputFieldAndSelectMatchingEntry("7351");
- Offices.enterTextIntoChequesReceivableAccountInputFieldAndSelectMatchingEntry("7290");
+ Offices.enterTextIntoChequesReceivableAccountInputFieldAndSelectMatchingEntry(chequeReceivablesAccount);
Offices.clickCreateTellerButton();
Common.verifyMessagePopupIsDisplayed("Teller is going to be saved");
//workaround for current bug that teller is not always listed immediately
@@ -489,7 +489,6 @@
Customers.clickLinkTasks(customerAccount, loanShortName, loanAccountShortName);
//checkbox already selected since one task only that already has been executed
Customers.clickButtonForTask("APPROVE");
-
Customers.clickButtonForTransaction("APPROVE");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
Customers.verifyLoanHasStatus("APPROVED");
@@ -572,10 +571,31 @@
Accounting.clickLinkShowForAccountWithIdentifier(customerAccount + ".cli.00003");
Accounting.verifyAccountInfo("Balance", "0");
});
- it('should be able to repay loan', function () {
-
+ it('should be able to repay loan - expected payment', function () {
+ Teller.goToTellerManagementViaSidePanel();
+ //will be successful even if the customer does not exist, clicks one of the buttons too quickly: need to fix
+ Teller.clickButtonShowAtIndex(0);
+ Teller.verifyCardTitleHasNameOfCustomer("Thomas Pynchon");
+ Teller.clickOnRepayLoanForCustomer(customerAccount);
+ Teller.selectLoanAccountToBeAffected(customerAccount + ".clp.00001(" + loanShortName + ")");
+ Teller.verifyExpectedPaymentAmount("Expected payment: 408.6");
+ Teller.enterTextIntoAmountInputField("408.6");
+ Teller.clickEnabledCreateTransactionButton();
+ Teller.verifyTransactionAmount("408.6");
+ Teller.verifyTransactionCharge("repay-fees", "205");
+ Teller.clickEnabledConfirmTransactionButton();
+ Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
});
- it('bookings should be as expected (repay loan)', function () {
-
+ it('journal entry should be as expected (repay loan)', function () {
+ Accounting.goToAccountingViaSidePanel();
+ Accounting.goToJournalEntries();
+ Accounting.enterTextIntoSearchAccountInputField(customerAccount + ".clp.00001");
+ Accounting.clickSearchButton();
+ Accounting.clickSecondJournalEntry();
+ Accounting.verifySecondJournalEntry("Principal Payment", "Amount: 408.60");
+ Accounting.verifyAccountHasBeenDebitedWithAmountInRow(tellerAccount, "480.60", 1);
+ Accounting.verifyAccountHasBeenCreditedWithAmountInRow(customerAccount + ".clf.00002", "205.00", 2);
+ Accounting.verifyAccountHasBeenCreditedWithAmountInRow(customerAccount + ".clp.00001", "203.60", 3);
+ browser.pause();
});
});
\ No newline at end of file