Skip to content

Commit 6721a7c

Browse files
author
Mohan Ahuja
committed
ACP2E-345: Unable to save product URL key with a hyphen "-" at end.
- Updated validation error message to be more clear for user - Updated MFTF test accordingly
1 parent ab59e0e commit 6721a7c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest/AdminCreateSimpleProductUrlKeyTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929

3030
<fillField stepKey="fillUrlKey1" selector="{{AdminProductFormBundleSection.urlKey}}" userInput="example-page-"/>
3131
<click stepKey="blurFromUrlKey1" selector="{{AdminProductSEOSection.metaTitleInput}}"/>
32-
<see selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Please enter a valid URL Key (Ex: example-page)." stepKey="seeLastHyphenErrorMessage"/>
32+
<see selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Trailing hyphens are not allowed." stepKey="seeLastHyphenErrorMessage"/>
3333

3434
<clearField selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="clearFieldUrlKey2"/>
3535
<fillField stepKey="fillUrlKey2" selector="{{AdminProductFormBundleSection.urlKey}}" userInput="-Example-Page"/>
3636
<click stepKey="blurFromUrlKey2" selector="{{AdminProductSEOSection.metaTitleInput}}"/>
37-
<see selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Please enter a valid URL Key (Ex: example-page)." stepKey="seeFirstHyphenErrorMessage"/>
37+
<see selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Trailing hyphens are not allowed." stepKey="seeFirstHyphenErrorMessage"/>
3838

3939
<clearField selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="clearFieldUrlKey3"/>
4040
<click stepKey="blurFromUrlKey3" selector="{{AdminProductSEOSection.metaTitleInput}}"/>
4141
<fillField stepKey="fillUrlKey3" selector="{{AdminProductFormBundleSection.urlKey}}" userInput="example-page-test"/>
42-
<dontSee selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Please enter a valid URL Key (Ex: example-page)." stepKey="dontSeeErrorMessage"/>
42+
<dontSee selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Trailing hyphens are not allowed." stepKey="dontSeeErrorMessage"/>
4343
</test>
4444
</tests>

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ define([
821821
function (value) {
822822
return utils.isEmptyNoTrim(value) || /^(?!-)(?!.*-$).+$/.test(value);
823823
},
824-
$.mage.__('Please enter a valid URL Key (Ex: example-page).')
824+
$.mage.__('Trailing hyphens are not allowed.')
825825
],
826826
'validate-zip-international': [
827827

0 commit comments

Comments
 (0)