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 restrictions on names of domains - automated tests #2189

Merged
merged 15 commits into from
Dec 16, 2024

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."));
Copy link
Contributor

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);
Copy link
Contributor

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();
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

@XingY XingY merged commit 9ddd6d0 into develop Dec 16, 2024
1 of 2 checks passed
@XingY XingY deleted the fb_domainNameValidation branch December 16, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants