Skip to content

Commit b93aba6

Browse files
MacMac
authored andcommitted
Merge remote-tracking branch 'remotes/github/MAGETWO-95837' into EPAM-PR-28
2 parents 6615f86 + 29dafb5 commit b93aba6

File tree

2 files changed

+69
-11
lines changed

2 files changed

+69
-11
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="ConfProdAddToCartWishListWithUnselectedAttrTest">
11+
<annotations>
12+
<features value="Wishlist"/>
13+
<group value="wishlist"/>
14+
<title value="Adding configurable product to Cart from Wish List with unselected attributes"/>
15+
<description value="Verify adding configurable product to Cart from Wish List when attributes is unselected"/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="MAGETWO-95897"/>
18+
<useCaseId value="MAGETWO-95837"/>
19+
</annotations>
20+
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
23+
<createData entity="ApiCategory" stepKey="createCategory"/>
24+
<!--Create Configurable product-->
25+
<actionGroup ref="createConfigurableProduct" stepKey="createProduct">
26+
<argument name="product" value="_defaultProduct"/>
27+
<argument name="category" value="$$createCategory$$"/>
28+
</actionGroup>
29+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
30+
</before>
31+
<after>
32+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
33+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
34+
<!-- Delete the first simple product -->
35+
<actionGroup stepKey="deleteProduct1" ref="deleteProductBySku">
36+
<argument name="sku" value="{{_defaultProduct.sku}}"/>
37+
</actionGroup>
38+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}"
39+
dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
40+
<actionGroup ref="logout" stepKey="logout"/>
41+
</after>
42+
43+
<!--Login as customer -->
44+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
45+
<argument name="Customer" value="$$createCustomer$$"/>
46+
</actionGroup>
47+
<waitForPageLoad stepKey="waitForLogin"/>
48+
49+
<!--Go To Created Product Page-->
50+
<amOnPage stepKey="goToCreatedProductPage" url="{{_defaultProduct.urlKey}}.html"/>
51+
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
52+
53+
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="checkDropDownProductOption"/>
54+
<selectOption userInput="{{colorProductAttribute1.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption1"/>
55+
<selectOption userInput="{{colorProductAttribute2.name}}" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption2"/>
56+
<click selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" stepKey="clickDropDownProductOption"/>
57+
58+
<!--Click Add to Wish List link-->
59+
<click selector="{{StorefrontProductPageSection.addToWishlist}}" stepKey="addFirstPnroductToWishlist"/>
60+
61+
<!--Assert Correct Error Message-->
62+
<see userInput="This is a required field" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" stepKey="seeError"/>
63+
</test>
64+
</tests>

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,12 @@ define([
154154
$.each(elementValue, function (key, option) {
155155
data[elementName + '[' + option + ']'] = option;
156156
});
157+
} else if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq, max-depth
158+
elementName = elementName.substring(0, elementName.length - 2);
159+
160+
data[elementName + '[' + elementValue + ']'] = elementValue;
157161
} else {
158-
if (elementValue) { //eslint-disable-line no-lonely-if
159-
if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq, max-depth
160-
elementName = elementName.substring(0, elementName.length - 2);
161-
162-
if (elementValue) { //eslint-disable-line max-depth
163-
data[elementName + '[' + elementValue + ']'] = elementValue;
164-
}
165-
} else {
166-
data[elementName] = elementValue;
167-
}
168-
}
162+
data[elementName] = elementValue;
169163
}
170164

171165
return data;

0 commit comments

Comments
 (0)