Search in sources :

Example 1 with ViewRolesPage

use of org.mifos.test.acceptance.framework.admin.ViewRolesPage in project head by mifos.

the class MpesaImportTest method importTransactionsFromFileWithNoErrors.

/**
     * MPESA - Import transactions from file with no errors
     * http://mifosforge.jira.com/browse/MIFOSTEST-688
     * @throws Exception
     */
@SuppressWarnings({ "PMD.SignatureDeclareThrowsException", "PMD.SystemPrintln" })
@Test(enabled = true)
public void importTransactionsFromFileWithNoErrors() throws Exception {
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 01, 28, 12, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    ViewRolesPage viewRolesPage = adminPage.navigateToViewRolesPage();
    ManageRolePage manageRolePage = viewRolesPage.navigateToManageRolePage("Admin");
    manageRolePage.disablePermission("8_3");
    viewRolesPage = manageRolePage.submitAndGotoViewRolesPage();
    adminPage = viewRolesPage.navigateToAdminPage();
    adminPage = adminPage.failNavigationToImportTransactionsPage();
    adminPage.verifyError("You do not have permissions to perform " + "this activity. Contact your system administrator " + "to grant you the required permissions and try again.");
    viewRolesPage = adminPage.navigateToViewRolesPage();
    manageRolePage = viewRolesPage.navigateToManageRolePage("Admin");
    manageRolePage.enablePermission("8_3");
    viewRolesPage = manageRolePage.submitAndGotoViewRolesPage();
    propertiesHelper.setImportTransactionOrder("AL3,AL5");
    String dataset = "mpesa_export_dbunit.xml";
    initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium);
    String path = this.getClass().getResource("/mpesa/" + FILE_WITH_NO_ERRORS).toString();
    ImportTransactionsPage importTransactionsPage = importTransaction(path);
    checkIfOutputMatchesExpected(path);
    importTransactionsPage.cancelImportTransaction();
    LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013");
    loanAccountPage.verifyStatus(LoanAccountPage.ACTIVE);
    loanAccountPage.verifyExactLoanAmount("2,000");
    SavingsAccountDetailPage savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage("000100000000015");
    savingsAccountDetailPage.verifySavingsAmount("0");
    adminPage = navigationHelper.navigateToAdminPage();
    importTransactionsPage = adminPage.navigateToImportTransactionsPage();
    ImportTransactionsConfirmationPage importTransactionsConfirmationPage = importTransactionsPage.importTransactions(path, EXCEL_IMPORT_TYPE);
    importTransactionsConfirmationPage.verifyImportSuccess("You have successfully imported transactions.");
    loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013");
    loanAccountPage.verifyStatus(LoanAccountPage.CLOSED);
    ViewRepaymentSchedulePage viewRepaymentSchedulePage = loanAccountPage.navigateToRepaymentSchedulePage();
    viewRepaymentSchedulePage.verifyFirstInstallmentDate(5, 3, "28-Jan-2011");
    loanAccountPage = viewRepaymentSchedulePage.navigateToLoanAccountPage();
    loanAccountPage.verifyPerformanceHistory("11", "11");
    TransactionHistoryPage transactionHistoryPage = loanAccountPage.navigateToTransactionHistoryPage();
    transactionHistoryPage.verifyTransactionHistory(2013, 2, 48);
    transactionHistoryPage.verifyPostedBy("mifos", 48);
    savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage("000100000000015");
    savingsAccountDetailPage.verifySavingsAmount("3170.0");
    savingsAccountDetailPage.verifyDate("28/01/2011");
}
Also used : ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) TransactionHistoryPage(org.mifos.test.acceptance.framework.loan.TransactionHistoryPage) ViewRolesPage(org.mifos.test.acceptance.framework.admin.ViewRolesPage) ViewRepaymentSchedulePage(org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage) ImportTransactionsConfirmationPage(org.mifos.test.acceptance.framework.admin.ImportTransactionsConfirmationPage) SavingsAccountDetailPage(org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage) ImportTransactionsPage(org.mifos.test.acceptance.framework.admin.ImportTransactionsPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) DateTime(org.joda.time.DateTime) Test(org.testng.annotations.Test)

Example 2 with ViewRolesPage

use of org.mifos.test.acceptance.framework.admin.ViewRolesPage in project head by mifos.

the class RolesAndPermissionTest method changePermission.

private void changePermission(AdminPage adminPage, String permissionValue, boolean enablePermission) {
    ViewRolesPage viewRolesPage;
    ManageRolePage manageRolePage;
    viewRolesPage = adminPage.navigateToViewRolesPage();
    manageRolePage = viewRolesPage.navigateToManageRolePage("Admin");
    manageRolePage.verifyPage();
    if (enablePermission) {
        manageRolePage.enablePermission(permissionValue);
    } else {
        manageRolePage.disablePermission(permissionValue);
    }
    viewRolesPage = manageRolePage.submitAndGotoViewRolesPage();
    viewRolesPage.navigateToAdminPage();
}
Also used : ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) ViewRolesPage(org.mifos.test.acceptance.framework.admin.ViewRolesPage)

