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

Commit

Permalink
Rhbz973509 Indicate periods are acceptable for ids
Browse files Browse the repository at this point in the history
  • Loading branch information
djansen-redhat committed Jul 28, 2014
1 parent e0afdde commit e65e55b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 9 deletions.
Expand Up @@ -24,6 +24,10 @@ public class CreateVersionGroupPage extends BasePage {
public final static String LENGTH_ERROR =
"value must be shorter than or equal to 100 characters";

public final static String VALIDATION_ERROR =
"must start and end with letter or number, and contain only " +
"letters, numbers, periods, underscores and hyphens.";

@FindBy(id = "group-form:descriptionField:description")
private WebElement groupDescriptionField;

Expand Down
Expand Up @@ -38,6 +38,11 @@ public VersionGroupPage(final WebDriver driver) {
private final By newVersionListBy = By
.id("settings-projects-form:newVersionField:newVersionItems");

public String getGroupName() {
return getDriver().findElement(By.id("group-info"))
.findElement(By.tagName("h1")).getText();
}

public List<WebElement> searchProject(final String projectName,
final int expectedResultNum) {
projectSearchField.sendKeys(projectName);
Expand Down
Expand Up @@ -35,8 +35,8 @@
public class CreateVersionPage extends BasePage {

public final static String VALIDATION_ERROR =
"must start and end with letter or number, "
+ "and contain only letters, numbers, underscores and hyphens.";
"must start and end with letter or number, and contain only " +
"letters, numbers, periods, underscores and hyphens.";

@FindBy(id = "create-version-form:project-type")
private WebElement projectTypeSelection;
Expand Down
Expand Up @@ -110,10 +110,6 @@ public void goToGroupPage() {

@Theory
public void inputValidationForID(String inputText) {
String errorMsg =
"must start and end with letter or number, and "
+ "contain only letters, numbers, underscores and hyphens.";

// Yes reassign groupPage is necessary since JSF re-renders itself after
// each field input and selenium is not happy with it
groupPage = groupPage
Expand All @@ -123,7 +119,7 @@ public void inputValidationForID(String inputText) {
.saveGroupFailure();

assertThat(groupPage.getFieldErrors())
.contains(errorMsg)
.contains(CreateVersionGroupPage.VALIDATION_ERROR)
.as("Validation error is displayed for input:" + inputText);
}
}
Expand Up @@ -174,4 +174,24 @@ public void addANewProjectVersionToAnEmptyGroup() throws Exception {
.contains("about fedora\nmaster")
.as("The version group shows in the list");
}

@Feature(summary = "The administrator can use numbers, letters, periods, " +
"underscores and hyphens to create a group",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 396261)
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
public void groupIdCharactersAreAcceptable() throws Exception {
String groupID = "test-_.1";
String groupName = "TestValidIdCharacters";
VersionGroupPage versionGroupPage = dashboardPage
.goToGroups()
.createNewGroup()
.inputGroupId(groupID)
.inputGroupName(groupName)
.saveGroup()
.goToGroup(groupName);

assertThat(versionGroupPage.getGroupName())
.isEqualTo(groupName)
.as("The group was created");
}
}
Expand Up @@ -30,7 +30,7 @@

/**
* A slug is a short label for something, containing only letters, numbers,
* underscores or hyphens. It is typically used in urls
* periods, underscores or hyphens. It is typically used in urls
*
* @author asgeirf
*
Expand Down
Expand Up @@ -10,7 +10,7 @@ javax.validation.constraints.Pattern.message=must match {regexp}
javax.validation.constraints.Range.message=must be between {min} and {max}
javax.validation.constraints.Size.message=size must be between {min} and {max}
javax.validation.constraints.Email.message=must be a well-formed email address
javax.validation.constraints.Slug.message=must start and end with letter or number, and contain only letters, numbers, underscores and hyphens.
javax.validation.constraints.Slug.message=must start and end with letter or number, and contain only letters, numbers, periods, underscores and hyphens.
javax.validation.constraints.Url.message=must be a valid URL
#javax.validation.constraints.UrlNoSlash.message=must be a valid URL (without final slash)
javax.validation.constraints.NotDuplicateEmail.message=duplicate email
Expand Down

0 comments on commit e65e55b

Please sign in to comment.