Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Password onboarding unit test, test-ids, and snapshot #18257

Merged
merged 28 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bfa98c1
Create Password onboarding unit test, test-ids, and snapshot
tmashuang Mar 21, 2023
c3c37df
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 22, 2023
e689e08
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 23, 2023
4afc859
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 24, 2023
764559f
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 25, 2023
090933d
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 28, 2023
ed1b1d8
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 29, 2023
3c0e16c
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 30, 2023
a91f538
Add button inline snapshot check for import wallet text
tmashuang Mar 31, 2023
7a497cf
Don't adjust inlineSnapshot formatting
tmashuang Mar 31, 2023
d3172d4
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Mar 31, 2023
633390a
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 1, 2023
cd9693b
Get text content
tmashuang Apr 1, 2023
80bf754
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 3, 2023
9166755
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 5, 2023
ce3640d
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 6, 2023
6be39d7
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 7, 2023
a9bc9a1
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 12, 2023
a6a049b
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 12, 2023
62ef3e3
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 13, 2023
ff877d8
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 17, 2023
85c5648
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 17, 2023
a292366
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 17, 2023
1cb6a4e
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 18, 2023
a680228
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 19, 2023
1528f97
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 20, 2023
f7c84a0
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
tmashuang Apr 20, 2023
545cd08
Merge branch 'develop' into 17191-onboarding-unit-tests-create-password
brad-decker Apr 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Onboarding Create Password Render should match snapshot 1`] = `
<div>
<div
class="create-password__wrapper"
data-testid="create-password"
>
<div
class="box box--margin-bottom-4 box--flex-direction-row"
>
<ul
class="progressbar"
>
<li
class="active"
>
Create password
</li>
<li
class=""
>
Secure wallet
</li>
<li
class=""
>
Confirm secret recovery phrase
</li>
</ul>
</div>
<h2
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h2 typography--weight-bold typography--style-normal typography--color-text-default"
>
Create password
</h2>
<h4
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h4 typography--weight-normal typography--style-normal typography--align-center typography--color-text-default"
>
This password will unlock your MetaMask wallet only on this device. MetaMask can not recover this password.
</h4>
<div
class="box box--margin-top-3 box--flex-direction-row box--justify-content-center box--display-flex"
>
<form
class="create-password__form"
>
<div
class="form-field"
>
<label
class="box box--flex-direction-row"
>
<div
class="form-field__heading"
>
<div
class="box form-field__heading-title box--display-flex box--flex-direction-row box--align-items-baseline"
>
<h6
class="box box--margin-top-1 box--margin-bottom-1 box--display-inline-block box--flex-direction-row typography typography--h6 typography--weight-bold typography--style-normal typography--color-text-default"
>
New password (8 characters min)
</h6>


</div>
<div
class="box form-field__heading-detail box--margin-right-2 box--flex-direction-row box--text-align-end"
>
<h6
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-text-default"
>
<a
class="create-password__form--password-button"
data-testid="show-password"
href=""
>
Show
</a>
</h6>
</div>
</div>
<input
class="form-field__input"
data-testid="create-password-new"
type="password"
value=""
/>


</label>
</div>
<div
class="form-field"
>
<label
class="box box--flex-direction-row"
>
<div
class="form-field__heading"
>
<div
class="box form-field__heading-title box--display-flex box--flex-direction-row box--align-items-baseline"
>
<h6
class="box box--margin-top-1 box--margin-bottom-1 box--display-inline-block box--flex-direction-row typography typography--h6 typography--weight-bold typography--style-normal typography--color-text-default"
>
Confirm password
</h6>


</div>
</div>
<input
class="form-field__input"
data-testid="create-password-confirm"
type="password"
value=""
/>

</label>
</div>
<div
class="box box--margin-bottom-4 box--flex-direction-row box--justify-content-space-between box--align-items-center box--display-flex"
>
<label
class="create-password__form__terms-label"
>
<input
class="check-box far fa-square"
data-testid="create-password-terms"
readonly=""
type="checkbox"
/>
<h5
class="box box--margin-top-1 box--margin-bottom-1 box--margin-left-3 box--flex-direction-row typography typography--h5 typography--weight-normal typography--style-normal typography--color-text-default"
>
<span>

I understand that MetaMask cannot recover this password for me.
<a
href="https://metamask.zendesk.com/hc/en-us/articles/4404722782107"
rel="noopener noreferrer"
target="_blank"
>
<span
class="create-password__link-text"
>
Learn more
</span>
</a>


</span>
</h5>
</label>
</div>
<button
class="button btn--rounded btn-primary btn--large create-password__form--submit-button"
data-testid="create-password-wallet"
disabled=""
role="button"
tabindex="0"
>
Create a new wallet
</button>
</form>
</div>
</div>
</div>
`;
11 changes: 10 additions & 1 deletion ui/pages/onboarding-flow/create-password/create-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,30 @@ export default function CreatePassword({
if (isTooShort) {
return {
className: 'create-password__weak',
dataTestId: 'short-password-error',
text: t('passwordNotLongEnough'),
description: '',
};
}
if (score >= 4) {
return {
className: 'create-password__strong',
dataTestId: 'strong-password',
text: t('strong'),
description: '',
};
}
if (score === 3) {
return {
className: 'create-password__average',
dataTestId: 'average-password',
text: t('average'),
description: t('passwordStrengthDescription'),
};
}
return {
className: 'create-password__weak',
dataTestId: 'weak-password',
text: t('weak'),
description: t('passwordStrengthDescription'),
};
Expand All @@ -116,7 +120,11 @@ export default function CreatePassword({
const { score } = zxcvbn(passwordInput);
const passwordStrengthLabel = getPasswordStrengthLabel(isTooShort, score);
const passwordStrengthComponent = t('passwordStrength', [
<span key={score} className={passwordStrengthLabel.className}>
<span
key={score}
data-testid={passwordStrengthLabel.dataTestId}
className={passwordStrengthLabel.className}
>
{passwordStrengthLabel.text}
</span>,
]);
Expand Down Expand Up @@ -206,6 +214,7 @@ export default function CreatePassword({
<Typography variant={TypographyVariant.H7}>
<a
href=""
data-testid="show-password"
className="create-password__form--password-button"
onClick={(e) => {
e.preventDefault();
Expand Down
Loading