Protractor tests. Loan product/account tests.
diff --git a/Pages/Loans.js b/Pages/Loans.js
index 778fcc6..d4964b3 100644
--- a/Pages/Loans.js
+++ b/Pages/Loans.js
@@ -220,6 +220,15 @@
             });
         }).click();
     },
+    clickEnabledUpdateProductButton: 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 PRODUCT";
+            });
+        }).click();
+    },
     clickEnabledUpdateLossProvisionButton: function(){
         browser.executeScript("arguments[0].scrollIntoView();", primaryButton.first().getWebElement());
         browser.wait(EC.elementToBeClickable(primaryButton.first()), 3000);
@@ -411,6 +420,10 @@
         browser.sleep(500);
         expect($("a[title='Edit product']").isPresent()).toBe(true);
     },
+    clickEditLoanProductButton: function(){
+        browser.sleep(500);
+        $("a[title='Edit product']").click();
+    },
     verifyEditLoanProductButtonIsNotDisplayed: function(){
         browser.sleep(500);
         expect($("a[title='Edit product']").isPresent()).toBe(false);
@@ -478,4 +491,20 @@
         browser.wait(EC.visibilityOf($(".mat-option")), 5000);
         element(by.cssContainingText('.mat-option',name)).click();
     },
+    verifyTermForLoanProduct: function(term) {
+        expect($$("fims-layout-card-over .mat-list-text").filter(function (elem, index) {
+            return elem.$("h3").getText().then(function (text) {
+                return text === "Term";
+            });
+        }).first().$("p").getText().then(function (text) {
+            return text === term;
+        })).toBe(true);
+    },
+    removeRangeAtPosition: function(position){
+        buttons.filter(function(elem, index) {
+            return elem.$("span").getText().then(function(text) {
+                return text === "REMOVE RANGE";
+            });
+        }).get(position-1).click();
+    },
 };
\ No newline at end of file
diff --git a/Specs/cheque_management.js b/Specs/cheque_management.js
index a71ea08..2410513 100644
--- a/Specs/cheque_management.js
+++ b/Specs/cheque_management.js
@@ -26,6 +26,7 @@
     depositName = helper.getRandomString(8);
     tellerAccount = helper.getRandomString(4);
     chequesReceivableAccount = helper.getRandomString(4);
+    cashOverShortAccount = "COS_" + helper.getRandomString(4);
     revenueAccount = helper.getRandomString(4);
     loanShortName = helper.getRandomString(6);
     taskIdentifier = helper.getRandomString(3);
@@ -62,6 +63,15 @@
         Accounting.enterTextIntoAccountNameInputField("Revenue from deposit charges");
         Accounting.clickButtonCreateAccount();
         Common.verifyMessagePopupIsDisplayed("Account is going to be saved");
