Skip to content

Commit

Permalink
Merge pull request #4790 from magento-tsg/2.3-develop-pr77
Browse files Browse the repository at this point in the history
[TSG] Fixes for 2.3 (pr77) (2.3-develop)
  • Loading branch information
zakdma authored Sep 17, 2019
2 parents 56003dd + 70585e6 commit e93feb0
Show file tree
Hide file tree
Showing 18 changed files with 570 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontSortBundleProductsByPriceTest">
<annotations>
<features value="Bundle"/>
<stories value="Bundle products list on Storefront"/>
<title value="Customer should be able to sort bundle products by price when viewing products list"/>
<description value="Customer should be able to sort bundle products by price when viewing products list"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-228"/>
<group value="bundle"/>
</annotations>
<before>
<!-- Create category -->
<createData entity="SimpleSubCategory" stepKey="createCategory"/>

<!-- Create simple products for first bundle product -->
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct">
<field key="price">100.00</field>
</createData>
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/>

<!-- Create first bundle product -->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createFirstBundleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="DropDownBundleOption" stepKey="firstProductBundleOption">
<requiredEntity createDataKey="createFirstBundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createFirstBundleLink">
<requiredEntity createDataKey="createFirstBundleProduct"/>
<requiredEntity createDataKey="firstProductBundleOption"/>
<requiredEntity createDataKey="createFirstSimpleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createSecondBundleLink">
<requiredEntity createDataKey="createFirstBundleProduct"/>
<requiredEntity createDataKey="firstProductBundleOption"/>
<requiredEntity createDataKey="createSecondSimpleProduct"/>
</createData>

<!-- Create simple products for second bundle product -->
<createData entity="SimpleProduct2" stepKey="createFirstProduct">
<field key="price">10.00</field>
</createData>
<createData entity="SimpleProduct2" stepKey="createSecondProduct"/>

<!-- Create second bundle product -->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createSecondBundleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="DropDownBundleOption" stepKey="secondProductBundleOption">
<requiredEntity createDataKey="createSecondBundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createBundleLinkFirst">
<requiredEntity createDataKey="createSecondBundleProduct"/>
<requiredEntity createDataKey="secondProductBundleOption"/>
<requiredEntity createDataKey="createFirstProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createBundleLinkSecond">
<requiredEntity createDataKey="createSecondBundleProduct"/>
<requiredEntity createDataKey="secondProductBundleOption"/>
<requiredEntity createDataKey="createSecondProduct"/>
</createData>

<!-- Create simple products for third bundle product -->
<createData entity="SimpleProduct2" stepKey="createFirstProductForBundle"/>
<createData entity="SimpleProduct2" stepKey="createSecondProductForBundle">
<field key="price">500.00</field>
</createData>

<!-- Create third bundle product -->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createThirdBundleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="DropDownBundleOption" stepKey="createThirdProductBundleOption">
<requiredEntity createDataKey="createThirdBundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createBundleFirstLink">
<requiredEntity createDataKey="createThirdBundleProduct"/>
<requiredEntity createDataKey="createThirdProductBundleOption"/>
<requiredEntity createDataKey="createFirstProductForBundle"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createBundleSecondLink">
<requiredEntity createDataKey="createThirdBundleProduct"/>
<requiredEntity createDataKey="createThirdProductBundleOption"/>
<requiredEntity createDataKey="createSecondProductForBundle"/>
</createData>

<!-- Perform CLI reindex -->
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
</before>
<after>
<!-- Delete all created data -->
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
<deleteData createDataKey="createFirstBundleProduct" stepKey="deleteFirstBundleProduct"/>
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
<deleteData createDataKey="createSecondBundleProduct" stepKey="deleteSecondBundleProduct"/>
<deleteData createDataKey="createFirstProductForBundle" stepKey="deleteFirstProductForBundle"/>
<deleteData createDataKey="createSecondProductForBundle" stepKey="deleteSecondProductForBundle"/>
<deleteData createDataKey="createThirdBundleProduct" stepKey="deleteThirdBundleProduct"/>
</after>

<!-- Open created category on Storefront -->
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
<argument name="categoryName" value="$$createCategory.name$$"/>
</actionGroup>

<!-- Assert first bundle products in category product grid -->
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertFirstBundleProduct">
<argument name="product" value="$$createFirstBundleProduct$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForFirstBundleProduct">
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createFirstBundleProduct.id$$)}}"/>
<argument name="userInput" value="From $100.00"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForFirstBundleProduct">
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createFirstBundleProduct.id$$)}}"/>
<argument name="userInput" value="To $123.00"/>
</actionGroup>

<!-- Assert second bundle products in category product grid -->
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertSecondBundleProduct">
<argument name="product" value="$$createSecondBundleProduct$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForSecondBundleProduct">
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createSecondBundleProduct.id$$)}}"/>
<argument name="userInput" value="From $10.00"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForSecondBundleProduct">
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createSecondBundleProduct.id$$)}}"/>
<argument name="userInput" value="To $123.00"/>
</actionGroup>

