|
| 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="AdminApplyTierPriceForConfigurableProdTest"> |
| 11 | + <annotations> |
| 12 | + <features value="ConfigurableProduct"/> |
| 13 | + <stories value="Create configurable product with tier price"/> |
| 14 | + <title value="admin should be able to create a configurable product with tier prices"/> |
| 15 | + <description value="admin should be able to create a configurable product with tier prices"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-4468"/> |
| 18 | + </annotations> |
| 19 | + <before> |
| 20 | + <!-- Login as Admin --> |
| 21 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/> |
| 22 | + <!-- Create Default Category --> |
| 23 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 24 | + <!-- Create an attribute with two options --> |
| 25 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 26 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 27 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 28 | + </createData> |
| 29 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> |
| 30 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 31 | + </createData> |
| 32 | + <!-- Add the attribute just created to default attribute set --> |
| 33 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 34 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 35 | + </createData> |
| 36 | + <!-- Get the first option of the attribute created --> |
| 37 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 38 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 39 | + </getData> |
| 40 | + <!-- Get the second option of the attribute created --> |
| 41 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> |
| 42 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 43 | + </getData> |
| 44 | + <!-- Create Configurable product --> |
| 45 | + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> |
| 46 | + <requiredEntity createDataKey="createCategory"/> |
| 47 | + </createData> |
| 48 | + <!-- Create a simple product and give it the attribute with the first option --> |
| 49 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> |
| 50 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 51 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 52 | + </createData> |
| 53 | + <!--Create a simple product and give it the attribute with the second option --> |
| 54 | + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> |
| 55 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 56 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 57 | + </createData> |
| 58 | + <!-- Create the configurable product --> |
| 59 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 60 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 61 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 62 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 63 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 64 | + </createData> |
| 65 | + <!-- Add the first simple product to the configurable product --> |
| 66 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 67 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 68 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 69 | + </createData> |
| 70 | + <!-- Add the second simple product to the configurable product --> |
| 71 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> |
| 72 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 73 | + <requiredEntity createDataKey="createConfigChildProduct2"/> |
| 74 | + </createData> |
| 75 | + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="openCreatedProductEditPage"> |
| 76 | + <argument name="product" value="$$createConfigChildProduct1$$"/> |
| 77 | + </actionGroup> |
| 78 | + <actionGroup ref="AdminProductFormOpenAdvancedPricingDialogActionGroup" stepKey="clickOnAdvancedPricingButton"/> |
| 79 | + <actionGroup ref="AdminProductFormAdvancedPricingAddTierPriceActionGroup" stepKey="selectProductTierPriceInput"> |
| 80 | + <argument name="quantity" value="2"/> |
| 81 | + <argument name="amount" value="45"/> |
| 82 | + </actionGroup> |
| 83 | + <actionGroup ref="AdminProductFormDoneAdvancedPricingDialogActionGroup" stepKey="clickDoneButton"/> |
| 84 | + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="54" stepKey="fillSimpleProductPrice"/> |
| 85 | + <actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="clickButtonSave"/> |
| 86 | + <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="openSecondCreatedProductEditPage"> |
| 87 | + <argument name="product" value="$$createConfigChildProduct2$$"/> |
| 88 | + </actionGroup> |
| 89 | + <actionGroup ref="AdminProductFormOpenAdvancedPricingDialogActionGroup" stepKey="againClickOnAdvancedPricingButton"/> |
| 90 | + <actionGroup ref="AdminProductFormAdvancedPricingAddTierPriceActionGroup" stepKey="selectTierPriceInput"> |
| 91 | + <argument name="quantity" value="2"/> |
| 92 | + <argument name="amount" value="34"/> |
| 93 | + </actionGroup> |
| 94 | + <actionGroup ref="AdminProductFormDoneAdvancedPricingDialogActionGroup" stepKey="clickDone"/> |
| 95 | + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="77" stepKey="fillSecondSimpleProductPrice"/> |
| 96 | + <actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="clickSave"/> |
| 97 | + </before> |
| 98 | + <after> |
| 99 | + <!-- Delete Created Data --> |
| 100 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 101 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 102 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> |
| 103 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> |
| 104 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> |
| 105 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 106 | + <argument name="indices" value=""/> |
| 107 | + </actionGroup> |
| 108 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 109 | + </after> |
| 110 | + <actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage"> |
| 111 | + <argument name="category" value="$createCategory$"/> |
| 112 | + </actionGroup> |
| 113 | + <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('54')}}" stepKey="assertProductPriceCategoryPage"/> |
| 114 | + <amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPageOnStorefront"/> |
| 115 | + <waitForPageLoad stepKey="waitForProductPage"/> |
| 116 | + <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('54')}}" stepKey="assertProductPricePage"/> |
| 117 | + <selectOption userInput="option1" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectOption"/> |
| 118 | + <waitForPageLoad stepKey="waitForOptionLoad"/> |
| 119 | + <see userInput="$54.00" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeFirstOptionPrice"/> |
| 120 | + <!-- Assert tier price in storefront product page --> |
| 121 | + <see selector="{{StorefrontProductInfoMainSection.tierPriceText}}" userInput="Buy 2 for $45.00 each and save 17%" stepKey="assertFirstTierPriceText"/> |
| 122 | + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product2AddToCart"/> |
| 123 | + <!-- option 2 --> |
| 124 | + <selectOption userInput="option2 +$23.00" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" stepKey="selectSecondOption"/> |
| 125 | + <waitForPageLoad stepKey="waitForSelectOption"/> |
| 126 | + <see userInput="$77.00" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeSecondOptionPrice"/> |
| 127 | + <!-- Assert tier price in storefront product page --> |
| 128 | + <see selector="{{StorefrontProductInfoMainSection.tierPriceText}}" userInput="Buy 2 for $34.00 each and save 56%" stepKey="assertSecondTierPriceText"/> |
| 129 | + <!--Add to cart --> |
| 130 | + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="secondProduct2AddToCart"/> |
| 131 | + <!--Click on mini cart--> |
| 132 | + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> |
| 133 | + <!--Click on view and edit cart link--> |
| 134 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMiniCart"/> |
| 135 | + <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> |
| 136 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> |
| 137 | + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$131.00" stepKey="assertSubtotal"/> |
| 138 | + <!-- Update products quantity --> |
| 139 | + <fillField selector="{{CheckoutCartProductSection.qty($$createConfigChildProduct1.sku$$)}}" userInput="2" stepKey="updateFirstProductQty"/> |
| 140 | + <fillField selector="{{CheckoutCartProductSection.qty($$createConfigChildProduct2.sku$$)}}" userInput="2" stepKey="updateSecondProductQty"/> |
| 141 | + <click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="clickUpdateShoppingCart"/> |
| 142 | + <waitForAjaxLoad stepKey="waitForAjaxLoad"/> |
| 143 | + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$158.00" stepKey="againAssertSubtotal"/> |
| 144 | + </test> |
| 145 | +</tests> |
0 commit comments