Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into 2.4-develop
  • Loading branch information
mage-os-ci committed Nov 11, 2024
2 parents 17e9050 + 0b488dd commit d451846
Show file tree
Hide file tree
Showing 46 changed files with 1,077 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontVerifyDiscountOnDynamicBundleProductDifferentCartRulesTest">
<annotations>
<features value="Bundle"/>
<stories value="Discount on dynamic bundle products with different Cart Rules"/>
<title value="Verify dynamic bundle product prices with different Cart Rules on storefront"/>
<description value="Verify discount on dynamic-priced Bundle Product when associated Products are assigned to Categories with different Cart Rules"/>
<severity value="MAJOR"/>
<testCaseId value="AC-4709"/>
</annotations>
<before>
<createData entity="SimpleSubCategory" stepKey="createFirstCategory"/>
<createData entity="SimpleSubCategory" stepKey="createSecondCategory"/>
<!--Create two simple product-->
<createData entity="ApiSimpleProduct" stepKey="simpleProduct1">
<requiredEntity createDataKey="createFirstCategory"/>
<field key="price">99.99</field>
</createData>
<createData entity="ApiSimpleProduct" stepKey="simpleProduct2">
<requiredEntity createDataKey="createSecondCategory"/>
<field key="price">34.49</field>
</createData>
<!--Create Bundle product-->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
<requiredEntity createDataKey="createFirstCategory"/>
</createData>
<createData entity="MultipleSelectOption" stepKey="createBundleOption1">
<requiredEntity createDataKey="createBundleProduct"/>
<field key="required">true</field>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1"/>
<requiredEntity createDataKey="simpleProduct1"/>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1"/>
<requiredEntity createDataKey="simpleProduct2"/>
</createData>
</before>
<after>
<deleteData createDataKey="createFirstCategory" stepKey="deleteFirstCategory"/>
<deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule">
<argument name="ruleName" value="{{CustomSalesRuleWithNoCouponCode.name}}"/>
</actionGroup>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<!-- Create cart price rule -->
<actionGroup ref="AdminCreateCartPriceRuleActionGroup" stepKey="createCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode"/>
</actionGroup>
<!-- Search and go to cart price rule page -->
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCreatedCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
</actionGroup>
<actionGroup ref="AdminCreateCustomConditionInCartPriceRuleActionGroup" stepKey="createCustomCondition"/>
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveAndAssertCartPriceRuleSuccessSaveMessage"/>
<!-- Open Bundle Product page on storefront-->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage">
<argument name="productUrl" value="$createBundleProduct.custom_attributes[url_key]$"/>
</actionGroup>
<!-- Click on customize And Add To Cart Button -->
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickOnCustomizeAndAddToCartButton"/>
<!-- Select Two Products, enter the quantity and add product to the cart -->
<selectOption selector="{{StorefrontBundledSection.multiSelectOption}}" parameterArray="[$$simpleProduct1.name$$ +$99.99, $$simpleProduct2.name$$ +$34.49]" stepKey="selectOptions"/>
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
<argument name="quantity" value="1"/>
</actionGroup>
<!-- Go to shopping cart page -->
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
<argument name="discount" value="13.45"/>
</actionGroup>
<!-- Search and go to cart price rule page and remove condition-->
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="goToCartPriceRulePage"/>
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
</actionGroup>
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
<waitForElementClickable selector="{{AdminCartPriceRulesFormSection.removeCondition('1--1')}}" stepKey="waitForRemoveToBeClickable"/>
<click selector="{{AdminCartPriceRulesFormSection.removeCondition('1--1')}}" stepKey="removeCondition"/>
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveCartPriceRuleSuccessSaveMessage"/>
<!-- Go to shopping cart page -->
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToShoppingCartPage"/>
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="checkDiscount">
<argument name="discount" value="13.45"/>
</actionGroup>
<!-- Assign category 1 to simple product 2 and unAssign category2 -->
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="OpenSimpleProductPage">
<argument name="productId" value="$$simpleProduct2.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unAssignCategoryTwo">
<argument name="categoryName" value="$$createSecondCategory.name$$"/>
</actionGroup>
<createData entity="AssignProductToCategory" stepKey="assignCategoryOne">
<requiredEntity createDataKey="createFirstCategory"/>
<requiredEntity createDataKey="simpleProduct2"/>
</createData>
<!-- Search and go to cart price rule page and add condition in action tab -->
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="againOpenCartPriceRulePage"/>
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="againFilterCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
</actionGroup>
<actionGroup ref="AdminCreateCustomConditionInActionTabInCartPriceRuleActionGroup" stepKey="createConditionInActionsTab"/>
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveCartPriceRule"/>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule"/>
</actionGroup>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
<argument name="tags" value="config full_page"/>
</actionGroup>
<!-- Go to shopping cart page -->
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="againGoToShoppingCartPage"/>
<waitForElementNotVisible selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="discountIsNotApplied"/>
</test>
</tests>
30 changes: 28 additions & 2 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

