|
| 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="AddToCartRelatedProductsTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Promote Products as Related Products"/> |
| 15 | + <title value="Assert that only visible related product will be added to the cart from PDP when 'select all' used"/> |
| 16 | + <description value="When the number of assigned related products exceeds the number of Related Products to show on PDP an 'select all' used, only visible products should be added to a cart"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-3172"/> |
| 19 | + <useCaseId value="ACP2E-853"/> |
| 20 | + <group value="Catalog"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <magentoCLI command="config:set {{CatalogMaximumNumberOfProductsInRelatedProductsList.path}} 1" stepKey="customLimitForRelatedProducts"/> |
| 24 | + <createData entity="SimpleSubCategory" stepKey="category1"/> |
| 25 | + <createData entity="_defaultProduct" stepKey="simpleProduct1"> |
| 26 | + <requiredEntity createDataKey="category1"/> |
| 27 | + </createData> |
| 28 | + <createData entity="_defaultProduct" stepKey="simpleProduct2"> |
| 29 | + <requiredEntity createDataKey="category1"/> |
| 30 | + </createData> |
| 31 | + <createData entity="_defaultProduct" stepKey="simpleProduct3"> |
| 32 | + <requiredEntity createDataKey="category1"/> |
| 33 | + </createData> |
| 34 | + |
| 35 | + <actionGroup ref="AdminLoginActionGroup" stepKey="logInAsAdmin"/> |
| 36 | + </before> |
| 37 | + <after> |
| 38 | + <magentoCLI command="config:set {{CatalogMaximumNumberOfProductsInRelatedProductsList.path}} {{CatalogMaximumNumberOfProductsInRelatedProductsList.value}}" |
| 39 | + stepKey="defaultLimitForRelatedProducts"/> |
| 40 | + |
| 41 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> |
| 42 | + |
| 43 | + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimp1"/> |
| 44 | + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimp2"/> |
| 45 | + <deleteData createDataKey="simpleProduct3" stepKey="deleteSimp3"/> |
| 46 | + <deleteData createDataKey="category1" stepKey="deleteCategory"/> |
| 47 | + </after> |
| 48 | + |
| 49 | + <!-- Assign related products to simpleProduct1 --> |
| 50 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProduct1"> |
| 51 | + <argument name="productId" value="$simpleProduct1.id$"/> |
| 52 | + </actionGroup> |
| 53 | + <click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> |
| 54 | + |
| 55 | + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addProduct2ToSimp1"> |
| 56 | + <argument name="sku" value="$simpleProduct2.sku$"/> |
| 57 | + </actionGroup> |
| 58 | + <actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addProduct3ToSimp1"> |
| 59 | + <argument name="sku" value="$simpleProduct3.sku$"/> |
| 60 | + </actionGroup> |
| 61 | + <actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSave"/> |
| 62 | + |
| 63 | + <!-- Go to the simpleProduct1 on storefrontend, select all visible related products, add to cart--> |
| 64 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductOnStorefront"> |
| 65 | + <argument name="product" value="$simpleProduct1$"/> |
| 66 | + </actionGroup> |
| 67 | + <waitForElementVisible selector="{{StorefrontProductRelatedProductsSection.relatedProductsListSectionText}}" stepKey="waitForRelatedProductsList"/> |
| 68 | + <click selector="{{StorefrontProductRelatedProductsSection.relatedProductsActionsHeaderBtn}}" stepKey="clickSelectAll"/> |
| 69 | + |
| 70 | + <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/> |
| 71 | + |
| 72 | + <!-- Check that cart page contains only 2 items --> |
| 73 | + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> |
| 74 | + <see selector="{{StorefrontMinicartSection.quantity}}" userInput="2" stepKey="seeCartQuantity"/> |
| 75 | + </test> |
| 76 | +</tests> |
0 commit comments