+        Accounting.goToAccountingViaSidePanel();
+        Common.clickLinkShowForRowWithId("2000");
+        Common.clickLinkShowForRowWithId("3300");
+        Accounting.clickCreateNewAccountInLedger("3300");
+        Accounting.enterTextIntoAccountIdentifierInputField(cashOverShortAccount);
+        Accounting.verifyRadioExpenseToBeSelected();
+        Accounting.enterTextIntoAccountNameInputField("Cash over short account");
+        Accounting.clickButtonCreateAccount();
+        Common.verifyMessagePopupIsDisplayed("Account is going to be saved");
     });
     it('should create a new employee with administrator permissions', function () {
         Employees.goToManageEmployeesViaSidePanel();
@@ -90,6 +100,7 @@
         Offices.enterTextIntoTellerAccountInputFieldAndSelectMatchingEntry(tellerAccount);
         Offices.enterTextIntoVaultAccountInputFieldAndSelectMatchingEntry("7351");
         Offices.enterTextIntoChequesReceivableAccountInputFieldAndSelectMatchingEntry(chequesReceivableAccount);
+        Offices.enterTextIntoCashOverShortInputFieldAndSelectMatchingEntry(cashOverShortAccount);
         Offices.clickCreateTellerButton();
         Common.verifyMessagePopupIsDisplayed("Teller is going to be saved");
         //workaround for current bug that teller is not always listed immediately
@@ -204,6 +215,9 @@
         Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
     });
     it('customer should be able to cash cheque - cheque is not open/not on us', function () {
+        //ToDo: workaround for bug; remove once fixed
+        Teller.goToTellerManagementViaSidePanel();
+        Teller.clickButtonShowAtIndex(0);
         Teller.clickOnCashChequeForCustomer(customerAccount);
         Cheques.enterTextIntoChequeNumberInputField("123456");
         Cheques.enterTextIntoBranchSortCodeInputField(branchSortCode);
diff --git a/Specs/loans1_creation&assignment.js b/Specs/loans1_creation&assignment.js
index f4af86e..f207ad1 100644
--- a/Specs/loans1_creation&assignment.js
+++ b/Specs/loans1_creation&assignment.js
@@ -708,21 +708,29 @@
         //Loans.verifyDeleteLoanProductButtonIsNotDisplayed();
         Loans.clickDeleteLoanProductButton();
         Common.confirmAction();
-        Common.verifyErrorMessageDisplayedWithTitleAndText("Product can't be deleted", "Product is already assigned to a customer");
+        Common.verifyErrorMessageDisplayedWithTitleAndText("Product can't be deleted", "Product is already assigned to a member.");
         Common.clickButtonOKInErrorMessage();
-        //tasks: try to add tasks: bug ATEN-318
     });
     it('unassigned product can be edited & deleted', function () {
         Loans.goToLoanProductsViaSidePanel();
-        Common.clickLinkShowForRowWithId(loanShortName2);
+        Common.clickLinkShowForRowWithId(loanShortName);
         CustomerLoans.verifyMessagesAreDisplayed("Product enabled", "This product can be assigned to a member");
         //disable product
         Loans.clickButtonDisableProduct();
         Common.verifyMessagePopupIsDisplayed("Product is going to be disabled");
         CustomerLoans.verifyMessagesAreDisplayed("Product not enabled", "To assign this product to a member it needs to be enabled first");
         //edit loan product
+        Loans.verifyEditLoanProductButtonIsDisplayed();
+        Loans.clickEditLoanProductButton();
+        Loans.enterTextIntoTermInputField("5000");
+        Loans.selectRadioButtonWeeks();
+        Loans.clickEnabledUpdateProductButton();
+        Common.verifyMessagePopupIsDisplayed("Product is going to be saved");
+        Loans.verifyTermForLoanProduct("5,000 YEARS");
+        //ToDo: customer loan, verify update
         //delete loan product
         Loans.clickDeleteLoanProductButton();
         Common.confirmAction();
+        Common.verifyMessagePopupIsDisplayed("Product is going to be deleted");
     });
 });
\ No newline at end of file
diff --git a/Specs/loans2_fees.js b/Specs/loans2_fees.js
index 91a7154..cdfdb78 100644
--- a/Specs/loans2_fees.js
+++ b/Specs/loans2_fees.js
@@ -466,8 +466,8 @@
         Teller.enterTextIntoAmountInputField("3000");
         Teller.clickEnabledCreateTransactionButton();
         Teller.verifyTransactionAmount("3000");
-        // Teller.verifyTransactionCharge("repay-fees", "2675");
-        // Teller.verifyTransactionCharge("repay-principal", "325");
+        //ToDo: Teller.verifyTransactionCharge("repay-fees", "2675");
+        //ToDo: Teller.verifyTransactionCharge("repay-principal", "325");
         Teller.verifyTransactionCharge("Total", "3000");
         Teller.clickEnabledConfirmTransactionButton();
         Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
@@ -490,10 +490,24 @@
         Loans.clickLinkManageFeesForLoanProduct(loanShortName);
         Common.clickLinkShowForRowWithId("disbursement-fee");
         Loans.clickButtonEditDisbursementFeeForLoanProduct(loanShortName);
-        browser.pause();
-
+        //verify proportional set to "Maximum balance", is set to "Repayment" however
+        Loans.enterTextIntoFeeAmountInputField("100");
+        Loans.selectRadioFixed();
+        Loans.selectRangeByName("MyRange_1");
+        Loans.selectRangeSegmentByName("MyStart(0.00 - 28,000.00)");
+        Loans.clickEnabledUpdateRangeButton();
+        Common.verifyMessagePopupIsDisplayed("Fee is going to be saved");
+        Common.clickBackButtonInTitleBar();
     });
     it('edit range in use by fee', function () {
-        //???
+        //bug: currently ranges can not be added, edited, or deleted anymore if loan product assigned to a member already
+        Loans.clickLinkManageRangesForLoanProduct(loanShortName);
+        Common.clickLinkShowForRowWithId("MyRange_1");
+        Loans.clickButtonEditRange();
+        Loans.removeRangeAtPosition(1);
+        //ToDo: range end for first range segment updates to 50,000
+        Loans.enterTextIntoRangeSegmentStartInputField("45000", 2);
+        Loans.clickEnabledUpdateRangeButton();
+        Common.verifyMessagePopupIsDisplayed("Range is going to be saved");
     });
 });
\ No newline at end of file