diff --git a/src/components/forms/LoginForm.jsx b/src/components/forms/LoginForm.jsx index 14a29e2e..fd308f8f 100644 --- a/src/components/forms/LoginForm.jsx +++ b/src/components/forms/LoginForm.jsx @@ -42,17 +42,24 @@ const LoginForm = ({ }, []) const getRecaptchaScore = () => { - executeRecaptcha('login') - .then(token => { - setRecaptchaScore(token) - }) - .catch(error => { - const { message, variant } = { ...error.response.data } - setNotification({ - message, - variant: variant ? variant : 'danger' - }, 5) - }) + if (window.Cypress) { + // we are running in Cypress + // so do something different here + setRecaptchaScore() + } else { + // we are running in a regular ol' browser + executeRecaptcha('login') + .then(token => { + setRecaptchaScore(token) + }) + .catch(error => { + const { message, variant } = { ...error.response.data } + setNotification({ + message, + variant: variant ? variant : 'danger' + }, 5) + }) + } } const loginUser = useCallback(loginValues => { diff --git a/src/reducers/notificationReducer.js b/src/reducers/notificationReducer.js index d306b24e..d0587ab7 100644 --- a/src/reducers/notificationReducer.js +++ b/src/reducers/notificationReducer.js @@ -113,12 +113,21 @@ export const setSearchInProgress = searching => { */ export const setRecaptchaScore = token => { - return async dispatch => { - const result = await recaptchaService.verify(token) - dispatch ({ - type: 'SET_RECAPTCHA_SCORE', - score: result.score - }) + if (window.Cypress) { + return async dispatch => { + dispatch ({ + type: 'SET_RECAPTCHA_SCORE', + score: .9 + }) + } + } else { + return async dispatch => { + const result = await recaptchaService.verify(token) + dispatch ({ + type: 'SET_RECAPTCHA_SCORE', + score: result.score + }) + } } }