Skip to content

Commit 66b7785

Browse files
author
rani-webkul
committed
fixed getting error in console while selecting all downloadable links #24633
added MFTF test
1 parent 9b2cefd commit 66b7785

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="downloadableLinkByTitle" type="input" selector="//*[@id='downloadable-links-list']/*[contains(.,'{{title}}')]//input" parameterized="true" timeout="30"/>
1515
<element name="downloadableLinkSampleByTitle" type="text" selector="//label[contains(., '{{title}}')]/a[contains(@class, 'sample link')]" parameterized="true"/>
1616
<element name="downloadableSampleLabel" type="text" selector="//a[contains(.,normalize-space('{{title}}'))]" parameterized="true" timeout="30"/>
17+
<element name="downloadableLinkSelectAllCheckbox" type="checkbox" selector="#links_all" />
1718
</section>
1819
</sections>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="SelectAllDownloadableLinksDownloadableProductTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Create Downloadable Product"/>
15+
<title value="Select all downloadable links downloadable product test"/>
16+
<description value="All the downloadable links must be selected or unselected when anyone click on select all or unselect all checkbox respectively."/>
17+
<severity value="MAJOR"/>
18+
<group value="Downloadable"/>
19+
</annotations>
20+
<before>
21+
<!-- Create category -->
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
24+
<!-- Login as admin -->
25+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
26+
27+
<!-- Create downloadable product -->
28+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/>
29+
<waitForPageLoad stepKey="waitForProductGridPageLoad"/>
30+
<actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct">
31+
<argument name="productType" value="downloadable"/>
32+
</actionGroup>
33+
34+
<!-- Fill downloadable product values -->
35+
<actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm">
36+
<argument name="product" value="DownloadableProduct"/>
37+
</actionGroup>
38+
39+
<!-- Add downloadable product to category -->
40+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}"
41+
parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/>
42+
43+
<!-- Fill downloadable link information before the creation link -->
44+
<actionGroup ref="AdminAddDownloadableLinkInformationActionGroup" stepKey="addDownloadableLinkInformation"/>
45+
46+
<!-- Links can be purchased separately -->
47+
<checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}"
48+
stepKey="checkOptionPurchaseSeparately"/>
49+
50+
<!-- Add first downloadable link -->
51+
<actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink">
52+
<argument name="link" value="downloadableLinkWithMaxDownloads"/>
53+
</actionGroup>
54+
55+
<!-- Add second downloadable link -->
56+
<actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink">
57+
<argument name="link" value="downloadableLink"/>
58+
</actionGroup>
59+
60+
<!-- Save product -->
61+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
62+
</before>
63+
<after>
64+
<!-- Delete category -->
65+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
66+
67+
<!-- Delete created downloadable product -->
68+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
69+
<argument name="product" value="DownloadableProduct"/>
70+
</actionGroup>
71+
72+
<!-- Log out -->
73+
<actionGroup ref="logout" stepKey="logout"/>
74+
</after>
75+
76+
<!-- Step 1: Navigate to store front Product page as guest -->
77+
<amOnPage url="/{{DownloadableProduct.sku}}.html"
78+
stepKey="amOnStorefrontProductPage"/>
79+
80+
<!-- Step 2: click on select all checkbox -->
81+
<click
82+
selector="{{StorefrontDownloadableProductSection.downloadableLinkSelectAllCheckbox}}"
83+
stepKey="selectAllProductLink"/>
84+
85+
<!-- Step 3: Make sure that all product links are checked -->
86+
<seeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLinkWithMaxDownloads.title)}}" stepKey="seeFirstCheckboxChecked"/>
87+
88+
<seeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLink.title)}}" stepKey="seeSecondCheckboxChecked"/>
89+
90+
<!-- Step 4: click again on select all checkbox -->
91+
<click
92+
selector="{{StorefrontDownloadableProductSection.downloadableLinkSelectAllCheckbox}}"
93+
stepKey="unselectAllProductLink"/>
94+
95+
<!-- Step 5: Make sure that all product links are unchecked -->
96+
<dontSeeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLinkWithMaxDownloads.title)}}" stepKey="seeFirstCheckboxUnChecked"/>
97+
98+
<dontSeeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLink.title)}}" stepKey="seeSecondCheckboxUnChecked"/>
99+
100+
</test>
101+
</tests>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ define([
7979
$(element).is('textarea') ||
8080
$('#' + element.id + ' option:selected').length
8181
) {
82-
dataToAdd = $.extend({}, dataToAdd, self._getElementData(element));
82+
if ($(element).data('selector') || $(element).attr('name')) {
83+
dataToAdd = $.extend({}, dataToAdd, self._getElementData(element));
84+
}
8385

8486
return;
8587
}

0 commit comments

Comments
 (0)