diff --git a/packages/game-app/cypress/integration/signup.spec.ts b/packages/game-app/cypress/integration/signup.spec.ts index 0fec4374..e49b3922 100644 --- a/packages/game-app/cypress/integration/signup.spec.ts +++ b/packages/game-app/cypress/integration/signup.spec.ts @@ -73,6 +73,40 @@ context('Signup', () => { }); }); + it('should signup correctly and go to email verification required if email contains capital letters', () => { + const { email, password } = generateRandomCredentials(); + const emailWithCapitalLetters = email.charAt(0).toUpperCase() + email.slice(1); + usedEmails.push(email); + cy.getInputByName('firstName').fill('John'); + cy.getInputByName('lastName').fill('Doe'); + cy.getInputByName('email').fill(emailWithCapitalLetters); + cy.getInputByName('password').fill(password); + cy.getInputByName('repeatPassword').fill(password); + cy.getInputByName('role').select('endUser'); + cy.getInputByName('devOpsMaturity').select('veryImmature'); + cy.containsTranslationOf('button', 'signup.form.buttonText').click(); + cy.get('body').should('contain.translationOf', 'signup.verificationRequired.title'); + + // check auth presence + cy.getFirebaseUserByEmail(email) + .should('deep.include', { + email: email, + emailVerified: false, + disabled: false, + }) + .its('uid') + .then(uid => { + // check firestore data + cy.getFirestoreDocument(`users/${uid}`).should('contain', { + firstName:'John', + lastName:'Doe', + devOpsMaturity: 'veryImmature', + role: 'endUser', + email: email, + }); + }); + }); + it('should show email already used error', () => { const { email, password } = generateRandomCredentials(); cy.initializeUser({ email }); diff --git a/packages/game-app/src/signup/sagas/signup.ts b/packages/game-app/src/signup/sagas/signup.ts index a8417b94..846095e6 100644 --- a/packages/game-app/src/signup/sagas/signup.ts +++ b/packages/game-app/src/signup/sagas/signup.ts @@ -5,16 +5,18 @@ import { addRequestStatusManagement } from '@pipeline/requests-status'; import { actions as authActions, AuthUser } from '@pipeline/auth'; import { actions as analyticsActions } from '@pipeline/analytics'; import { selectors as dynamicSelectors } from '@pipeline/dynamicData'; +import { SignupInfo } from '../types/signupInfo'; function* signupSaga(action: ReturnType) { - const user: AuthUser = yield call(executeSignup, action.payload); + const info: SignupInfo = { ...action.payload, email: action.payload.email.toLowerCase() }; + const user: AuthUser = yield call(executeSignup, info); yield put(authActions.setLoggedUser(user)); const maturities = yield select(dynamicSelectors.getDevOpsMaturitiesMap); const roles = yield select(dynamicSelectors.getGameRolesMap); const crmInfo = { - email: action.payload.email, - firstName: action.payload.firstName, - lastName: action.payload.lastName, + email: info.email, + firstName: info.firstName, + lastName: info.lastName, how_mature_are_your_devops_practices_: maturities[action.payload.devOpsMaturity], what_is_your_role_in_the_company_: roles[action.payload.role], id: user.id,