Skip to content

Commit 4c62af0

Browse files
committed
MC-30152: Bundle Product / Create / Price validation for dynamic price
1 parent 63434d2 commit 4c62af0

6 files changed

+114
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminToggleSwitchDynamicPriceOnProductEditPageActionGroup">
12+
<waitForElementVisible selector="{{AdminProductFormBundleSection.dynamicPriceToggle}}" stepKey="waitForToggleDynamicPrice"/>
13+
<checkOption selector="{{AdminProductFormBundleSection.dynamicPriceToggle}}" stepKey="switchDynamicPriceToggle"/>
14+
</actionGroup>
15+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<!-- Test XML Example -->
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminBundleProductPriceValidationErrorDisappearedAfterSwitchToDynamicPriceTest">
11+
<annotations>
12+
<features value="Bundle"/>
13+
<stories value="Create/Edit bundle product in Admin"/>
14+
<title value="Assert error message for price field"/>
15+
<description value="Verify error message for price field is not visible when toggle Dynamic Price is disabled"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-40309"/>
18+
<useCaseId value="MC-30152"/>
19+
<group value="bundle"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
27+
</after>
28+
29+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewBundleProductPage">
30+
<argument name="productType" value="bundle"/>
31+
</actionGroup>
32+
<actionGroup ref="AdminToggleSwitchDynamicPriceOnProductEditPageActionGroup" stepKey="disableDynamicPrice"/>
33+
<actionGroup ref="AdminFillProductPriceFieldAndPressEnterOnProductEditPageActionGroup" stepKey="fillProductPriceField">
34+
<argument name="price" value="test"/>
35+
</actionGroup>
36+
<actionGroup ref="AssertAdminValidationErrorAppearedForPriceFieldOnProductEditPageActionGroup" stepKey="assertVisibleError">
37+
<argument name="errorMessage" value="Please enter a number 0 or greater in this field."/>
38+
</actionGroup>
39+
<actionGroup ref="AdminToggleSwitchDynamicPriceOnProductEditPageActionGroup" stepKey="enableDynamicPrice"/>
40+
<actionGroup ref="AssertAdminNoValidationErrorForPriceFieldOnProductEditPageActionGroup" stepKey="assertNotVisibleError"/>
41+
</test>
42+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminFillProductPriceFieldAndPressEnterOnProductEditPageActionGroup">
12+
<arguments>
13+
<argument name="price" type="string"/>
14+
</arguments>
15+
16+
<waitForElementVisible selector="{{AdminProductFormSection.productPrice}}" stepKey="waitForPriceField"/>
17+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="fillPriceField"/>
18+
<pressKey selector="{{AdminProductFormSection.productPrice}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="pressEnterButton"/>
19+
</actionGroup>
20+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminNoValidationErrorForPriceFieldOnProductEditPageActionGroup">
12+
<dontSeeElement selector="{{AdminProductFormSection.priceFieldError}}" stepKey="dontSeeValidationError"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminValidationErrorAppearedForPriceFieldOnProductEditPageActionGroup">
12+
<arguments>
13+
<argument name="errorMessage" type="string" defaultValue="This is a required field."/>
14+
</arguments>
15+
16+
<waitForElementVisible selector="{{AdminProductFormSection.priceFieldError}}" stepKey="waitForValidationError"/>
17+
<see selector="{{AdminProductFormSection.priceFieldError}}" userInput="{{errorMessage}}" stepKey="seeElementValidationError"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Ui/view/base/web/js/lib/core/element/links.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ define([
7979

8080
component.set(property, value, owner);
8181

82+
if (property === 'disabled' && value) {
83+
component.set('validate', value, owner);
84+
}
85+
8286
if (linked) {
8387
linked.mute = false;
8488
}

0 commit comments

Comments
 (0)