use of org.mifos.test.acceptance.framework.MifosPage in project head by mifos.
the class BatchJobHelper method checkBatchJobsHaveFinished.
@SuppressWarnings("PMD")
private boolean checkBatchJobsHaveFinished(Map<String, String> previousRuns) {
(new MifosPage(selenium)).logout();
UiTestUtils.sleep(WAITING_TIME);
LoginPage loginPage = appLauncher.launchMifos();
loginPage.tryLoginUsingDefaultCredentials();
if (!selenium.isElementPresent("//span[@id='page.id']") || "Login".equals(selenium.getAttribute("page.id@title"))) {
return false;
} else {
Assert.assertEquals(selenium.getAttribute("page.id@title"), "Home");
}
HomePage homePage = new HomePage(selenium);
homePage.tryNavigateToAdminPage();
if ("Login".equals(selenium.getAttribute("page.id@title"))) {
return false;
} else {
Assert.assertEquals(selenium.getAttribute("page.id@title"), AdminPage.PAGE_ID);
}
adminPage.tryNavigateToBatchJobsPage();
if (selenium.isElementPresent("//span[@id='page.id']")) {
// TODO Batch Jobs page do not have page.id!
if ("Login".equals(selenium.getAttribute("page.id@title"))) {
return false;
} else {
Assert.assertTrue(false, "Expected Batch Jobs page, but was: " + selenium.getAttribute("page.id@title"));
}
}
List<String> completedJobs = new ArrayList<String>();
for (Map.Entry<String, String> entry : previousRuns.entrySet()) {
if (entry.getValue().equals(batchJobsPage.getPreviousRunStart(entry.getKey()))) {
for (String job : completedJobs) {
previousRuns.remove(job);
}
return false;
}
Assert.assertEquals(batchJobsPage.getPreviousRunStatus(entry.getKey()), "Previous run status: Completed");
completedJobs.add(entry.getKey());
}
return true;
}
Aggregations