|
| 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 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 9 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="StorefrontAddConfigurableProductToShoppingCartTest"> |
| 11 | + <annotations> |
| 12 | + <stories value="Shopping Cart"/> |
| 13 | + <title value="Create configurable product with three options and add configurable product to the cart"/> |
| 14 | + <description value="Create configurable product with three options and add configurable product to the cart"/> |
| 15 | + <testCaseId value="MC-14716"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <group value="mtf_migrated"/> |
| 18 | + </annotations> |
| 19 | + |
| 20 | + <before> |
| 21 | + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> |
| 22 | + <magentoCLI command="config:set {{EnableFlatRateDefaultPriceConfigData.path}} {{EnableFlatRateDefaultPriceConfigData.value}}" stepKey="enableFlatRatePrice"/> |
| 23 | + <magentoCLI command="config:set {{EnableFlatRateToAllAllowedCountriesConfigData.path}} {{EnableFlatRateToAllAllowedCountriesConfigData.value}}" stepKey="allowFlatRateToAllCountries"/> |
| 24 | + <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShipping"/> |
| 25 | + |
| 26 | + <!-- Create Default Category --> |
| 27 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 28 | + |
| 29 | + <!-- Create an attribute with three options to be used in the first child product --> |
| 30 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 31 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 32 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 33 | + </createData> |
| 34 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> |
| 35 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 36 | + </createData> |
| 37 | + <createData entity="productAttributeOption3" stepKey="createConfigProductAttributeOption3"> |
| 38 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 39 | + </createData> |
| 40 | + |
| 41 | + <!-- Add the attribute just created to default attribute set --> |
| 42 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 43 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 44 | + </createData> |
| 45 | + |
| 46 | + <!-- Get the first option of the attribute created --> |
| 47 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 48 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 49 | + </getData> |
| 50 | + |
| 51 | + <!-- Get the second option of the attribute created --> |
| 52 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> |
| 53 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 54 | + </getData> |
| 55 | + |
| 56 | + <!-- Get the third option of the attribute created --> |
| 57 | + <getData entity="ProductAttributeOptionGetter" index="3" stepKey="getConfigAttributeOption3"> |
| 58 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 59 | + </getData> |
| 60 | + |
| 61 | + <!-- Create Configurable product --> |
| 62 | + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> |
| 63 | + <requiredEntity createDataKey="createCategory"/> |
| 64 | + </createData> |
| 65 | + |
| 66 | + <!-- Create a simple product and give it the attribute with the first option --> |
| 67 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> |
| 68 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 69 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 70 | + <field key="price">10.00</field> |
| 71 | + </createData> |
| 72 | + |
| 73 | + <!--Create a simple product and give it the attribute with the second option --> |
| 74 | + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> |
| 75 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 76 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 77 | + <field key="price">20.00</field> |
| 78 | + </createData> |
| 79 | + |
| 80 | + <!--Create a simple product and give it the attribute with the Third option --> |
| 81 | + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct3"> |
| 82 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 83 | + <requiredEntity createDataKey="getConfigAttributeOption3"/> |
| 84 | + <field key="price">30.00</field> |
| 85 | + </createData> |
| 86 | + |
| 87 | + <!-- Create the configurable product --> |
| 88 | + <createData entity="ConfigurableProductThreeOptions" stepKey="createConfigProductOption"> |
| 89 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 90 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 91 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 92 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 93 | + <requiredEntity createDataKey="getConfigAttributeOption3"/> |
| 94 | + </createData> |
| 95 | + |
| 96 | + <!-- Add the first simple product to the configurable product --> |
| 97 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 98 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 99 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 100 | + </createData> |
| 101 | + |
| 102 | + <!-- Add the second simple product to the configurable product --> |
| 103 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> |
| 104 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 105 | + <requiredEntity createDataKey="createConfigChildProduct2"/> |
| 106 | + </createData> |
| 107 | + |
| 108 | + <!-- Add the third simple product to the configurable product --> |
| 109 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild3"> |
| 110 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 111 | + <requiredEntity createDataKey="createConfigChildProduct3"/> |
| 112 | + </createData> |
| 113 | + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> |
| 114 | + <comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/> |
| 115 | + </before> |
| 116 | + <after> |
| 117 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteSimpleProduct1"/> |
| 118 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteSimpleProduct2"/> |
| 119 | + <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteSimpleProduct3"/> |
| 120 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> |
| 121 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 122 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> |
| 123 | + |
| 124 | + <!-- Reindex invalidated indices after product attribute has been created/deleted --> |
| 125 | + <magentoCron groups="index" stepKey="reindexInvalidatedIndices"/> |
| 126 | + </after> |
| 127 | + |
| 128 | + <!-- Add Configurable Product to the cart --> |
| 129 | + <actionGroup ref="StorefrontAddConfigurableProductToTheCartActionGroup" stepKey="addConfigurableProductToCart"> |
| 130 | + <argument name="urlKey" value="$$createConfigProduct.custom_attributes[url_key]$$" /> |
| 131 | + <argument name="productAttribute" value="$$createConfigProductAttribute.default_value$$"/> |
| 132 | + <argument name="productOption" value="$$getConfigAttributeOption2.label$$"/> |
| 133 | + <argument name="qty" value="2"/> |
| 134 | + </actionGroup> |
| 135 | + |
| 136 | + <!-- Select Mini Cart and select 'View And Edit Cart' --> |
| 137 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="selectViewAndEditCart"/> |
| 138 | + |
| 139 | + <!--Assert Shopping Cart Summary --> |
| 140 | + <actionGroup ref="AssertStorefrontShoppingCartSummaryWithShippingActionGroup" stepKey="AssertCartSummary" > |
| 141 | + <argument name="subtotal" value="$40.00"/> |
| 142 | + <argument name="shipping" value="10.00"/> |
| 143 | + <argument name="total" value="50.00"/> |
| 144 | + </actionGroup> |
| 145 | + |
| 146 | + <!--Assert Product Details In Checkout cart --> |
| 147 | + <actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertProductItemInCheckOutCart"> |
| 148 | + <argument name="productName" value="$$createConfigProduct.name$$"/> |
| 149 | + <argument name="productSku" value="$$createConfigChildProduct2.sku$$"/> |
| 150 | + <argument name="productPrice" value="$$createConfigChildProduct2.price$$"/> |
| 151 | + <argument name="subtotal" value="$40.00" /> |
| 152 | + <argument name="qty" value="2"/> |
| 153 | + </actionGroup> |
| 154 | + <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductOptionInCart"> |
| 155 | + <argument name="selector" value="{{CheckoutCartProductSection.productOptionLabel}}"/> |
| 156 | + <argument name="userInput" value="$$getConfigAttributeOption2.label$$"/> |
| 157 | + </actionGroup> |
| 158 | + |
| 159 | + <!-- Assert product details in Mini Cart --> |
| 160 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> |
| 161 | + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="assertMiniCart"> |
| 162 | + <argument name="productName" value="$$createConfigProduct.name$$"/> |
| 163 | + <argument name="productPrice" value="$$createConfigChildProduct2.price$$"/> |
| 164 | + <argument name="cartSubtotal" value="$40.00" /> |
| 165 | + <argument name="qty" value="2"/> |
| 166 | + </actionGroup> |
| 167 | + </test> |
| 168 | +</tests> |
0 commit comments