Protractor tests.
diff --git a/Pages/Accounting b/Pages/Accounting
index dd7ada6..aea7be6 100644
--- a/Pages/Accounting
+++ b/Pages/Accounting
@@ -8,6 +8,8 @@
var accountNameInput = $("input[formcontrolname=name]");
var accountBalanceInput = $("input[formcontrolname=balance]");
var primaryButton = $$(".mat-raised-button.mat-primary");
+var radioButtonAsset = $$("md-radio-button").get(0);
+var radioButtonRevenue = $$("md-radio-button").get(4);
module.exports = {
goToAccountingViaSidePanel: function() {
@@ -92,4 +94,14 @@
});
}).click();
},
+
+ verifyRadioAssetToBeSelected: function() {
+ expect(radioButtonAsset.getAttribute("class")).toMatch("mat-radio-checked");
+ },
+ verifyRadioAssetToBeDisabled: function() {
+ expect(radioButtonAsset.getAttribute("class")).toMatch("mat-radio-disabled");
+ },
+ verifyRadioRevenueToBeSelected: function() {
+ expect(radioButtonRevenue.getAttribute("class")).toMatch("mat-radio-checked");
+ },
};
\ No newline at end of file
diff --git a/Pages/Customers.js b/Pages/Customers.js
index 4a9833b..46e0f44 100644
--- a/Pages/Customers.js
+++ b/Pages/Customers.js
@@ -8,7 +8,7 @@
var middleNameInput = $(".mat-input-infix input[formcontrolname='middleName']");
var lastNameInput = $(".mat-input-infix input[formcontrolname='lastName']");
var birthDayInput = $(".mat-input-infix input[formcontrolname='dayOfBirth']");
-var memberCheckbox = $(".mat-input-infix input[formcontrolname='member']");
+var memberCheckbox = $("md-checkbox[formcontrolname='member']");
var streetInput = $(".mat-input-infix input[formcontrolname='street']");
var cityInput = $(".mat-input-infix input[formcontrolname='city']");
var countrySelect = $(".mat-input-infix input[formcontrolname='country']");
@@ -180,9 +180,9 @@
// });
// return depAccount;
// },
- getDepositAccountIdentifier: function(){
- return $$("md-list p").first().getText();
- },
+ // getDepositAccountIdentifier: function(){
+ // return $$("md-list p").first().getText();
+ // },
verifyStateOfDepositAccountWithIdIs: 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
@@ -193,4 +193,7 @@
}).$$(".td-data-table-cell").get(3).getText();
expect(actualState).toEqual(expectedState);
},
+ verifyIsMemberCheckboxSelected: function() {
+ expect(memberCheckbox.getAttribute("class")).toMatch("mat-checkbox-checked");
+ },
};
\ No newline at end of file
diff --git a/Pages/Deposits.js b/Pages/Deposits.js
index ee64755..6c61cf3 100644
--- a/Pages/Deposits.js
+++ b/Pages/Deposits.js
@@ -31,12 +31,17 @@
var expenseAccountInput = $("fims-account-select[formcontrolname='expenseAccountIdentifier'] input");
var accrueAccountInput = $("fims-account-select[formcontrolname='accrueAccountIdentifier'] input");
var equityLedgerInput = $("fims-ledger-select[formcontrolname='equityLedgerIdentifier'] input");
-var chargeNameInput = $("fims-deposit-product-charges-form input[formcontrolname='name']");
+var chargeNameInput1 = $$("fims-deposit-product-charges-form input[formcontrolname='name']").get(0);
+var chargeNameInput2 = $$("fims-deposit-product-charges-form input[formcontrolname='name']").get(1);
var chargeDescriptionInput = $("input[formcontrolname='description']");
-var chargeAmountInput = $("fims-number-input[controlname='amount'] input");
-var chargeTypeSelect = $("md-select[formcontrolname='actionIdentifier']");
-var incomeAccountInput = $("fims-account-select[formcontrolname='incomeAccountIdentifier'] input");
-var checkboxProportional = $("md-checkbox[formcontrolname='proportional']");
+var chargeAmountInput1 = $$("fims-number-input[controlname='amount'] input").get(0);
+var chargeAmountInput2 = $$("fims-number-input[controlname='amount'] input").get(1);
+var chargeTypeSelect1 = $$("md-select[formcontrolname='actionIdentifier']").get(0);
+var chargeTypeSelect2 = $$("md-select[formcontrolname='actionIdentifier']").get(1);
+var incomeAccountInput1 = $$("fims-account-select[formcontrolname='incomeAccountIdentifier'] input").get(0);
+var incomeAccountInput2 = $$("fims-account-select[formcontrolname='incomeAccountIdentifier'] input").get(1);
+var checkboxProportional1 = $$("md-checkbox[formcontrolname='proportional']").get(0);
+var checkboxProportional2 = $$("md-checkbox[formcontrolname='proportional']").get(1);
var primaryButton = $$(".mat-raised-button.mat-primary");
module.exports = {
@@ -50,6 +55,11 @@
browser.wait(EC.visibilityOf(createDeposit), 5000);
createDeposit.click();
},
+ clickButtonEditDepositProduct: function(identifier){
+ link = "/deposits/detail/" + identifier + "/edit";
+ browser.wait(EC.visibilityOf($('a[href="'+ link + '"]')));
+ $('a[href="'+ link + '"]').click();
+ },
verifyRadioCheckingIsSelected: function(element){
expect(radioChecking.getAttribute('class')).toMatch('mat-radio-checked')
},
@@ -72,6 +82,10 @@
browser.wait(EC.visibilityOf(shortNameInput), 5000);
shortNameInput.click().sendKeys(text);
},
+ verifyShortNameInputFieldHasText: function(text) {
+ browser.wait(EC.visibilityOf(shortNameInput), 5000);
+ expect(shortNameInput.getAttribute("value")).toEqual(text);
+ },
enterTextIntoNameInputField: function(text) {
nameInput.click().sendKeys(text);
},
@@ -91,6 +105,14 @@
enterTextIntoInterestInputField: function(text) {
interestInput.click().clear().sendKeys(text);
},
+ verifyInterestInputFieldHasText: function(text) {
+ browser.wait(EC.visibilityOf(interestInput), 5000);
+ expect(interestInput.getAttribute("value")).toEqual(text);
+ },
+ verifyInterestInputFieldIsDisabled: function() {
+ browser.wait(EC.visibilityOf(interestInput), 5000);
+ expect(interestInput.isEnabled()).toBe(false);
+ },
enterTextIntoTermPeriodInputField: function(text) {
termPeriodInput.click().sendKeys(text);
},
@@ -148,29 +170,58 @@
equityLedgerInput.click().sendKeys(text);
},
clickEnabledContinueButtonForProductDetails: function(){
+ browser.executeScript("arguments[0].scrollIntoView();", $$(".mat-raised-button").get(0).getWebElement());
expect($$(".mat-raised-button").get(0).isEnabled()).toBeTruthy();
$$(".mat-raised-button").get(0).click();
},
+ enterTextIntoChargeNameInputField: function(text) {
+ chargeNameInput1.click().sendKeys(text);
+ },
clickButtonAddCharge: function(){
browser.wait(EC.elementToBeClickable($("fims-deposit-product-charges-form button")), 2000);
$("fims-deposit-product-charges-form button").click();
},
- enterTextIntoChargeNameInputField: function(text) {
- chargeNameInput.click().sendKeys(text);
+ clickButtonAddChargeIfThereAlreadyIsACharge: function(){
+ browser.executeScript("arguments[0].scrollIntoView();", $$("fims-deposit-product-charges-form button").get(1).getWebElement());
+ browser.wait(EC.elementToBeClickable($$("fims-deposit-product-charges-form button").get(1)), 2000);
+ $$("fims-deposit-product-charges-form button").get(1).click();
+ },
+ enterTextIntoSecondChargeNameInputField: function(text) {
+ browser.wait(EC.visibilityOf(chargeNameInput2));
+ chargeNameInput2.click().sendKeys(text);
},
enterTextIntoChargeDescriptionInputField: function(text) {
chargeDescriptionInput.click().sendKeys(text);
},
enterTextIntoChargeAmountInputField: function(text) {
- chargeAmountInput.click().clear().sendKeys(text);
+ chargeAmountInput1.click().clear().sendKeys(text);
+ },
+ enterTextIntoSecondChargeAmountInputField: function(text) {
+ browser.executeScript("arguments[0].scrollIntoView();", chargeAmountInput2.getWebElement());
+ chargeAmountInput2.click().clear().sendKeys(text);
},
selectTypeOfCharge: function(text) {
- chargeTypeSelect.click();
+ chargeTypeSelect1.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ element(by.cssContainingText('.mat-option', text)).click();
+ },
+ selectTypeOfSecondCharge: function(text) {
+ chargeTypeSelect2.click();
browser.wait(EC.visibilityOf($(".mat-option")), 5000);
element(by.cssContainingText('.mat-option', text)).click();
},
enterTextIntoIncomeAccountInputField: function(text) {
- incomeAccountInput.click().sendKeys(text);
+ incomeAccountInput1.click().sendKeys(text);
+ },
+ enterTextIntoSecondIncomeAccountInputField: function(text) {
+ browser.executeScript("arguments[0].scrollIntoView();", incomeAccountInput2.getWebElement());
+ incomeAccountInput2.click().sendKeys(text);
+ },
+ selectCheckboxProportional: function(){
+ checkboxProportional1.click();
+ },
+ selectSecondCheckboxProportional: function(){
+ checkboxProportional2.click();
},
clickEnabledContinueButtonForProductDetails: function(){
browser.wait(EC.elementToBeClickable($$(".mat-raised-button").get(0)), 5000);
@@ -186,6 +237,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();
+ },
clickButtonEnableProduct: function(){
browser.wait(EC.elementToBeClickable($("td-message button")), 2000);
$("td-message button").click();
diff --git a/Pages/Teller.js b/Pages/Teller.js
index 874ce12..968d048 100644
--- a/Pages/Teller.js
+++ b/Pages/Teller.js
@@ -95,7 +95,7 @@
a.click();
browser.wait(EC.visibilityOf($("fims-teller-transaction-form")), 2000);
},
- selectAccountToBeOpened: function(accountIdentifier){
+ selectAccountToBeAffected: function(accountIdentifier){
browser.wait(EC.elementToBeClickable(accountSelect), 3000);
accountSelect.click();
browser.wait(EC.visibilityOf($(".mat-option")), 5000);
@@ -104,7 +104,7 @@
},
enterTextIntoAmountInputField: function(text) {
browser.wait(EC.elementToBeClickable(amountInput), 5000);
- amountInput.click().sendKeys(text);
+ amountInput.click().clear().sendKeys(text);
},
clickEnabledCreateTransactionButton: function(){
primaryButton.filter(function(elem, index) {
@@ -113,6 +113,20 @@
});
}).click();
},
+ verifyCreateTransactionButtonIsDisabled: function(){
+ expect(primaryButton.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "CREATE TRANSACTION";
+ });
+ }).isEnabled()).toBe(false);
+ },
+ verifyCreateTransactionButtonIsEnabled: function(){
+ expect(primaryButton.filter(function(elem, index) {
+ return elem.$("span").getText().then(function(text) {
+ return text === "CREATE TRANSACTION";
+ });
+ }).isEnabled()).toBe(true);
+ },
clickEnabledConfirmTransactionButton: function(){
browser.executeScript("arguments[0].scrollIntoView();", primaryButton.get(1).getWebElement());
browser.wait(EC.elementToBeClickable(primaryButton.get(1)), 3000);
@@ -127,6 +141,10 @@
classCB = checkboxChargesInCash.getAttribute("class");
expect(classCB).toMatch("mat-checkbox-checked");
},
+ uncheckChargesPayedInCashCheckbox: function(){
+ this.verifyChargesPayedInCashCheckboxChecked();
+ checkboxChargesInCash.click();
+ },
verifyChargesPayedInCashCheckboxNotChecked: function(){
classCB = checkboxChargesInCash.getAttribute("class");
expect(classCB).not.toMatch("mat-checkbox-checked");
diff --git a/Specs/gate1.js b/Specs/gate1.js
index e34fd87..92db61f 100644
--- a/Specs/gate1.js
+++ b/Specs/gate1.js
@@ -1,18 +1,21 @@
//test round 1 - admin user can execute basic actions (TBD)
//1) User operator creates a new role Administrator with all permissions
//2) User operator creates a new employee with that role
-//3) New employee logs in and creates headoffice
-//4) New employee creates branch office
-//5) New employee creates a teller for the branch office
-//6) New employee opens the teller and assigns it to himself
-//7) New employee creates a customer
-//8) New employee activates the customer
-//9) New employee unlocks the teller, views customer and pauses teller again
-//10) New employee creates a deposit product
-//11) New employee enables deposit product
-//12) New employee assigns deposit product to customer
-//13) New employee opens account in teller and verifies the account is now active
-//14) New employee verifies transaction have been booked as expected (accounting)
+//3) New employee logs in and creates new accounts (asset and revenue)
+//4) New employee creates headoffice
+//5) New employee creates branch office
+//6) New employee creates a teller for the branch office
+//7) New employee opens the teller and assigns it to himself
+//8) New employee creates a customer
+//9) New employee activates the customer
+//10) New employee unlocks the teller, views customer and pauses teller again
+//11) New employee creates a deposit product
+//12) New employee enables deposit product
+//13) New employee assigns deposit product to customer
+//14) New employee opens account in teller and verifies the account is now active
+//15) New employee verifies transaction have been booked as expected (accounting)
+//16) New employee updates deposit product and adds a proportional charge on cash withdrawal
+//17) Teller - Cash is withdrawn from the account
//test 1 and 3 fail if role and headquarter already exist, but other tests should be able to continue
@@ -59,17 +62,18 @@
Common.clickLinkShowForRowWithId("7000");
Common.clickLinkShowForRowWithId("7300");
Accounting.clickCreateNewAccountInLedger("7300");
- //Accounting.verifyAccountTypeAssetSelected();
- //Accounting.verifyRadioGroupAccountTypesDisabled();
Accounting.enterTextIntoAccountIdentifierInputField(tellerAccount);
+ Accounting.verifyRadioAssetToBeSelected();
+ Accounting.verifyRadioAssetToBeDisabled();
Accounting.enterTextIntoAccountNameInputField("My teller");
Accounting.clickEnabledButtonCreateAccount();
Common.verifyMessagePopupIsDisplayed("Account is going to be saved");
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("1000");
- Common.clickLinkShowForRowWithId("1100");
- Accounting.clickCreateNewAccountInLedger("1100");
+ Common.clickLinkShowForRowWithId("1300");
+ Accounting.clickCreateNewAccountInLedger("1300");
Accounting.enterTextIntoAccountIdentifierInputField(revenueAccount);
+ Accounting.verifyRadioRevenueToBeSelected();
Accounting.enterTextIntoAccountNameInputField("Revenue from deposit charges");
Accounting.clickEnabledButtonCreateAccount();
Common.verifyMessagePopupIsDisplayed("Account is going to be saved");
@@ -131,13 +135,12 @@
Customers.enterTextIntoFirstNameInputField("Thomas");
Customers.enterTextIntoLastNameInputField("Pynchon");
Customers.enterTextIntoDayOfBirthInputField("09/21/1978");
- //Customers.verifyMemberCheckboxIsChecked();
+ Customers.verifyIsMemberCheckboxSelected();
Customers.clickEnabledContinueButtonForCustomerDetails();
Customers.enterTextIntoStreetInputField("800 Chatham Road #326");
Customers.enterTextIntoCityInputField("Winston-Salem");
Customers.selectCountryByName("Germany");
Customers.clickEnabledContinueButtonForCustomerAddress();
- //Customers.clickEnabledContinueButtonForCustomerContact();
Customers.clickEnabledCreateCustomerButton();
Common.verifyMessagePopupIsDisplayed("Customer is going to be saved")
Customers.verifyCardHasTitleManageCustomers();
@@ -221,7 +224,6 @@
Customers.selectDepositProduct(depositName);
Customers.clickEnabledButtonCreateDepositAccount();
Common.verifyMessagePopupIsDisplayed("Deposit account is going to be saved");
-
//might not be in list immediately always
Common.clickBackButtonInTitleBar();
Customers.clickManageDepositAccountsForCustomer(customerAccount);
@@ -241,7 +243,7 @@
Teller.verifyCardTitleHasNameOfCustomer("Thomas Pynchon");
Teller.clickOnOpenAccountForCustomer(customerAccount);
Teller.verifyCardTitleIs("Teller transaction");
- Teller.selectAccountToBeOpened(customerAccount + ".9100.00001");
+ Teller.selectAccountToBeAffected(customerAccount + ".9100.00001");
Teller.enterTextIntoAmountInputField("100");
Teller.clickEnabledCreateTransactionButton();
Teller.verifyTransactionAmount("100");
@@ -292,7 +294,7 @@
//revenue account - check charges have been booked as expected
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("1000");
- Common.clickLinkShowForRowWithId("1100");
+ Common.clickLinkShowForRowWithId("1300");
Common.clickLinkShowForRowWithId(revenueAccount);
Accounting.verifyAccountStatus("OPEN");
Accounting.verifyAccountInfo("Balance", "5");
@@ -303,4 +305,37 @@
Accounting.verifyTransactionAmountForRow("5", 1);
Accounting.verifyTransactionBalanceForRow("5", 1);
});
+ it('edit deposit product and add a withdrawal charge', function () {
+ Deposits.goToDepositsViaSidePanel();
+ Common.clickLinkShowForRowWithId(depositIdentifier);
+ Deposits.clickButtonEditDepositProduct(depositIdentifier);
+ Deposits.verifyRadioCheckingIsSelected();
+ Deposits.verifyInterestInputFieldHasText("0.05");
+ Deposits.verifyInterestInputFieldIsDisabled();
+ Deposits.clickEnabledContinueButtonForProductDetails();
+ Deposits.clickButtonAddChargeIfThereAlreadyIsACharge();
+ Deposits.enterTextIntoSecondChargeNameInputField("Cash withdrawal charge");
+ Deposits.enterTextIntoSecondChargeAmountInputField("3");
+ Deposits.selectTypeOfSecondCharge("Cash Withdrawal");
+ Deposits.enterTextIntoSecondIncomeAccountInputField(revenueAccount);
+ Deposits.selectSecondCheckboxProportional();
+ Deposits.clickEnabledUpdateProductButton();
+ Common.verifyMessagePopupIsDisplayed("Product is going to be saved");
+ });
+ it('make a cash withdrawal without paying charge in cash', function () {
+ Teller.goToTellerManagementViaSidePanel();
+ Teller.enterTextIntoSearchInputField(customerAccount);
+ //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.clickOnCashWithdrawalForCustomer(customerAccount);
+ Teller.selectAccountToBeAffected(customerAccount + ".9100.00001");
+ Teller.enterTextIntoAmountInputField("100");
+ Teller.clickEnabledCreateTransactionButton();
+ Teller.verifyTransactionAmount("100");
+ Teller.verifyTransactionCharge("Cash withdrawal charge", "3");
+ Teller.uncheckChargesPayedInCashCheckbox();
+ Teller.clickEnabledConfirmTransactionButton();
+ Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
+ });
});
\ No newline at end of file