fix: valid username lowercase (#42172)

* fix: valid username lowercase

* test: add test in the validate for reject uppercase characters

* test: add test in the cypress for check on uppercase characters and reject it.
This commit is contained in:
Lance
2021-05-20 02:04:00 -05:00
committed by GitHub
parent 938e5913fa
commit 9c86168b2f
5 changed files with 35 additions and 5 deletions

View File

@ -121,7 +121,7 @@ describe('Username input field', () => {
.clear({ force: true })
.type('Quincy Larson', { force: true });
cy.contains('Username "quincy larson" contains invalid characters')
cy.contains('Username "Quincy Larson" contains invalid characters')
.should('be.visible')
.should('have.attr', 'role', 'alert')
// We are checking for classes here to check for proper styling
@ -198,4 +198,22 @@ describe('Username input field', () => {
cy.resetUsername();
});
it('Should show warning if username includes uppercase characters', () => {
cy.get('@usernameInput')
.clear({ force: true })
.type('QuincyLarson', { force: true });
cy.contains('Username "QuincyLarson" must be lowercase')
.should('be.visible')
.should('have.attr', 'role', 'alert')
.should('have.class', 'alert alert-danger');
});
it('Should not be able to click the `Save` button if username includes uppercase characters', () => {
cy.get('@usernameInput')
.clear({ force: true })
.type('QuincyLarson', { force: true });
cy.get('@usernameForm').contains('Save').should('be.disabled');
});
});