Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from kkaczmarczyk/branch
MIFOS-5958: Create acceptance test for adjusting amount with comma on Ne...
- Loading branch information
Showing
7 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...test/java/org/mifos/test/acceptance/framework/loan/ApplyGroupPaymentConfirmationPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2005-2011 Grameen Foundation USA | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
* | ||
* See also http://www.apache.org/licenses/LICENSE-2.0.html for an | ||
* explanation of the license and how it is applied. | ||
*/ | ||
|
||
package org.mifos.test.acceptance.framework.loan; | ||
|
||
import org.mifos.test.acceptance.framework.AbstractPage; | ||
|
||
import com.thoughtworks.selenium.Selenium; | ||
|
||
public class ApplyGroupPaymentConfirmationPage extends AbstractPage { | ||
|
||
public ApplyGroupPaymentConfirmationPage(Selenium selenium) { | ||
super(selenium); | ||
this.verifyPage("ReviewApplyGroupPayment"); | ||
} | ||
|
||
public LoanAccountPage submitAndNavigateToLoanAccountDetailsPage() { | ||
selenium.click("reviewapplypayment.button.submit"); | ||
waitForPageToLoad(); | ||
return new LoanAccountPage(selenium); | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
...ceTests/src/test/java/org/mifos/test/acceptance/framework/loan/ApplyGroupPaymentPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.mifos.test.acceptance.framework.loan; | ||
|
||
import org.mifos.test.acceptance.framework.MifosPage; | ||
|
||
import com.thoughtworks.selenium.Selenium; | ||
|
||
public class ApplyGroupPaymentPage extends MifosPage { | ||
|
||
public ApplyGroupPaymentPage(Selenium selenium) { | ||
super(selenium); | ||
verifyPage("ApplyGroupPayment"); | ||
} | ||
|
||
public ApplyGroupPaymentConfirmationPage submitAndNavigateToApplyGroupPaymentConfirmationPage(PaymentParameters params) | ||
{ | ||
enterPaymentData(params); | ||
return new ApplyGroupPaymentConfirmationPage(selenium); | ||
} | ||
|
||
public void verifyPaymentPriorLastPaymentDate(PaymentParameters params) { | ||
enterPaymentData(params); | ||
selenium.isTextPresent("Date of transaction cannot be less than the last payment date"); | ||
} | ||
|
||
private void enterPaymentData(PaymentParameters params) { | ||
selenium.type("transactionDateDD", params.getTransactionDateDD()); | ||
selenium.type("transactionDateMM", params.getTransactionDateMM()); | ||
selenium.type("transactionDateYY", params.getTransactionDateYYYY()); | ||
selenium.select("applypayment.input.paymentType", "value=" + params.getPaymentTypeValue()); | ||
this.typeTextIfNotEmpty("applypayment.input.receiptId", params.getReceiptId()); | ||
|
||
this.typeTextIfNotEmpty("receiptDateDD", params.getReceiptDateDD()); | ||
this.typeTextIfNotEmpty("receiptDateMM", params.getReceiptDateMM()); | ||
this.typeTextIfNotEmpty("receiptDateYY", params.getReceiptDateYYYY()); | ||
|
||
selenium.type("applypayment.input.amount", params.getAmount()); | ||
waitForPageToLoad(); | ||
selenium.click("applypayment.button.reviewTransaction"); | ||
waitForPageToLoad(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...tanceTests/src/test/java/org/mifos/test/acceptance/loan/ApplyAdjustmentGroupLoanTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package org.mifos.test.acceptance.loan; | ||
|
||
import org.joda.time.DateTime; | ||
import org.junit.Assert; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.mifos.test.acceptance.framework.MifosPage; | ||
import org.mifos.test.acceptance.framework.UiTestCaseBase; | ||
import org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper; | ||
import org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService; | ||
import org.mifos.test.acceptance.framework.loan.CreateLoanAccountConfirmationPage; | ||
import org.mifos.test.acceptance.framework.loan.CreateLoanAccountEntryPage; | ||
import org.mifos.test.acceptance.framework.loan.CreateLoanAccountPreviewPage; | ||
import org.mifos.test.acceptance.framework.loan.CreateLoanAccountReviewInstallmentPage; | ||
import org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters; | ||
import org.mifos.test.acceptance.framework.loan.DisburseLoanParameters; | ||
import org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters; | ||
import org.mifos.test.acceptance.framework.loan.LoanAccountPage; | ||
import org.mifos.test.acceptance.framework.loan.PaymentParameters; | ||
import org.mifos.test.acceptance.framework.testhelpers.CustomPropertiesHelper; | ||
|
||
|
||
@ContextConfiguration(locations = {"classpath:ui-test-context.xml"}) | ||
@Test(singleThreaded = true, enabled = true,groups = {"acceptance", "loan", "no_db_unit"}) | ||
|
||
public class ApplyAdjustmentGroupLoanTest extends UiTestCaseBase { | ||
private LoanTestHelper loanTestHelper; | ||
private CustomPropertiesHelper customPropertiesHelper; | ||
|
||
@Override | ||
@BeforeMethod(alwaysRun=true) | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
loanTestHelper = new LoanTestHelper(selenium); | ||
customPropertiesHelper = new CustomPropertiesHelper(selenium); | ||
customPropertiesHelper.setNewGroupLoanWithMembers(true); | ||
} | ||
@AfterMethod | ||
public void logOut(){ | ||
customPropertiesHelper.setNewGroupLoanWithMembers(false); | ||
(new MifosPage(selenium)).logout(); | ||
} | ||
@SuppressWarnings("PMD.SignatureDeclareThrowsException") | ||
public void adjustmentWithCommaTest() throws Exception{ | ||
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium); | ||
DateTime targetTime = new DateTime(2013, 02, 8, 13, 0, 0, 0); | ||
dateTimeUpdaterRemoteTestingService.setDateTime(targetTime); | ||
|
||
CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters(); | ||
searchParameters.setSearchString("Default Group"); | ||
searchParameters.setLoanProduct("WeeklyGroupFlatLoanWithOnetimeFee"); | ||
CreateLoanAccountEntryPage loanAccountEntryPage = loanTestHelper.navigateToCreateLoanAccountEntryPage(searchParameters); | ||
|
||
loanAccountEntryPage.setDisbursalDate(new DateTime(2013, 2, 8, 15, 0, 0, 0)); | ||
loanAccountEntryPage.selectGLIMClients(0, "Stu1233266299995 Client1233266299995 Client Id: 0002-000000012", "1500", null); | ||
loanAccountEntryPage.selectGLIMClients(2, "Stu1233266319760 Client1233266319760 Client Id: 0002-000000014", "1500", null); | ||
CreateLoanAccountReviewInstallmentPage createLoanAccountReviewInstallmentPage = loanAccountEntryPage.navigateToReviewInstallmentsPage(); | ||
CreateLoanAccountPreviewPage createLoanAccountPreviewPage = createLoanAccountReviewInstallmentPage.clickPreviewAndGoToReviewLoanAccountPage(); | ||
CreateLoanAccountConfirmationPage createLoanAccountConfirmationPage = createLoanAccountPreviewPage.submitForApprovalAndNavigateToConfirmationPage(); | ||
|
||
LoanAccountPage loanAccountPage = createLoanAccountConfirmationPage.navigateToLoanAccountDetailsPage(); | ||
String loanId = loanAccountPage.getAccountId(); | ||
EditLoanAccountStatusParameters statusParameters = new EditLoanAccountStatusParameters(); | ||
statusParameters.setStatus(EditLoanAccountStatusParameters.APPROVED); | ||
statusParameters.setNote("Test new GLIM"); | ||
loanTestHelper.changeLoanAccountStatus(loanId, statusParameters); | ||
|
||
DisburseLoanParameters params = new DisburseLoanParameters(); | ||
params.setPaymentType(DisburseLoanParameters.CASH); | ||
loanTestHelper.disburseLoan(loanId, params); | ||
|
||
PaymentParameters paymentParameters = new PaymentParameters(); | ||
paymentParameters.setAmount("2500.0"); | ||
paymentParameters.setPaymentType(PaymentParameters.CASH); | ||
paymentParameters.setTransactionDateDD("08"); | ||
paymentParameters.setTransactionDateMM("2"); | ||
paymentParameters.setTransactionDateYYYY("2013"); | ||
loanTestHelper.applyGroupPayment(loanId,paymentParameters); | ||
loanAccountPage.navigateToApplyAdjustment().fillAdjustmentFieldsWithoutRevertingAndSubmitGroupLoan("2500.0"); | ||
Assert.assertFalse(selenium.isTextPresent("stack trace")); | ||
Assert.assertTrue(selenium.isTextPresent("2,500")); | ||
|
||
} | ||
} |