Expand Down Expand Up @@ -325,6 +325,19 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
</entity>
<entity name="ApiSimpleOne1" type="product2">
<data key="name" unique="suffix">Api Simple Product</data>
<data key="sku" unique="suffix">api-simple-product</data>
<data key="urlKey" unique="suffix">api-simple-product</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="price">1</data>
<data key="status">1</data>
<data key="quantity">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
</entity>
<entity name="ApiSimpleProductWithCategory" type="product2" extends="ApiSimpleOne">
<requiredEntity type="custom_attribute">CustomAttributeCategoryIds</requiredEntity>
</entity>
Expand Down Expand Up @@ -357,6 +370,19 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
</entity>
<entity name="ApiSimpleTwo1" type="product2">
<data key="name" unique="suffix">Api Simple Product Two</data>
<data key="sku" unique="suffix">api-simple-product-two</data>
<data key="urlKey" unique="suffix">api-simple-product-two</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="price">1</data>
<data key="status">1</data>
<data key="quantity">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
</entity>
<entity name="ApiSimpleProductWithPrice50" type="product2" extends="ApiSimpleOne">
<data key="price">50</data>
</entity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down Expand Up @@ -50,6 +52,12 @@
</actionGroup>
<actionGroup ref="AssertStorefrontCustomOptionCheckboxByPriceActionGroup" stepKey="checkPriceProductOptionUSD">
<argument name="price" value="12.3"/>
</actionGroup>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexConfig">
<argument name="indices" value=""/>
</actionGroup>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCache">
<argument name="tags" value="config full_page"/>
</actionGroup>
<actionGroup ref="StorefrontSwitchCurrencyActionGroup" stepKey="switchEURCurrency">
<argument name="currency" value="EUR"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminFillTermsAndConditionsCustomStoreViewActionGroup" extends="AdminTermsConditionsFillTermEditFormActionGroup">
<arguments>
<argument name="storeView" type="string" defaultValue="customStoreEN.name"/>
</arguments>

<remove keyForRemoval="selectOptionStoreView"/>
<selectOption selector="{{AdminNewTermFormSection.storeView}}" userInput="{{storeView}}" stepKey="selectOptionStoreView" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontTermInCheckoutAndPlaceOrderActionGroup">
<arguments>
<argument name="termCheckboxText" type="string"/>
</arguments>
<!--Check if agreement is present on checkout and select it-->
<scrollTo selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementBlock}}" stepKey="scrollToCheckoutAgreementBlock"/>
<waitForElementClickable selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementBlock}}" stepKey="waitForCheckoutAgreementBlockToBeClickable"/>
<click selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementBlock}}" stepKey="clickCheckoutAgreementBlock"/>
<waitForElementClickable selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementCheckbox}}" stepKey="waitForCheckAgreementToBeClickable"/>
<selectOption selector="{{StorefrontCheckoutAgreementsSection.checkoutAgreementCheckboxInput}}" userInput="{{termCheckboxText}}" stepKey="checkAgreement"/>
<!--Checkout select Check/Money Order payment-->
<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForElementClickable selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="waitForPlaceOrderButtonClickable"/>
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
<waitForPageLoad stepKey="waitForOrderPlaced"/>
</actionGroup>
</actionGroups>
12 changes: 10 additions & 2 deletions app/code/Magento/CheckoutAgreements/Test/Mftf/Data/TermData.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

Expand Down Expand Up @@ -53,6 +53,14 @@
<data key="checkboxText" unique="suffix">test_checkbox</data>
<data key="content" unique="suffix">TestMessage</data>
</entity>
<entity name="enableTextTerm" type="term">
<data key="name">Test Condition</data>
<data key="isActive">Enabled</data>
<data key="isHtml">Text</data>
<data key="mode">Manually</data>
<data key="checkboxText">Terms and Conditions</data>
<data key="content">terms text</data>
</entity>
<entity name="enableTermsAndConditions" type="term">
<data key="path">checkout/options/enable_agreements</data>
<data key="value">1</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontCheckoutAgreementsSection">
<element name="checkoutAgreementCheckboxInput" type="checkbox" selector="input#agreement_checkmo_3.required-entry"/>
<element name="checkoutAgreementBlock" type="checkbox" selector=".checkout-agreements-block"/>
<element name="checkoutAgreementCheckbox" type="checkbox" selector="div.checkout-agreement.field.choice.required > input"/>
<element name="checkoutAgreementButton" type="button" selector="div.checkout-agreements-block > div > div > div > label > button > span"/>
<element name="checkoutAgreementErrorMessage" type="button" selector="div.checkout-agreement.field.choice.required > div.mage-error"/>
Expand Down
Loading

0 comments on commit d451846

Please sign in to comment.