From 66b7785aebd4e4570d789a308f6d40387cc56053 Mon Sep 17 00:00:00 2001 From: rani-webkul Date: Wed, 18 Sep 2019 09:50:50 +0530 Subject: [PATCH] fixed getting error in console while selecting all downloadable links #24633 added MFTF test --- .../StorefrontDownloadableProductSection.xml | 1 + ...wnloadableLinksDownloadableProductTest.xml | 101 ++++++++++++++++++ .../view/frontend/web/js/add-to-wishlist.js | 4 +- 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml diff --git a/app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableProductSection.xml b/app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableProductSection.xml index 543aea7d8297f..20b62ef060309 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableProductSection.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableProductSection.xml @@ -14,5 +14,6 @@ + diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml new file mode 100644 index 0000000000000..94940f0e08195 --- /dev/null +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml @@ -0,0 +1,101 @@ + + + + + + + + + + <description value="All the downloadable links must be selected or unselected when anyone click on select all or unselect all checkbox respectively."/> + <severity value="MAJOR"/> + <group value="Downloadable"/> + </annotations> + <before> + <!-- Create category --> + <createData entity="SimpleSubCategory" stepKey="createCategory"/> + + <!-- Login as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + + <!-- Create downloadable product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> + <waitForPageLoad stepKey="waitForProductGridPageLoad"/> + <actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createProduct"> + <argument name="productType" value="downloadable"/> + </actionGroup> + + <!-- Fill downloadable product values --> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillDownloadableProductForm"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + + <!-- Add downloadable product to category --> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" + parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/> + + <!-- Fill downloadable link information before the creation link --> + <actionGroup ref="AdminAddDownloadableLinkInformationActionGroup" stepKey="addDownloadableLinkInformation"/> + + <!-- Links can be purchased separately --> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" + stepKey="checkOptionPurchaseSeparately"/> + + <!-- Add first downloadable link --> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addFirstDownloadableProductLink"> + <argument name="link" value="downloadableLinkWithMaxDownloads"/> + </actionGroup> + + <!-- Add second downloadable link --> + <actionGroup ref="addDownloadableProductLink" stepKey="addSecondDownloadableProductLink"> + <argument name="link" value="downloadableLink"/> + </actionGroup> + + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + </before> + <after> + <!-- Delete category --> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + + <!-- Delete created downloadable product --> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + + <!-- Log out --> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!-- Step 1: Navigate to store front Product page as guest --> + <amOnPage url="/{{DownloadableProduct.sku}}.html" + stepKey="amOnStorefrontProductPage"/> + + <!-- Step 2: click on select all checkbox --> + <click + selector="{{StorefrontDownloadableProductSection.downloadableLinkSelectAllCheckbox}}" + stepKey="selectAllProductLink"/> + + <!-- Step 3: Make sure that all product links are checked --> + <seeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLinkWithMaxDownloads.title)}}" stepKey="seeFirstCheckboxChecked"/> + + <seeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLink.title)}}" stepKey="seeSecondCheckboxChecked"/> + + <!-- Step 4: click again on select all checkbox --> + <click + selector="{{StorefrontDownloadableProductSection.downloadableLinkSelectAllCheckbox}}" + stepKey="unselectAllProductLink"/> + + <!-- Step 5: Make sure that all product links are unchecked --> + <dontSeeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLinkWithMaxDownloads.title)}}" stepKey="seeFirstCheckboxUnChecked"/> + + <dontSeeCheckboxIsChecked selector="{{StorefrontDownloadableProductSection.downloadableLinkByTitle(downloadableLink.title)}}" stepKey="seeSecondCheckboxUnChecked"/> + + </test> +</tests> diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js index 033e2e43a3c22..aca843872af65 100644 --- a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js @@ -79,7 +79,9 @@ define([ $(element).is('textarea') || $('#' + element.id + ' option:selected').length ) { - dataToAdd = $.extend({}, dataToAdd, self._getElementData(element)); + if ($(element).data('selector') || $(element).attr('name')) { + dataToAdd = $.extend({}, dataToAdd, self._getElementData(element)); + } return; }