-
Notifications
You must be signed in to change notification settings - Fork 323
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 #8 from LeeBreisacher/RA-79-CheckModules
add a check that all modules are running
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
ui-tests/src/main/java/org/openmrs/reference/page/ModulesPage.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,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
44
ui-tests/src/test/java/org/openmrs/reference/CheckModules.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,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")); | ||
} | ||
} | ||
|
||
} |