Protractor tests.
diff --git a/Pages/Common.js b/Pages/Common.js
index b547045..f006317 100644
--- a/Pages/Common.js
+++ b/Pages/Common.js
@@ -28,15 +28,14 @@
browser.wait(EC.visibilityOf($$(".mat-toolbar .mat-toolbar-row .mat-icon-button").get(2)), 5000);
$$(".mat-toolbar .mat-toolbar-row .mat-icon-button").get(2).click();
},
- clickLinkShowForRowWithId: function(identifier){
+ clickLinkShowForRowWithId: function(identifier) {
+ browser.wait(EC.visibilityOf($("tbody tr")), 5000);
//if > page of entries, need to implement way to page in order to find correct row
- var firstCellPerRow = $$("tr td.td-data-table-cell");
- for (var x = 0; x < firstCellPerRow.size; x++){
- idRow = firstCellPerRow.get(x).getText();
- if (idRow.equals(identifier)){
- firstCellPerRow.get(x).parent().$(".td-data-table-cell button").click();
- break;
- };
- };
- }
+ $$('tbody tr').filter(function(elem, index) {
+ console.log(index);
+ return elem.$(".td-data-table-cell").getText().then(function(text) {
+ return text === identifier;
+ });
+ }).$$(".td-data-table-cell").last().click();
+ },
};
\ No newline at end of file
diff --git a/Pages/Customers.js b/Pages/Customers.js
index e666e32..00c8e4e 100644
--- a/Pages/Customers.js
+++ b/Pages/Customers.js
@@ -17,12 +17,12 @@
var mobileInput = $(".mat-input-infix input[formcontrolname='mobile']");
var linkCustomers = $$("a[href='/customers']");
var titleRow = $("fims-layout-card-over .mat-toolbar-row div");
+var depositProductSelect = $("md-select[formcontrolname='productIdentifier']");
+var beneficiaryInput = $("td-chips[formcontrolname='beneficiaries'] input");
module.exports = {
verifyCardHasTitleManageCustomers: function() {
- browser.wait(EC.not(EC.presenceOf($('.td-loading'))), 10000);
- browser.wait(EC.visibilityOf(titleRow), 5000);
- expect(titleRow.getText()).toEqual("Manage customers");
+ browser.wait(EC.textToBePresentInElement(titleRow, 'Manage customers'), 5000);
},
verifyCardHasTitleCreateCustomer: function() {
form_title=$("fims-layout-card-over .mat-toolbar-row div").getText();
@@ -73,12 +73,14 @@
$$(".mat-raised-button").get(1).click();
},
clickEnabledContinueButtonForCustomerContact: function(){
+
browser.wait(EC.elementToBeClickable($$(".mat-raised-button").get(2)), 5000);
expect($$(".mat-raised-button").get(2).isEnabled()).toBeTruthy();
$$(".mat-raised-button").get(2).click();
},
clickEnabledCreateCustomerButton: function(){
- browser.wait(EC.visibilityOf($(".mat-raised-button.mat-primary")), 5000);
+ browser.executeScript("arguments[0].scrollIntoView();", $(".mat-raised-button.mat-primary").getWebElement());
+ browser.wait(EC.elementToBeClickable($(".mat-raised-button.mat-primary")), 5000);
expect($(".mat-raised-button.mat-primary").isEnabled()).toBeTruthy();
$(".mat-raised-button.mat-primary").click();
},
@@ -101,5 +103,45 @@
clickViewCustomersFromQuickAccess: function() {
browser.wait(EC.visibilityOf(linkCustomers.get(1)), 5000);
linkCustomer.get(1).click();
+ },
+ verifyCustomerHasStatusInactive: function(){
+ browser.wait(EC.visibilityOf($("td-message")), 2000);
+ color = $("td-message").getAttribute("color");
+ message = $("td-message .td-message-label").getText();
+ expect(color).toEqual("warn");
+ expect(message).toContain("Customer not active");
+ },
+ clickButtonGoToTasks: function(){
+ browser.wait(EC.elementToBeClickable($("td-message button")), 2000);
+ $("td-message button").click();
+ },
+ clickButtonActivate: function(){
+ browser.wait(EC.elementToBeClickable($(".mat-raised-button.mat-accent")), 2000);
+ $(".mat-raised-button.mat-accent").click();
+ },
+ verifyCustomerHasStatusActive: function(){
+ browser.wait(EC.visibilityOf($("fims-state-display")), 2000);
+ status = $("fims-state-display .mat-list-text .mat-line").getText();
+ expect(status).toEqual("ACTIVE");
+ },
+ clickManageDepositAccountsForCustomer: function(customer){
+ link = "/customers/details/" + customer + "/deposits";
+ browser.wait(EC.elementToBeClickable($("a[href=link]")));
+ $("a[href=link]").click();
+ },
+ clickCreateDepositAccountForCustomer: function(customer){
+ link = "/customers/details/" + customer + "/deposits/create";
+ browser.wait(EC.elementToBeClickable($("a[href=link]")));
+ $("a[href=link]").click();
+ },
+ selectDepositProduct: function(depositProductName){
+ depositProductSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ element(by.cssContainingText('.mat-option', text)).click();
+ },
+ clickEnabledButtonCreateDepositAccount: function(){
+ browser.wait(EC.elementToBeClickable($(".mat-raised-button.mat-primary")), 5000);
+ expect($(".mat-raised-button.mat-primary").isEnabled()).toBeTruthy();
+ $(".mat-raised-button.mat-primary").click();
}
};
\ No newline at end of file
diff --git a/Pages/Deposits.js b/Pages/Deposits.js
index e692b13..35281de 100644
--- a/Pages/Deposits.js
+++ b/Pages/Deposits.js
@@ -24,24 +24,27 @@
var termPeriodInput = $(".mat-input-infix input[formcontrolname='termPeriod']");
var fixedTermEnabledToggle = $("md-slide-toggle[formcontrolname='fixedTermEnabled']");
var termTimeUnit = $("md-radio-group[formcontrolname='termTimeUnit']");
-var radioMonth = termTimeUnit.$$("md-radio-button input").get(0);
-var radioYear = termTimeUnit.$$("md-radio-button input").get(1);
-
+var radioMonth = termTimeUnit.$$("md-radio-button").get(0);
+var radioYear = termTimeUnit.$$("md-radio-button").get(1);
var cashAccountInput = $("fims-account-select[formcontrolname='cashAccountIdentifier'] input");
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 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']");
module.exports = {
goToDepositsViaSidePanel: function() {
$("a[href='/deposits']").click();
},
verifyCardHasTitle: function(text) {
- browser.wait(EC.visibilityOf(titleRow), 5000);
- form_title = titleRow.getText();
- expect(form_title).toEqual(text);
+ browser.wait(EC.textToBePresentInElement(titleRow, text), 5000);
},
clickButtonCreateDepositAccount: function(){
browser.wait(EC.visibilityOf(createDeposit), 5000);
@@ -116,14 +119,23 @@
expect(termPeriodInput.isEnabled()).toBe(true);
},
verifyRadioButtonsMonthAndYearDisabled: function() {
- expect(radioMonth.isEnabled()).toBe(false);
- expect(radioYear.isEnabled()).toBe(false);
+ expect(termTimeUnit.$$("md-radio-button input").get(0).isEnabled()).toBe(false);
+ expect(termTimeUnit.$$("md-radio-button input").get(1).isEnabled()).toBe(false);
},
verifyRadioButtonsMonthAndYearEnabled: function() {
- expect(radioMonth.isEnabled()).toBe(true);
- expect(radioYear.isEnabled()).toBe(true);
+ expect(termTimeUnit.$$("md-radio-button input").get(0).isEnabled()).toBe(true);
+ expect(termTimeUnit.$$("md-radio-button input").get(1).isEnabled()).toBe(true);
+ },
+ selectRadioButtonMonth: function(){
+ browser.executeScript("arguments[0].scrollIntoView();", radioMonth.getWebElement());
+ radioMonth.click();
+ },
+ selectRadioButtonYear: function(){
+ browser.executeScript("arguments[0].scrollIntoView();", radioYear.getWebElement());
+ radioYear.click();
},
enterTextIntoCashAccountInputField: function(text) {
+ browser.executeScript("arguments[0].scrollIntoView();", cashAccountInput.getWebElement());
cashAccountInput.click().sendKeys(text);
},
enterTextIntoExpenseAccountInputField: function(text) {
@@ -138,5 +150,53 @@
clickEnabledContinueButtonForProductDetails: function(){
expect($$(".mat-raised-button").get(0).isEnabled()).toBeTruthy();
$$(".mat-raised-button").get(0).click();
+ },
+ 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);
+ },
+ enterTextIntoChargeDescriptionInputField: function(text) {
+ chargeDescriptionInput.click().sendKeys(text);
+ },
+ enterTextIntoChargeAmountInputField: function(text) {
+ chargeAmountInput.click().clear().sendKeys(text);
+ },
+ selectTypeOfCharge: function(text) {
+ chargeTypeSelect.click();
+ browser.wait(EC.visibilityOf($(".mat-option")), 5000);
+ element(by.cssContainingText('.mat-option', text)).click();
+ },
+ enterTextIntoIncomeAccountInputField: function(text) {
+ incomeAccountInput.click().sendKeys(text);
+ },
+ clickEnabledContinueButtonForProductDetails: function(){
+ browser.wait(EC.elementToBeClickable($$(".mat-raised-button").get(0)), 5000);
+ expect($$(".mat-raised-button").get(0).isEnabled()).toBeTruthy();
+ $$(".mat-raised-button").get(0).click();
+ },
+ clickEnabledCreateProductButton: function(){
+ browser.executeScript("arguments[0].scrollIntoView();", $(".mat-raised-button.mat-primary").getWebElement());
+ browser.wait(EC.elementToBeClickable($(".mat-raised-button.mat-primary")), 5000);
+ browser.wait($(".mat-raised-button.mat-primary").isEnabled(), 2000);
+ $(".mat-raised-button.mat-primary").click();
+ },
+ clickButtonEnableProduct: function(){
+ browser.wait(EC.elementToBeClickable($("td-message button")), 2000);
+ $("td-message button").click();
+ },
+ verifyProductHasStatusDisabled: function(){
+ browser.wait(EC.visibilityOf($("td-message")), 2000);
+ color = $("td-message").getAttribute("color");
+ message = $("td-message .td-message-label").getText();
+ expect(color).toEqual("warn");
+ expect(message).toContain("Product not enabled");
+ },
+ verifyProductHasStatusEnabled: function(){
+ browser.wait(EC.textToBePresentInElement($("td-message .td-message-label"), "Product enabled"), 2000);
+ color = $("td-message").getAttribute("color");
+ expect(color).toEqual("accent");
}
};
\ No newline at end of file
diff --git a/Pages/Login.js b/Pages/Login.js
index 3536833..ea5786c 100644
--- a/Pages/Login.js
+++ b/Pages/Login.js
@@ -8,7 +8,6 @@
var inputTenant = $(".mat-input-element[formcontrolname='tenant']");
var inputUsername = $(".mat-input-element[formcontrolname='username']");
var inputPassword = $(".mat-input-element[formcontrolname='password']");
-var inputCurrentPassword = $(".mat-input-element[formcontrolname='currentPassword']");
var inputNewPassword = $(".mat-input-element[formcontrolname='newPassword']");
var inputConfirmNewPassword = $(".mat-input-element[formcontrolname='confirmNewPassword']");
var userAccountButton =$$("md-toolbar-row .mat-icon-button").get(1);
@@ -17,7 +16,6 @@
module.exports = {
enterTextInInputFieldForTenant: function(text){
-
browser.wait(EC.visibilityOf(inputTenant), 5000);
inputTenant.click().sendKeys(text);
},
@@ -52,11 +50,8 @@
browser.wait(EC.visibilityOf($(".mat-card .mat-card-title")));
expect($(".mat-card .mat-card-title").getText()).toEqual("Change password");
},
- enterTextInInputFieldForCurrentPassword: function(text){
- browser.wait(EC.visibilityOf(inputCurrentPassword));
- inputCurrentPassword.click().sendKeys(text);
- },
enterTextInInputFieldForNewPassword: function(text){
+ browser.wait(EC.visibilityOf(inputNewPassword), 5000);
inputNewPassword.click().sendKeys(text);
},
enterTextInInputFieldForConfirmNewPassword: function(text){
@@ -70,9 +65,6 @@
clearInputFieldForNewPassword: function(){
inputNewPassword.clear();
},
- clearInputFieldForCurrentPassword: function(){
- inputCurrentPassword.clear();
- },
clearInputFieldForConfirmNewPassword: function(){
inputConfirmNewPassword.clear();
},
@@ -117,7 +109,6 @@
this.enterTextInInputFieldForUsername(user);
this.enterTextInInputFieldForPassword(initialPassword);
this.clickEnabledSignInOrChangePasswordButton();
- this.enterTextInInputFieldForCurrentPassword(initialPassword);
this.enterTextInInputFieldForNewPassword(newPassword);
this.enterTextInInputFieldForConfirmNewPassword(newPassword);
this.clickEnabledSignInOrChangePasswordButton();
diff --git a/Pages/Teller.js b/Pages/Teller.js
index a8b6646..9faf369 100644
--- a/Pages/Teller.js
+++ b/Pages/Teller.js
@@ -37,5 +37,8 @@
},
pauseTeller: function(){
$("a[title='Pause']").click();
+ },
+ verifyTellerIsLocked: function(){
+ browser.wait(EC.visibilityOf(tellerNumberInput), 3000);
}
};
\ No newline at end of file
diff --git a/Specs/gate1.js b/Specs/gate1.js
index 0b246d1..7186ac3 100644
--- a/Specs/gate1.js
+++ b/Specs/gate1.js
@@ -6,8 +6,13 @@
//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 unlocks the teller, views customer and pauses teller again
-//9) New employee creates a deposit product
+//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
+
//test 1 and 3 fail if role and headquarter already exist, but other tests should be able to continue
var helper = require('../helper.js');
@@ -27,6 +32,7 @@
tellerIdentifier = helper.getRandomString(4);
customerAccount = helper.getRandomString(5);
depositIdentifier = helper.getRandomString(4);
+ depositName = helper.getRandomString("8");
it('should create a new administrator role', function () {
Common.waitForThePageToFinishLoading();
@@ -35,10 +41,6 @@
Roles.verifyCardHasTitleCreateRole();
Roles.selectCheckboxToGiveUserAllPermissions();
Roles.clickEnabledSaveRoleButton();
-
- //to work around current bug that side panel is hidden initially
- $(".mat-toolbar-row .mat-icon-button").click();
-
Roles.verifyCardHasTitleManageRoles();
});
it('should create a new employee with administrator permissions', function () {
@@ -82,7 +84,6 @@
//workaround for current bug that teller is not always listed immediately
Common.clickBackButtonInTitleBar();
-
Offices.goToManageTellersForOfficeByIdentifier(officeIdentifier);
//Offices.verifyTellerStatusIs("CLOSED");
Common.clickLinkShowForFirstRowInTable();
@@ -95,10 +96,6 @@
Offices.verifyTellerStatusIs("OPEN");
});
it('should be able to create customer', function () {
-
- //to work around current bug that side panel is hidden initially
- $(".mat-toolbar-row .mat-icon-button").click();
-
Customers.goToManageCustomersViaSidePanel();
Customers.verifyCardHasTitleManageCustomers();
Customers.clickButtonOrLinkCreateNewCustomer();
@@ -120,38 +117,73 @@
Common.enterTextInSearchInputFieldAndApplySearch(customerAccount);
Common.verifyFirstRowOfSearchResultHasTextAsId(customerAccount);
});
-
+ it('should activate the customer', function () {
+ Common.clickLinkShowForFirstRowInTable();
+ Customers.verifyCustomerHasStatusInactive();
+ Customers.clickButtonGoToTasks();
+ Customers.clickButtonActivate();
+ Customers.verifyCustomerHasStatusActive();
+ });
it('assigned employee should be able to unlock teller and view customer', function () {
Teller.goToTellerManagementViaSidePanel();
Teller.enterTextIntoTellerNumberInputField(tellerIdentifier);
Teller.enterTextIntoPasswordInputField("qazwsx123!!");
Teller.clickEnabledUnlockTellerButton();
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");
//verify only appropriate actions are displayed for pending customer without any accounts (work in progress)
Common.clickBackButtonInTitleBar();
Teller.pauseTeller();
+ Teller.verifyTellerIsLocked();
});
- it('should create a deposit account - Checking', function () {
+ it('should create a deposit account - Checking with charges', function () {
Deposits.goToDepositsViaSidePanel();
Deposits.verifyCardHasTitle("Manage deposit products");
Deposits.clickButtonCreateDepositAccount();
Deposits.verifyCardHasTitle("Create new deposit product");
Deposits.enterTextIntoShortNameInputField(depositIdentifier);
Deposits.verifyRadioCheckingIsSelected();
- Deposits.enterTextIntoNameInputField("My first deposit product");
+ Deposits.enterTextIntoNameInputField(depositName);
Deposits.enterTextIntoMinimumBalanceInputField("100");
Deposits.verifyRadioAnnuallyIsSelected();
Deposits.verifyCheckboxFlexibleInterestNotChecked();
- Deposits.enterTextIntoInterestInputField('0.05');
+ Deposits.enterTextIntoInterestInputField("0.05");
Deposits.verifyFixedTermToggleSetToOff();
Deposits.verifyTermPeriodInputFieldIsDisabled();
Deposits.verifyRadioButtonsMonthAndYearDisabled();
Deposits.toggleFixedTermToOn();
Deposits.verifyTermPeriodInputFieldIsEnabled();
Deposits.verifyRadioButtonsMonthAndYearEnabled();
- Deposits.toggleFixedTermToOff();
-
+ Deposits.selectRadioButtonYear();
+ Deposits.enterTextIntoCashAccountInputField("7352");
+ Deposits.enterTextIntoExpenseAccountInputField("2820");
+ Deposits.enterTextIntoAccrueAccountInputField("8202");
+ Deposits.enterTextIntoEquityLedgerInputField("9100");
+ Deposits.enterTextIntoTermPeriodInputField("5");
+ Deposits.selectRadioButtonYear();
+ Deposits.clickEnabledContinueButtonForProductDetails();
+ Deposits.clickButtonAddCharge();
+ Deposits.enterTextIntoChargeNameInputField("onOpening");
+ Deposits.enterTextIntoIncomeAccountInputField("1104");
+ Deposits.enterTextIntoChargeAmountInputField("5");
+ Deposits.selectTypeOfCharge("Account Opening");
+ Deposits.clickEnabledCreateProductButton();
+ Deposits.verifyCardHasTitle("Manage deposit products");
+ });
+ it('should enable deposit product', function () {
+ Common.clickLinkShowForRowWithId(depositIdentifier);
+ Deposits.verifyProductHasStatusDisabled();
+ Deposits.clickButtonEnableProduct();
+ Deposits.verifyProductHasStatusEnabled();
+ });
+ it('should assign deposit product to customer', function () {
+ Customers.goToManageCustomersViaSidePanel();
+ Common.clickLinkShowForRowWithId(customerIdentifier);
+ Customers.clickManageDepositAccountsForCustomer(customerIdentifier);
+ Customers.clickCreateDepositAccountForCustomer(customerIdentifier);
+ Customers.selectDepositProduct(depositName);
+ Customers.clickEnabledButtonCreateDepositAccount();
});
});
\ No newline at end of file