-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add validation phone field on checkout page #27537
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
Merged
magento-engcom-team
merged 12 commits into
magento:2.4-develop
from
Usik2203:validate-phone-field-on-checkout
Aug 1, 2020
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c54b8f3
Validate phone field on checkout page
Usik2203 196e423
add slash and fix static issue
Usik2203 f951152
Merge branch '2.4-develop' into validate-phone-field-on-checkout
slavvka f5c2575
Merge branch '2.4-develop' into validate-phone-field-on-checkout
Usik2203 42889f8
uses magento validation rule
Usik2203 d9f626d
Add validation for phone to billing form
Usik2203 9706369
Merge branch '2.4-develop' into validate-phone-field-on-checkout
Usik2203 0433c82
Merge branch '2.4-develop' into validate-phone-field-on-checkout
Usik2203 3afe988
Fix phone
Usik2203 15ceda0
Update some phones
Usik2203 a692863
Fix phone
Usik2203 95be243
added testCaseId
engcom-Echo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutPhoneValidationTest.xml
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="StorefrontOnePageCheckoutPhoneValidationTest"> | ||
<annotations> | ||
<features value="Checkout"/> | ||
<stories value="Checkout validation phone field"/> | ||
<title value="Validate phone field on checkout page"/> | ||
<description value="Validate phone field on checkout page, field must not contain alphabetical symbols"/> | ||
<severity value="MAJOR" /> | ||
</annotations> | ||
<before> | ||
<createData entity="_defaultCategory" stepKey="createCategory"/> | ||
<createData entity="ApiSimpleProduct" stepKey="createProduct"> | ||
<requiredEntity createDataKey="createCategory"/> | ||
</createData> | ||
</before> | ||
<after> | ||
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> | ||
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/> | ||
</after> | ||
|
||
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openCategoryPageOnFrontend"> | ||
<argument name="category" value="$createCategory$"/> | ||
</actionGroup> | ||
|
||
<actionGroup ref="StorefrontAddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage"> | ||
<argument name="product" value="$$createProduct$$"/> | ||
</actionGroup> | ||
|
||
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="guestGoToCheckout"/> | ||
|
||
<fillField userInput="Sample text" selector="{{CheckoutShippingSection.telephone}}" stepKey="enterAlphabeticalSymbols"/> | ||
<see userInput="Please enter a valid phone number. For example (123) 456-7890, 123-456-7890, +(123)4567890, +1234567890" selector="{{CheckoutShippingSection.addressFieldValidationError}}" stepKey="checkPhoneFieldValidationIsPassed"/> | ||
</test> | ||
</tests> |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding yet another validation rule to
validate-phoneStrict
andvalidate-phoneLax
seems a bit redundant. I'd use one of the existing ones and expand them if necessary.It also feels like something that can be easily confusing in the future when someone needs one of the validation rules and asks "what is the difference between them?".
Because there are two validation rules for phone numbers maybe it'd be good to add a configuration to specify whether to allow for "lax" validation or rather the more "strict" one (depending on the wants of the end-user).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Usik2203 This is a very apt comment. Please can you consider it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Serializator , @engcom-Echo
I will check it. Thank you for advice!