This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
/
gate1.js
616 lines (610 loc) · 35 KB
/
gate1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
//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 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 transactions 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
//18) Employee creates a loan product
//19) Employee edits a charge
//20) Employee adds two tasks
//21) Employee enables loan product
//22) Employee assigns the product to a customer
//23) Employee opens, approves and disburses the loan
//24) Employee verifies transactions have been booked as expected
//test 1 and 3 fail if role and headquarter already exist, but other tests should be able to continue
var helper = require('../helper.js');
var Login = require('../Pages/Login.js');
var Employees = require('../Pages/Employees.js');
var Common = require('../Pages/Common.js');
var Offices = require('../Pages/Offices');
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');
describe('Gate 1', function() {
var EC = protractor.ExpectedConditions;
employeeIdentifier = helper.getRandomString(6);
officeIdentifier = helper.getRandomString(6);
tellerIdentifier = helper.getRandomString(4);
customerAccount = helper.getRandomString(5);
depositIdentifier = helper.getRandomString(4);
depositName = helper.getRandomString(8);
chequeReceivablesAccount = helper.getRandomString(4);
cashOverShortAccount = "COS_" + helper.getRandomString(4);
tellerAccount = helper.getRandomString(4);
revenueAccount = helper.getRandomString(4);
loanShortName = helper.getRandomString(6);
taskIdentifier = helper.getRandomString(3);
loanAccountShortName = helper.getRandomString(4);
it('should create a new administrator role', function () {
Common.waitForThePageToFinishLoading();
Roles.clickCreateNewRoleFromQuickAccess();
Roles.enterTextIntoRoleIdentifierInput("Administrator");
Common.verifyCardHasTitle("Create new role");
Roles.selectCheckboxToGiveUserAllPermissions();
Roles.clickEnabledSaveRoleButton();
Common.verifyMessagePopupIsDisplayed("Role is going to be saved");
Common.verifyCardHasTitle("Manage roles");
});
it('should create a new employee with administrator permissions', function () {
Employees.goToManageEmployeesViaSidePanel();
Employees.createEmployee(employeeIdentifier, "Kate", "Atkinson", "Administrator", "abc123!!");
Login.signOut();
Login.logInForFirstTimeWithTenantUserAndPassword("playground", employeeIdentifier, "abc123!!", "abc123??");
});
it('should create new accounts', function () {
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("7000");
Common.clickLinkShowForRowWithId("7200");
Accounting.clickCreateNewAccountInLedger("7200");
Accounting.enterTextIntoAccountIdentifierInputField(chequeReceivablesAccount);
Accounting.verifyRadioAssetToBeSelected();
Accounting.verifyRadioAssetToBeDisabled();
Accounting.enterTextIntoAccountNameInputField("Cheques Receivables");
Accounting.clickButtonCreateAccount();
Common.verifyMessagePopupIsDisplayed("Account is going to be saved");
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("7000");
Common.clickLinkShowForRowWithId("7300");
Accounting.clickCreateNewAccountInLedger("7300");
Accounting.enterTextIntoAccountIdentifierInputField(tellerAccount);
Accounting.verifyRadioAssetToBeSelected();
Accounting.verifyRadioAssetToBeDisabled();
Accounting.enterTextIntoAccountNameInputField("My teller");
Accounting.clickButtonCreateAccount();
Common.verifyMessagePopupIsDisplayed("Account is going to be saved");
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("1000");
Common.clickLinkShowForRowWithId("1300");
Accounting.clickCreateNewAccountInLedger("1300");
Accounting.enterTextIntoAccountIdentifierInputField(revenueAccount);
Accounting.verifyRadioRevenueToBeSelected();
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 headquarter office', function () {
Offices.goToManageOfficesViaSidePanel();
Offices.verifyNoHeadquarterExistingYet();
Offices.clickButtonCreateHeadquarter();
Common.verifyCardHasTitle("Create new office");
Offices.enterTextIntoOfficeIdentifierInputField("hqo1");
Offices.enterTextIntoOfficeNameInputField("Headquarter Office Playground");
Offices.clickEnabledContinueButtonForOfficeDetails();
Offices.clickCreateOfficeButton();
Common.verifyMessagePopupIsDisplayed("Office is going to be saved");
});
it('should create a new branch office', function () {
Offices.clickButtonCreateNewOffice();
Common.verifyCardHasTitle("Create new office");
Offices.enterTextIntoOfficeIdentifierInputField(officeIdentifier);
Offices.enterTextIntoOfficeNameInputField("Branch " + officeIdentifier);
Offices.clickEnabledContinueButtonForOfficeDetails();
Offices.clickCreateOfficeButton();
Common.verifyMessagePopupIsDisplayed("Office is going to be saved");
Common.clickSearchButtonToMakeSearchInputFieldAppear();
Common.enterTextInSearchInputFieldAndApplySearch(officeIdentifier);
Common.verifyFirstRowOfSearchResultHasTextAsId(officeIdentifier);
});
it('should create a new teller for the branch office', function () {
Common.clickLinkShowForFirstRowInTable();
Offices.goToManageTellersForOfficeByIdentifier(officeIdentifier);
Offices.clickCreateTellerForOfficeByIdentifier(officeIdentifier);
Offices.enterTextIntoTellerNumberInputField(tellerIdentifier);
Offices.enterTextIntoPasswordInputField("qazwsx123!!");
Offices.enterTextIntoCashWithdrawalLimitInputField("1000");
Offices.enterTextIntoTellerAccountInputFieldAndSelectMatchingEntry(tellerAccount);
Offices.enterTextIntoVaultAccountInputFieldAndSelectMatchingEntry("7351");
Offices.enterTextIntoChequesReceivableAccountInputFieldAndSelectMatchingEntry(chequeReceivablesAccount);
Offices.enterTextIntoCashOverShortInputFieldAndSelectMatchingEntry(cashOverShortAccount);
Offices.clickCreateTellerButton();
Common.verifyMessagePopupIsDisplayed("Teller is going to be saved");
//workaround for current bug that teller is not always listed immediately
Common.clickBackButtonInTitleBar();
Offices.goToManageTellersForOfficeByIdentifier(officeIdentifier);
Common.clickLinkShowForFirstRowInTable();
});
it('should open the teller and assign it to an employee', function () {
Offices.clickActionOpenForTellerOfOffice(tellerIdentifier, officeIdentifier);
Offices.enterTextIntoAssignedEmployeeInputField(employeeIdentifier);
Offices.selectOptionInListByName("Atkinson, Kate");
Offices.clickEnabledOpenTellerButton();
Common.verifyMessagePopupIsDisplayed("Teller is going to be updated");
Offices.verifyTellerStatusIs("OPEN");
});
it('should be able to create customer', function () {
Customers.goToManageCustomersViaSidePanel();
Common.verifyCardHasTitle("Manage members");
Customers.clickButtonOrLinkCreateNewMember();
Common.verifyCardHasTitle("Create new member");
Customers.enterTextIntoAccountInputField(customerAccount);
Customers.enterTextIntoFirstNameInputField("Thomas");
Customers.enterTextIntoLastNameInputField("Pynchon");
Customers.enterTextIntoDayOfBirthInputField("9211978");
Customers.verifyIsMemberCheckboxSelected();
Customers.clickEnabledContinueButtonForMemberDetails();
Customers.enterTextIntoStreetInputField("800 Chatham Road #326");
Customers.enterTextIntoCityInputField("Winston-Salem");
Customers.selectCountryByName("Germany");
Customers.clickEnabledContinueButtonForMemberAddress();
Customers.clickEnabledCreateMemberButton();
Common.verifyMessagePopupIsDisplayed("Member is going to be saved");
Common.verifyCardHasTitle("Manage members");
Common.clickSearchButtonToMakeSearchInputFieldAppear();
Common.enterTextInSearchInputFieldAndApplySearch(customerAccount);
Common.verifyFirstRowOfSearchResultHasTextAsId(customerAccount);
});
it('should activate the customer', function () {
Common.clickLinkShowForFirstRowInTable();
Customers.verifyMemberHasStatusInactive();
Customers.clickButtonGoToTasks();
Customers.clickButtonActivate();
Common.verifyMessagePopupIsDisplayed("Command is going to be executed");
Customers.verifyMemberHasStatusActive();
});
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();
Common.verifyMessagePopupIsDisplayed("Teller drawer is now locked");
Teller.verifyTellerIsLocked();
});
it('should create a deposit account - Checking with opening charge', function () {
Deposits.goToDepositsViaSidePanel();
Common.verifyCardHasTitle("Manage deposit products");
Deposits.clickButtonCreateDepositAccount();
Common.verifyCardHasTitle("Create new deposit product");
Deposits.enterTextIntoShortNameInputField(depositIdentifier);
Deposits.verifyRadioCheckingIsSelected();
Deposits.enterTextIntoNameInputField(depositName);
Deposits.enterTextIntoMinimumBalanceInputField("100");
Deposits.verifyRadioAnnuallyIsSelected();
Deposits.verifyCheckboxFlexibleInterestNotChecked();
Deposits.enterTextIntoInterestInputField("0.05");
Deposits.verifyFixedTermToggleSetToOff();
Deposits.verifyTermPeriodInputFieldIsDisabled();
Deposits.verifyRadioButtonsMonthAndYearDisabled();
Deposits.toggleFixedTermToOn();
Deposits.verifyTermPeriodInputFieldIsEnabled();
Deposits.verifyRadioButtonsMonthAndYearEnabled();
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("Account opening charge");
Deposits.enterTextIntoIncomeAccountInputField(revenueAccount);
Deposits.enterTextIntoChargeAmountInputField("5");
Deposits.selectTypeOfCharge("Account Opening");
Deposits.clickEnabledCreateProductButton();
Common.verifyMessagePopupIsDisplayed("Product is going to be saved");
Common.verifyCardHasTitle("Manage deposit products");
});
it('should enable deposit product', function () {
Common.clickLinkShowForRowWithId(depositIdentifier);
Deposits.verifyProductHasStatusDisabled();
Deposits.clickButtonEnableProduct();
Common.verifyMessagePopupIsDisplayed("Product is going to be updated");
Deposits.verifyProductHasStatusEnabled();
});
it('should assign deposit product to customer', function () {
Customers.goToManageCustomersViaSidePanel();
Common.clickSearchButtonToMakeSearchInputFieldAppear();
Common.enterTextInSearchInputFieldAndApplySearch(customerAccount);
Common.verifyFirstRowOfSearchResultHasTextAsId(customerAccount);
Common.clickLinkShowForRowWithId(customerAccount);
Customers.clickManageDepositAccountsForMember(customerAccount);
Customers.clickCreateDepositAccountForMember(customerAccount);
Customers.selectProduct(depositName);
Customers.clickEnabledButtonCreateDepositAccount();
Common.verifyMessagePopupIsDisplayed("Deposit account is going to be saved");
//might not be in list immediately always
Common.clickBackButtonInTitleBar();
Customers.clickManageDepositAccountsForMember(customerAccount);
Common.clickLinkShowForRowWithId(depositIdentifier);
Customers.verifyDepositAccountHasStatus("PENDING");
Customers.verifyDepositAccountBalanceIs("0.00");
});
it('should be able to open account', function () {
Teller.goToTellerManagementViaSidePanel();
Teller.enterTextIntoTellerNumberInputField(tellerIdentifier);
Teller.enterTextIntoPasswordInputField("qazwsx123!!");
Teller.clickEnabledUnlockTellerButton();
Common.verifyMessagePopupIsDisplayed("Teller drawer unlocked");
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.clickOnOpenAccountForCustomer(customerAccount);
Common.verifyCardHasTitle("Teller transaction");
Teller.selectAccountToBeAffected(customerAccount + ".9100.00001(" + depositIdentifier +")");
Teller.enterTextIntoAmountInputField("100");
Teller.clickEnabledCreateTransactionButton();
Teller.verifyTransactionAmount("100");
Teller.verifyTransactionCharge("Account opening charge", "5");
Teller.verifyChargesPayedInCashCheckboxChecked();
Teller.clickEnabledConfirmTransactionButton();
Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
//verify account is active and balance is as expected
Customers.goToManageCustomersViaSidePanel();
Common.clickSearchButtonToMakeSearchInputFieldAppear();
Common.enterTextInSearchInputFieldAndApplySearch(customerAccount);
Common.verifyFirstRowOfSearchResultHasTextAsId(customerAccount);
Common.clickLinkShowForRowWithId(customerAccount);
Customers.clickManageDepositAccountsForMember(customerAccount);
//test might be too fast, account still PENDING here and balance 0.00 (but on leaving and coming back, everything as expected)
Customers.verifyStateOfDepositAccountWithId(depositIdentifier, "ACTIVE");
Common.clickLinkShowForRowWithId(depositIdentifier);
Customers.verifyDepositAccountHasStatus("ACTIVE");
Customers.verifyDepositAccountBalanceIs("100.00");
});
it('transaction ACCO should have been booked as expected', function () {
Accounting.goToAccountingViaSidePanel();
//verify balance on customer's account is as expected
Common.clickLinkShowForRowWithId("9000");
Common.clickLinkShowForRowWithId("9100");
Accounting.clickLinkShowForAccountWithName(depositName);
Accounting.verifyAccountStatus("OPEN");
Accounting.verifyAccountInfo("Balance", "100");
Accounting.verifyAccountInfo("Type", "EQUITY");
Accounting.viewAccountEntriesForAccount(customerAccount + ".9100.00001");
Accounting.verifyTransactionTypeForRow("CREDIT", 1);
Accounting.verifyTransactionMessageForRow("ACCO", 1);
Accounting.verifyTransactionAmountForRow("100", 1);
Accounting.verifyTransactionBalanceForRow("100", 1);
//teller account - opening amount + charge have been booked as expected
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("7000");
Common.clickLinkShowForRowWithId("7300");
Common.clickLinkShowForRowWithId(tellerAccount);
Accounting.verifyAccountStatus("OPEN");
Accounting.verifyAccountInfo("Balance", "105");
Accounting.verifyAccountInfo("Type", "ASSET");
Accounting.viewAccountEntriesForAccount(tellerAccount);
Accounting.verifyTransactionTypeForRow("DEBIT", 1);
Accounting.verifyTransactionMessageForRow("ACCO", 1);
Accounting.verifyTransactionAmountForRow("105", 1);
Accounting.verifyTransactionBalanceForRow("105", 1);
//revenue account - check charges have been booked as expected
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("1000");
Common.clickLinkShowForRowWithId("1300");
Common.clickLinkShowForRowWithId(revenueAccount);
Accounting.verifyAccountStatus("OPEN");
Accounting.verifyAccountInfo("Balance", "5");
Accounting.verifyAccountInfo("Type", "REVENUE");
Accounting.viewAccountEntriesForAccount(revenueAccount);
Accounting.verifyTransactionTypeForRow("CREDIT", 1);
Accounting.verifyTransactionMessageForRow("ACCO", 1);
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.selectSecondCheckboxProportional();
Deposits.enterTextIntoSecondIncomeAccountInputField(revenueAccount);
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("50");
Teller.clickEnabledCreateTransactionButton();
Teller.verifyTransactionAmount("50");
Teller.verifyTransactionCharge("Cash withdrawal charge", "1.5");
Teller.uncheckChargesPayedInCashCheckbox();
Teller.clickEnabledConfirmTransactionButton();
Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
});
it('transaction CWDL should have been booked as expected', function () {
Accounting.goToAccountingViaSidePanel();
//verify balance on customer's account is as expected
Common.clickLinkShowForRowWithId("9000");
Common.clickLinkShowForRowWithId("9100");
Accounting.clickLinkShowForAccountWithName(depositName);
Accounting.verifyAccountInfo("Balance", "48.5");
Accounting.viewAccountEntriesForAccount(customerAccount + ".9100.00001");
Accounting.verifyTransactionTypeForRow("DEBIT", 2);
Accounting.verifyTransactionMessageForRow("CWDL", 2);
Accounting.verifyTransactionAmountForRow("1.5", 2);
Accounting.verifyTransactionBalanceForRow("98.5", 2);
Accounting.verifyTransactionTypeForRow("DEBIT", 3);
Accounting.verifyTransactionMessageForRow("CWDL", 3);
Accounting.verifyTransactionAmountForRow("50", 3);
Accounting.verifyTransactionBalanceForRow("48.5", 3);
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("7000");
Common.clickLinkShowForRowWithId("7300");
Common.clickLinkShowForRowWithId(tellerAccount);
Accounting.verifyAccountInfo("Balance", "55");
Accounting.viewAccountEntriesForAccount(tellerAccount);
Accounting.verifyTransactionTypeForRow("CREDIT", 2);
Accounting.verifyTransactionMessageForRow("CWDL", 2);
Accounting.verifyTransactionAmountForRow("50", 2);
Accounting.verifyTransactionBalanceForRow("55", 2);
//revenue account - check charges have been booked as expected
Accounting.goToAccountingViaSidePanel();
Common.clickLinkShowForRowWithId("1000");
Common.clickLinkShowForRowWithId("1300");
Common.clickLinkShowForRowWithId(revenueAccount);
Accounting.verifyAccountInfo("Balance", "6.5");
Accounting.viewAccountEntriesForAccount(revenueAccount);
Accounting.verifyTransactionTypeForRow("CREDIT", 2);
Accounting.verifyTransactionMessageForRow("CWDL", 2);
Accounting.verifyTransactionAmountForRow("1.5", 2);
Accounting.verifyTransactionBalanceForRow("6.5", 2);
});
it('create a loan product', function () {
Loans.goToLoanProductsViaSidePanel();
Loans.clickButtonCreateLoanProduct();
Loans.enterTextIntoShortNameInputField(loanShortName);
Loans.enterTextIntoNameInputField("My loan " + loanShortName);
Loans.enterTextIntoDescriptionInputField("My loan " + loanShortName);
Loans.enterTextIntoMinimumPrincipalInputField("1000");
Loans.enterTextIntoMaximumPrincipalInputField("10000");
Loans.enterTextIntoTermInputField("12");
Loans.clickEnabledContinueButtonForProductDetails();
Loans.enterTextIntoCashAccountInputField(tellerAccount);
Loans.enterTextIntoCustomerLoanLedgerInputField("7900");
Loans.clickEnabledContinueButtonForLedgerAndAccountSettings();
Loans.enterTextIntoInterestRateInputField("3.50");
Loans.enterTextIntoIncomeAccountAccountInputField(revenueAccount);
Loans.enterTextIntoAccrualAccountInputField("7015");
Loans.clickEnabledContinueButtonForInterestSettings();
Loans.enterTextIntoProcessingFeeIncomeAccountInputField("1312");
Loans.enterTextIntoOriginatingFeeIncomeAccountInputField("1310");
Loans.enterTextIntoDisbursementFeeIncomeAccountInputField("1313");
Loans.enterTextIntoLateFeeIncomeAccountInputField("1311");
Loans.enterTextIntoLateFeeAccrualAccountInputField("7840");
Loans.clickEnabledContinueButtonForFeeIncomeAccounts("");
Loans.enterTextIntoArrearsAllowanceAccountInputField("3040");
Loans.clickEnabledCreateProductButton();
Common.verifyMessagePopupIsDisplayed("Product is going to be saved");
});
it('should edit charges', function (){
Common.clickLinkShowForRowWithId(loanShortName);
Loans.clickLinkManageFeesForLoanProduct(loanShortName);
Common.clickLinkShowForRowWithId("processing-fee");
Loans.clickButtonEditProcessingFeeForLoanProduct(loanShortName);
Loans.enterTextIntoFeeAmountInputField("3");
Loans.clickEnabledUpdateChargeButton();
Common.verifyMessagePopupIsDisplayed("Fee is going to be saved");
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
});
it('should add task', function () {
Loans.clickLinkManageTasksForLoanProduct(loanShortName);
Loans.clickButtonCreateTaskForLoanProduct(loanShortName);
Loans.enterTextIntoTaskIdentifierInputField(taskIdentifier);
Loans.enterTextIntoTaskNameInputField("Loan opening task");
Loans.enterTextIntoTaskDescriptionInputField("Loan opening task - mandatory");
Loans.checkMandatoryCheckbox();
Loans.clickButtonAddAction();
Loans.selectSecondAction("can be approved");
Loans.clickEnabledCreateTaskButton();
Common.verifyMessagePopupIsDisplayed("Task is going to be created");
Common.clickBackButtonInTitleBar();
});
it('should enable the loan product', function () {
Loans.clickButtonEnableProduct();
Common.verifyMessagePopupIsDisplayed("Product is going to be enabled");
});
it('should assign loan product to customer', function () {
Customers.goToManageCustomersViaSidePanel();
Common.clickSearchButtonToMakeSearchInputFieldAppear();
Common.enterTextInSearchInputFieldAndApplySearch(customerAccount);
Common.verifyFirstRowOfSearchResultHasTextAsId(customerAccount);
Common.clickLinkShowForRowWithId(customerAccount);
Customers.clickManageLoanAccountsForMember(customerAccount);
Customers.clickCreateLoanAccountForMember(customerAccount);
Customers.selectProduct("My loan " + loanShortName);
Customers.enterTextIntoShortNameInputField(loanAccountShortName);
CustomerLoans.enterTextIntoPrincipalAmountInputField("5000");
CustomerLoans.enterTextIntoTermInputField("12");
//verify correct radio button selected; BUG
CustomerLoans.selectDayForMonthlyRepayment("3.");
CustomerLoans.selectDepositAccount(customerAccount + ".9100.00001(" + depositIdentifier + ")");
CustomerLoans.clickEnabledCreateMemberLoanButton();
Common.verifyMessagePopupIsDisplayed("Case is going to be saved");
Customers.verifyStateOfLoanAccountWithIdIs(loanAccountShortName, "CREATED");
});
it('should be able to open loan - mandatory task', function () {
Common.clickLinkShowForRowWithId(loanAccountShortName);
CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
Customers.selectExecuteTaskCheckbox();
Common.verifyMessagePopupIsDisplayed("Task executed successfully");
Customers.clickButtonForTask("OPEN");
//verify correct principal amount
Customers.clickButtonForTransaction("OPEN");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
});
it('should be able to approve loan - mandatory task already executed', function () {
CustomerLoans.goToTasksForCustomerLoan(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");
CustomerLoans.verifyLoanHasStatus("APPROVED");
});
it('should be able to disburse loan - no task', function () {
//currently error if this is done too quickly; workaround
browser.sleep("10000");
CustomerLoans.goToTasksForCustomerLoan(customerAccount, loanShortName, loanAccountShortName);
Customers.clickButtonForTask("DISBURSE");
Customers.verifyTransactionCharge("Processing fee", "150.00");
Customers.verifyTransactionCharge("Loan origination fee", "50.00");
Customers.verifyTransactionCharge("Disbursement fee", "05.00");
Customers.clickButtonForTransaction("DISBURSE");
Common.verifyMessagePopupIsDisplayed("Case is going to be updated");
CustomerLoans.verifyLoanHasStatus("ACTIVE");
});
it('bookings should be as expected (open/approve/disburse loan)', function () {
//verify fees have been booked as expected
Accounting.goToAccountingViaSidePanel();
Accounting.clickLinkShowForAccountWithIdentifier("1000");
Accounting.clickLinkShowForAccountWithIdentifier("1300");
Accounting.clickLinkShowForAccountWithIdentifier("1312");
Accounting.viewAccountEntriesForAccount("1312");
Common.clickFirstColumnHeaderInTableToResortTable();
Accounting.verifyTransactionTypeForRow("CREDIT", 1);
Accounting.verifyTransactionAmountForRow("150", 1);
//Accounting.verifyTransactionBalanceForRow("150", 1);
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
Accounting.clickLinkShowForAccountWithIdentifier("1310");
Accounting.viewAccountEntriesForAccount("1310");
Common.clickFirstColumnHeaderInTableToResortTable();
Accounting.verifyTransactionTypeForRow("CREDIT", 1);
Accounting.verifyTransactionAmountForRow("50", 1);
//Accounting.verifyTransactionBalanceForRow("50", 1);
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
Accounting.clickLinkShowForAccountWithIdentifier("1313");
Accounting.viewAccountEntriesForAccount("1313");
Common.clickFirstColumnHeaderInTableToResortTable();
Accounting.verifyTransactionTypeForRow("CREDIT", 1);
Accounting.verifyTransactionAmountForRow("5", 1);
//Accounting.verifyTransactionBalanceForRow("5", 1);
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
//verify principal has been transferred to customer's deposit account
Accounting.clickLinkShowForAccountWithIdentifier("9000");
Accounting.clickLinkShowForAccountWithIdentifier("9100");
Accounting.clickLinkShowForAccountWithName(depositName);
Accounting.verifyAccountInfo("Balance", "4843.5");
Accounting.viewAccountEntriesForAccount(customerAccount + ".9100.00001");
Accounting.verifyTransactionTypeForRow("CREDIT",4);
Accounting.verifyTransactionAmountForRow("5000", 4);
Accounting.verifyTransactionBalanceForRow("5048.5", 4);
Accounting.goToAccountingViaSidePanel();
Accounting.clickLinkShowForAccountWithIdentifier("7000");
Accounting.clickLinkShowForAccountWithIdentifier("7900");
Accounting.goToSubledgersForAccount("7900");
Accounting.clickLinkShowForAccountWithIdentifier(customerAccount + ".cll.00001");
Accounting.clickLinkShowForAccountWithIdentifier(customerAccount + ".clp.00001");
//principal
Accounting.viewAccountEntriesForAccount(customerAccount + ".clp.00001");
Accounting.verifyTransactionTypeForRow("DEBIT", 1);
Accounting.verifyTransactionMessageForRow(loanShortName + "." + loanAccountShortName + ".DISBURSE", 1);
Accounting.verifyTransactionAmountForRow("5000", 1);
Accounting.verifyTransactionBalanceForRow("5000", 1);
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
Accounting.clickLinkShowForAccountWithIdentifier(customerAccount + ".clf.00002");
//fees
Accounting.viewAccountEntriesForAccount(customerAccount + ".clf.00002");
Accounting.verifyTransactionTypeForRow("DEBIT", 1);
Accounting.verifyTransactionMessageForRow(loanShortName + "." + loanAccountShortName + ".DISBURSE", 1);
Accounting.verifyTransactionAmountForRow("205", 1);
Accounting.verifyTransactionBalanceForRow("205", 1);
Common.clickBackButtonInTitleBar();
Common.clickBackButtonInTitleBar();
Accounting.clickLinkShowForAccountWithIdentifier(customerAccount + ".cli.00003");
Accounting.verifyAccountInfo("Balance", "0");
});
expPayment = "";
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 + ")");
//expected payment amount will be similar but not always the same
Teller.getExpectedPaymentAmount().then(function(expPaym){
expPayment = expPaym;
Teller.enterTextIntoAmountInputField(expPayment);
Teller.clickEnabledCreateTransactionButton();
Teller.verifyTransactionAmount(expPayment);
});
Teller.verifyTransactionCharge("repay-fees", "205");
Teller.clickEnabledConfirmTransactionButton();
Common.verifyMessagePopupIsDisplayed("Transaction successfully confirmed");
});
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: " + expPayment);
Accounting.verifyAccountHasBeenDebitedWithAmountInRow(tellerAccount, expPayment, 1);
//not reliable which one comes first
Accounting.verifyAccountHasBeenCreditedWithAmountInRow(customerAccount + ".clp.00001", String(expPayment - 205), 2);
Accounting.verifyAccountHasBeenCreditedWithAmountInRow(customerAccount + ".clf.00002", "205.00", 3);
});
});