Skip to content

Commit

Permalink
Merge pull request #8 from LeeBreisacher/RA-79-CheckModules
Browse files Browse the repository at this point in the history
add a check that all modules are running
  • Loading branch information
Breeze773 committed Jun 25, 2013
2 parents 631b2b6 + e3acd5f commit 267d954
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ui-tests/src/main/java/org/openmrs/reference/page/ModulesPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.openmrs.reference.page;


import org.openqa.selenium.WebDriver;

public class ModulesPage extends AbstractBasePage {

public ModulesPage(WebDriver driver) {
super(driver);
}

@Override
public String expectedUrlPath() {
return "/openmrs/admin/modules/module.list";
}
}

44 changes: 44 additions & 0 deletions ui-tests/src/test/java/org/openmrs/reference/CheckModules.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.openmrs.reference;

import java.util.List;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.reference.page.HomePage;
import org.openmrs.reference.page.LoginPage;
import org.openmrs.reference.page.ModulesPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

public class CheckModules extends TestBase {
private LoginPage loginPage;
private HomePage homePage;
private ModulesPage modulesPage;

@Before
public void setUp() {
loginPage = new LoginPage(driver);
homePage = new HomePage(driver);
modulesPage = new ModulesPage(driver);
}

@Test
public void checkModules() throws Exception {
assertPage(loginPage);
loginPage.loginAsAdmin();
assertPage(homePage);
homePage.gotoPage("/admin/modules/module.list");
assertPage(modulesPage);
// Get the modulesListing <div>, which contains the table of modules.
WebElement moduleListing = modulesPage.getElementById("moduleListing");
// Grab all the <input> elements from the first column of the table.
List<WebElement> firstColumn = moduleListing.findElements(By.xpath("table/tbody/tr/td[1]/input"));
for (WebElement eachModule : firstColumn) {
// The name attr on the <input> elements should all be "stop" which indicates the module is correctly started.
// If not, then grab the text from the 3rd column to show which module is not started.
Assert.assertEquals("module not ready: " + eachModule.findElement(By.xpath("../../td[3]")).getText(), "stop", eachModule.getAttribute("name"));
}
}

}

0 comments on commit 267d954

Please sign in to comment.