<!-- Assert third bundle products in category product grid -->
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertThirdBundleProduct">
<argument name="product" value="$$createThirdBundleProduct$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForThirdBundleProduct">
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createThirdBundleProduct.id$$)}}"/>
<argument name="userInput" value="From $123.00"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForThirdBundleProduct">
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createThirdBundleProduct.id$$)}}"/>
<argument name="userInput" value="To $500.00"/>
</actionGroup>

<!-- Switch category view to List mode -->
<actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/>

<!-- Sort products By Price -->
<actionGroup ref="StorefrontCategoryPageSortProductActionGroup" stepKey="sortProductByPrice"/>
<!-- Set Ascending Direction -->
<actionGroup ref="StorefrontCategoryPageSortAscendingActionGroup" stepKey="setAscendingDirection"/>

<!-- Assert new products positions -->
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductFirstPosition">
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('1')}}"/>
<argument name="userInput" value="$$createThirdBundleProduct.name$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductSecondPosition">
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('2')}}"/>
<argument name="userInput" value="$$createFirstBundleProduct.name$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductThirdPosition">
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('3')}}"/>
<argument name="userInput" value="$$createSecondBundleProduct.name$$"/>
</actionGroup>

<!-- Set Descending Direction -->
<actionGroup ref="StorefrontCategoryPageSortDescendingActionGroup" stepKey="setDescendingDirection"/>

<!-- Assert new products positions -->
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewFirstPosition">
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('1')}}"/>
<argument name="userInput" value="$$createSecondBundleProduct.name$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewSecondPosition">
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('2')}}"/>
<argument name="userInput" value="$$createFirstBundleProduct.name$$"/>
</actionGroup>
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewThirdPosition">
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('3')}}"/>
<argument name="userInput" value="$$createThirdBundleProduct.name$$"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
<seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/>
</actionGroup>

<actionGroup name="AssertProductOnCategoryPageActionGroup" extends="StorefrontCheckCategorySimpleProduct">
<annotations>
<description>EXTENDS:StorefrontCheckCategorySimpleProduct. Removes 'AssertProductPrice', 'moveMouseOverProduct', 'AssertAddToCart'</description>
</annotations>
<remove keyForRemoval="AssertProductPrice"/>
<remove keyForRemoval="moveMouseOverProduct"/>
<remove keyForRemoval="AssertAddToCart"/>
</actionGroup>

<actionGroup name="StorefrontCheckAddToCartButtonAbsence">
<arguments>
<argument name="product" defaultValue="_defaultProduct"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontCategoryPageSortProductActionGroup">
<annotations>
<description>Select "Sort by" parameter for sorting Products on Category page</description>
</annotations>
<arguments>
<argument name="sortBy" type="string" defaultValue="Price"/>
</arguments>
<selectOption selector="{{StorefrontCategoryTopToolbarSection.sortByDropdown}}" userInput="{{sortBy}}" stepKey="selectSortByParameter"/>
</actionGroup>
<actionGroup name="StorefrontCategoryPageSortAscendingActionGroup">
<annotations>
<description>Set Ascending Direction for sorting Products on Category page</description>
</annotations>
<click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionAsc}}" stepKey="setAscendingDirection"/>
</actionGroup>
<actionGroup name="StorefrontCategoryPageSortDescendingActionGroup">
<annotations>
<description>Set Descending Direction for sorting Products on Category page</description>
</annotations>
<click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionDesc}}" stepKey="setDescendingDirection"/>
</actionGroup>
</actionGroups>
5 changes: 0 additions & 5 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,6 @@
<requiredEntity type="product_option">ProductOptionArea</requiredEntity>
<requiredEntity type="product_option">ProductOptionFile</requiredEntity>
</entity>
<entity name="ProductFileOptionWithScriptTag" type="product">
<var key="sku" entityType="product" entityKey="sku"/>
<data key="file">&lt;img src=x onerror='alert("XSS without &lt;script&gt;&lt;:script&gt; tags...")'&gt;.png</data>
<requiredEntity type="product_option">ProductOptionFile</requiredEntity>
</entity>
<entity name="ApiVirtualProductWithDescription" type="product">
<data key="sku" unique="suffix">api-virtual-product</data>
<data key="type_id">virtual</data>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<element name="variationLabel" type="text" selector="//div[@data-index='configurable-matrix']/label"/>
<element name="stepsWizardTitle" type="text" selector="div.content:not([style='display: none;']) .steps-wizard-title"/>
<element name="attributeEntityByName" type="text" selector="//div[@class='attribute-entity']//div[normalize-space(.)='{{attributeLabel}}']" parameterized="true"/>
<element name="fileUploaderInput" type="file" selector="//input[@type='file' and @class='file-uploader-input']" />
<element name="variationImageSource" type="text" selector="[data-index='configurable-matrix'] [data-index='thumbnail_image_container'] img[src*='{{imageName}}']" parameterized="true"/>
<element name="variationProductLinkByName" type="text" selector="//div[@data-index='configurable-matrix']//*[@data-index='name_container']//a[contains(text(), '{{productName}}')]" parameterized="true"/>
</section>
Expand Down
Loading

0 comments on commit e93feb0

Please sign in to comment.