-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: progressive profiling and registration (#80)
- There should be no error message on undetected option in country field bydefault - cookie value should be on variable base - check user country on progressive profiling popup, if not set not allow user to skip or register - pass country in register payload on the base of country cookie
- Loading branch information
1 parent
14d4a3d
commit 58032c1
Showing
11 changed files
with
120 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ LOGOUT_URL=http://localhost:18000/login | |
REFRESH_ACCESS_TOKEN_ENDPOINT=http://localhost:18000/login_refresh | ||
SITE_NAME=edX | ||
INFO_EMAIL=[email protected] | ||
ONBOARDING_COMPONENT_ENV='development' | ||
# ***** Algolia keys to fetch subject list ***** | ||
AUTHN_ALGOLIA_APP_ID='' | ||
AUTHN_ALGOLIA_SEARCH_API_KEY='' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import { injectIntl, IntlProvider } from '@edx/frontend-platform/i18n'; | |
import { fireEvent, render } from '@testing-library/react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import configureStore from 'redux-mock-store'; | ||
import Cookies from 'universal-cookie'; | ||
|
||
import { setCurrentOpenedForm } from '../../../authn-component/data/reducers'; | ||
import { | ||
|
@@ -75,6 +76,7 @@ describe('RegistrationForm Test', () => { | |
TOS_AND_HONOR_CODE: process.env.TOS_AND_HONOR_CODE, | ||
PRIVACY_POLICY: process.env.PRIVACY_POLICY, | ||
USER_RETENTION_COOKIE_NAME: 'authn-returning-user', | ||
ONBOARDING_COMPONENT_ENV: process.env.ONBOARDING_COMPONENT_ENV, | ||
}); | ||
}); | ||
|
||
|
@@ -108,6 +110,38 @@ describe('RegistrationForm Test', () => { | |
expect(store.dispatch).toHaveBeenCalledWith(registerUser(payload)); | ||
}); | ||
|
||
it('should submit form with country code', async () => { | ||
// Mock Cookies class | ||
jest.mock('universal-cookie'); | ||
|
||
const cookie = new Cookies(); | ||
cookie.set(`${getConfig().ONBOARDING_COMPONENT_ENV}-edx-cf-loc`, 'US'); | ||
|
||
store.dispatch = jest.fn(store.dispatch); | ||
const payload = { | ||
email: '[email protected]', | ||
name: 'test', | ||
password: 'test-password12', | ||
marketing_email_opt_in: true, | ||
honor_code: true, | ||
terms_of_service: true, | ||
country: 'US', | ||
}; | ||
const { container } = render(reduxWrapper(<IntlRegistrationForm />)); | ||
|
||
const emailInput = container.querySelector('#email'); | ||
fireEvent.change(emailInput, { target: { value: payload.email, name: 'email' } }); | ||
|
||
const nameInput = container.querySelector('#name'); | ||
const passwordInput = container.querySelector('#password'); | ||
const registerButton = container.querySelector('#register-user'); | ||
fireEvent.change(nameInput, { target: { value: payload.name, name: 'name' } }); | ||
fireEvent.change(passwordInput, { target: { value: payload.password, name: 'password' } }); | ||
fireEvent.click(registerButton); | ||
|
||
expect(store.dispatch).toHaveBeenCalledWith(registerUser(payload)); | ||
}); | ||
|
||
it('should display an error when form is submitted with an invalid email', () => { | ||
jest.spyOn(global.Date, 'now').mockImplementation(() => 0); | ||
const emailError = 'We couldn’t create your account. Please correct the errors below.'; | ||
|