From 7c84a75ff0c065434bb32bae3aeb2c542775973d Mon Sep 17 00:00:00 2001 From: Ziwei Wang <ziwei.wang@savoirfairelinux.com> Date: Mon, 26 Aug 2024 17:36:41 -0400 Subject: [PATCH] Fix: missing helper text for the password input field Since ae51d70, the helper text should only show when the password is too weak. Text 'strong' is not valid anymore. Change-Id: Ie4676c82098d8a0eea38d7ca377c3553112d3223 --- client/cypress.env.example.json | 3 ++- client/cypress/e2e/register/register.cy.ts | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/cypress.env.example.json b/client/cypress.env.example.json index 4e35396d..f6bea189 100644 --- a/client/cypress.env.example.json +++ b/client/cypress.env.example.json @@ -2,5 +2,6 @@ "CLIENT_URL": "http://localhost:3000", "SERVER_URL": "http://localhost:5000", "TEST_USERNAME": "your-test-user", - "TEST_USER_PASSWORD": "your-test-password" + "TEST_USER_PASSWORD": "your-test-password", + "USED_USERNAME": "your-used-username" } diff --git a/client/cypress/e2e/register/register.cy.ts b/client/cypress/e2e/register/register.cy.ts index 6d77311f..3236e0ab 100644 --- a/client/cypress/e2e/register/register.cy.ts +++ b/client/cypress/e2e/register/register.cy.ts @@ -39,6 +39,11 @@ describe('registration', () => { cy.get('[data-cy = "username-input"]').find('[id$=-helper-text]').contains('Username available') + cy.get('[data-cy = "password-input"]').type('123456').find('input').should('have.value', '123456') + + cy.get('[data-cy = "password-input"]').find('[id$=-helper-text]').contains('Too weak') + + cy.get('[data-cy = "password-input"]').find('input').clear() //TODO: Make a cypress custom command that generates a valid password (that is strong determined by passwordStrength() from npm module `check-password-strength`) as well as one generating an invalid one cy.get('[data-cy = "password-input"]') .type(`Test-user-${randomId}`) @@ -47,7 +52,7 @@ describe('registration', () => { //TODO: uncomment the following code when the UI implements the input field for password repeat // cy.get('[data-cy = "password-repeat-input"]').type(`Test/user/${randomId}`).should('have.value', `Test/user/${randomId}`); - cy.get('[data-cy = "password-input"]').find('[id$=-helper-text]').contains('Strong') + cy.get('[data-cy = "password-input"]').find('[id$=-helper-text]').should('not.have', 'Too weak') cy.get('[data-cy = "register-button"]') .click() -- GitLab