@Feature(summary = "The user must enter an id that starts and ends with " +
"alphanumeric character to create a project version",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0)
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
public void idStartsAndEndsWithAlphanumeric() throws Exception {
CreateVersionPage createVersionPage = new LoginWorkFlow()
.signIn("admin", "admin")
.goToProjects()
.goToProject("about fedora")
.clickCreateVersionLink()
.inputVersionId("-A");
createVersionPage.defocus();
assertThat(createVersionPage.expectError(
CreateVersionPage.VALIDATION_ERROR))
.contains(CreateVersionPage.VALIDATION_ERROR)
.as("The input is rejected");
createVersionPage = createVersionPage.inputVersionId("B-");
createVersionPage.defocus();
assertThat(createVersionPage.expectError(
CreateVersionPage.VALIDATION_ERROR))
.contains(CreateVersionPage.VALIDATION_ERROR)
.as("The input is rejected");
createVersionPage = createVersionPage.inputVersionId("_C_");
createVersionPage.defocus();
createVersionPage = createVersionPage.waitForNumErrors(1);
assertThat(createVersionPage.expectError(
CreateVersionPage.VALIDATION_ERROR))
.contains(CreateVersionPage.VALIDATION_ERROR)
.as("The input is rejected");
createVersionPage = createVersionPage.inputVersionId("A-B_C");
createVersionPage.defocus();
createVersionPage = createVersionPage.waitForNumErrors(0);
assertThat(createVersionPage.getErrors())
.doesNotContain(CreateVersionPage.VALIDATION_ERROR)
.as("The input is acceptable");
}