-
Notifications
You must be signed in to change notification settings - Fork 9
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 restrictions on names of domains - automated tests #2189
Conversation
ReactAssayDesignerPage assayDesignerPage = startCreateGpatAssay(trialData, invalidAssayName); | ||
List<String> errors = assayDesignerPage.clickSaveExpectingErrors(); | ||
assayDesignerPage.clickCancel(); | ||
Assert.assertTrue("Error msg not as expected during assay creation", errors.contains("Invalid Assay Design name. Domain name must start with a letter or a number character.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constant for the error message?
|
||
public static String randomInvalidDomainName(int size) | ||
{ | ||
return randomString(size, null, ILLEGAL_DOMAIN_NAME_CHARSET); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better (slightly more realistic) if this consisted of some number of illegal characters along with some legal characters. But perhaps the usages of this method already accomplish that.
String prefix = randomString(1, null, ALPHANUMERIC_STRING); // domain needs to start with alphanumeric char | ||
final String charset = ALPHANUMERIC_STRING + DOMAIN_SPECIAL_STRING; | ||
domainName = prefix + randomString(size - 1, null, charset); | ||
domainName = domainName.trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would the name have any spaces to be trimmed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They might have trailing space due to DOMAIN_SPECIAL_STRING contains whitespace
domainName = prefix + randomString(size - 1, null, charset); | ||
domainName = domainName.trim(); | ||
} | ||
while (domainName.length() < size || Pattern.matches("(.*\\s--[^ ].*)|(.*\\s-[^- ].*)", domainName)); // domain name must not contain space followed by dash. (command like) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to reference the issue number here.
Rationale
Related Pull Requests
Changes