Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Test for basic addition of versions to groups
Browse files Browse the repository at this point in the history
Add a group and verify it shows in the list.
  • Loading branch information
djansen-redhat committed Dec 2, 2013
1 parent 5515f00 commit da831b8
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 6 deletions.
Expand Up @@ -80,17 +80,22 @@ public VersionGroupPage addToGroup(int rowIndex) {
return this;
}

@SuppressWarnings("unused")
/**
* Get the list of project versions attached to the group
* @return a list of version group identifiers in the format
* "$projectID $version"
*/
public List<String> getProjectVersionsInGroup() {

List<WebElement> elements =
WebElementUtil
.getListItems(getDriver(), versionsInGroupTableBy);
List<WebElement> elements = WebElementUtil
.getListItems(getDriver(), versionsInGroupTableBy);

List<String> result = new ArrayList<String>();

for (WebElement element : elements) {
result.add(element.getText());
result.add(element
.findElement(By.className("list__title"))
.getText());
}
return result;
}
Expand Down Expand Up @@ -121,4 +126,41 @@ public void clickOnTab(String tabId) {
WebElement tab = getDriver().findElement(By.id(tabId));
tab.click();
}

public VersionGroupPage clickProjectsTab() {
getDriver().findElement(By.id("projects_tab")).click();
return new VersionGroupPage(getDriver());
}

public VersionGroupPage clickAddProjectVersionsButton() {
WebElement addProjectVersionButton =
waitForTenSec().until(new Function<WebDriver, WebElement>() {
@Override
public WebElement apply(WebDriver driver) {
return driver.findElement(By
.xpath("//*[@href='#settings-projects']"));
}
});
addProjectVersionButton.click();
return new VersionGroupPage(getDriver());
}

/**
* Enter a project version identifier
* @param projectVersion identifier in format "$projectID $version"
* @return new VersionGroupPage
*/
public VersionGroupPage enterProjectVersion(String projectVersion) {
getDriver().findElement(By.id("settings-projects-form:newVersionField:"+
"newVersionInput"))
.sendKeys(projectVersion);
return new VersionGroupPage(getDriver());
}

public VersionGroupPage clickAddProjectButton() {
getDriver().findElement(By.id(
"settings-projects-form:group-add-new-project-button")).click();
return new VersionGroupPage(getDriver());
}

}
Expand Up @@ -43,8 +43,10 @@
*/
@Category(DetailedTest.class)
public class VersionGroupFullTest {

@ClassRule
public static ResetDatabaseRule resetDatabaseRule = new ResetDatabaseRule();
public static ResetDatabaseRule resetDatabaseRule =
new ResetDatabaseRule(ResetDatabaseRule.Config.WithData);
private DashboardPage dashboardPage;

@Before
Expand Down Expand Up @@ -154,4 +156,27 @@ public void groupDescriptionFieldSize() {

}

@Test
public void addANewProjectVersionToAnEmptyGroup() {
String groupID = "add-version-to-empty-group";
String groupName = "AddVersionToEmptyGroup";
VersionGroupPage versionGroupPage = dashboardPage
.goToGroups()
.createNewGroup()
.inputGroupId(groupID)
.inputGroupName(groupName)
.saveGroup()
.goToGroup(groupName)
.clickProjectsTab()
.clickAddProjectVersionsButton()
.enterProjectVersion("about-fedora master")
.clickAddProjectButton()
.clickProjectsTab();

assertThat("The version group shows in the list",
versionGroupPage.getProjectVersionsInGroup(),
Matchers.hasItem("about-fedora master"));

}

}

0 comments on commit da831b8

Please sign in to comment.