Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a check that all modules are running #8

Merged
merged 1 commit into from
Jun 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"));
}
}

}