Skip to content

Commit 7c5373c

Browse files
author
Alexey Yakimovich
committed
MAGETWO-95837: Product is added to Wish List with Attributes selected however they were unselected on PDP before
- Fixed static and functional tests;
1 parent 4cba397 commit 7c5373c

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,10 @@
5555
<selectOption userInput="{{colorProductAttribute2.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption2"/>
5656
<click selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="clickDropDownProductOption"/>
5757

58-
<!--Add the product to Wish List-->
58+
<!--Click Add to Wish List link-->
5959
<click selector="{{StorefrontProductPageSection.addToWishlist}}" stepKey="addFirstPnroductToWishlist"/>
60-
<waitForPageLoad stepKey="waitForLoading"/>
61-
<!--Click "Add All to Cart" button-->
62-
<click selector="{{StorefrontCustomerWishlistProductSection.ProductAddAllToCart}}" stepKey="addAllToCart"/>
63-
<waitForElementVisible stepKey="waitForErrorAppears" selector="{{StorefrontMessagesSection.error}}"/>
6460

6561
<!--Assert Correct Error Message-->
66-
<see userInput="You need to choose options for your item for" stepKey="assertCorrectErrorMessage"/>
67-
<dontSee userInput="1 product(s) have been added to shopping cart" stepKey="dontSeeSuccessMessage"/>
62+
<see userInput="This is a required field" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" stepKey="seeError"/>
6863
</test>
6964
</tests>

app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,15 @@ define([
154154
$.each(elementValue, function (key, option) {
155155
data[elementName + '[' + option + ']'] = option;
156156
});
157-
} else {
158-
if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq, max-depth
159-
elementName = elementName.substring(0, elementName.length - 2);
157+
} else if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq, max-depth
158+
elementName = elementName.substring(0, elementName.length - 2);
160159

161-
data[elementName + '[' + elementValue + ']'] = elementValue;
162-
} else {
163-
data[elementName] = elementValue;
164-
}
160+
data[elementName + '[' + elementValue + ']'] = elementValue;
161+
} else {
162+
data[elementName] = elementValue;
165163
}
166164

165+
167166
return data;
168167
},
169168

0 commit comments

Comments
 (0)