Example 3 with ViewRolesPage

use of org.mifos.test.acceptance.framework.admin.ViewRolesPage in project head by mifos.

the class RolesAndPermissionTest method setMaximumLoanAmountRestriction.

private void setMaximumLoanAmountRestriction(AdminPage adminPage, String amount, boolean enablePermissionAndRestriction) {
    ViewRolesPage viewRolesPage = adminPage.navigateToViewRolesPage();
    Assert.assertEquals("Role 'CanRunBatchJobs' does not exist!", selenium.isTextPresent("CanRunBatchJobs"), true);
    ManageRolePage manageRolePage = viewRolesPage.navigateToManageRolePage("Admin");
    manageRolePage.verifyPage();
    if (enablePermissionAndRestriction) {
        selenium.check("css=input#activityRestrictionCheckbox1");
    } else {
        selenium.uncheck("css=input#activityRestrictionCheckbox1");
    }
    selenium.type("css=input[name='restrictionValue(1)']", amount);
    viewRolesPage = manageRolePage.submitAndGotoViewRolesPage();
    viewRolesPage.navigateToAdminPage();
}
Also used : ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) ViewRolesPage(org.mifos.test.acceptance.framework.admin.ViewRolesPage)

Example 4 with ViewRolesPage

use of org.mifos.test.acceptance.framework.admin.ViewRolesPage in project head by mifos.

the class QuestionGroupTest method checkQuestionGroupPermission.

@Test(enabled = true)
public void checkQuestionGroupPermission() {
    AdminPage adminPage = getAdminPage();
    CreateQuestionGroupPage createQuestionGroupPage = getCreateQuestionGroupPage(adminPage);
    CreateQuestionGroupParameters parameters = new CreateQuestionGroupParameters();
    parameters.setTitle(qgTitle4);
    parameters.setAppliesTo(APPLIES_TO_CREATE_CLIENT);
    parameters.setAnswerEditable(true);
    for (String question : asList(qTitle1, qTitle2)) {
        parameters.addExistingQuestion(SECTION_DEFAULT, question);
    }
    for (String section : parameters.getExistingQuestions().keySet()) {
        createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
    }
    createQuestionGroupPage.submit(parameters);
    ViewRolesPage rolesPage = adminPage.navigateToViewRolesPage();
    ManageRolePage manageRolePage = rolesPage.navigateToManageRolePage(ADMIN_ROLE);
    manageRolePage.verifyPermissionText(QUESTION_PERMISSION_ID, QUESTION_PERMISSION_HEADER + qgTitle4);
    manageRolePage.disablePermission(QUESTION_PERMISSION_ID);
    manageRolePage.submitAndGotoViewRolesPage();
    adminPage = getAdminPage();
    Assert.assertTrue(adminPage.navigateToViewAllQuestionGroups().navigateToQuestionGroupDetailPage(qgTitle4).isAccessDeniedDisplayed());
    //set question group on inactive
    adminPage.navigateBack();
    adminPage.navigateToAdminPageUsingHeaderTab();
    manageRolePage = adminPage.navigateToViewRolesPage().navigateToManageRolePage(ADMIN_ROLE);
    manageRolePage.verifyPermissionText(QUESTION_PERMISSION_ID, QUESTION_PERMISSION_HEADER + qgTitle4);
    manageRolePage.enablePermission(QUESTION_PERMISSION_ID);
    manageRolePage.submitAndGotoViewRolesPage().navigateToAdminPage().navigateToViewAllQuestionGroups().navigateToQuestionGroupDetailPage(qgTitle4);
    questionGroupTestHelper.markQuestionGroupAsInactive(qgTitle4);
}
Also used : ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) ViewRolesPage(org.mifos.test.acceptance.framework.admin.ViewRolesPage) CreateQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage) Test(org.testng.annotations.Test)

Aggregations

ManageRolePage (org.mifos.test.acceptance.framework.admin.ManageRolePage)4 ViewRolesPage (org.mifos.test.acceptance.framework.admin.ViewRolesPage)4 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)2 Test (org.testng.annotations.Test)2 DateTime (org.joda.time.DateTime)1 ImportTransactionsConfirmationPage (org.mifos.test.acceptance.framework.admin.ImportTransactionsConfirmationPage)1 ImportTransactionsPage (org.mifos.test.acceptance.framework.admin.ImportTransactionsPage)1 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)1 TransactionHistoryPage (org.mifos.test.acceptance.framework.loan.TransactionHistoryPage)1 ViewRepaymentSchedulePage (org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage)1 CreateQuestionGroupPage (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage)1 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)1 SavingsAccountDetailPage (org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage)1 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)1