|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 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="AdminCreateGroupedProductWithUkTaxDisplayTest"> |
| 12 | + <annotations> |
| 13 | + <features value="GroupedProduct"/> |
| 14 | + <stories value="Admin configures UK tax for grouped products"/> |
| 15 | + <title value="Create Grouped product with UK 20% tax"/> |
| 16 | + <description value="Creates grouped product, configures UK tax, enables inclusive/exclusive price display, verifies storefront visibility."/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value="AC-6363"/> |
| 19 | + <group value="GroupedProduct"/> |
| 20 | + <group value="tax"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 24 | + <createData entity="ApiSimpleProduct" stepKey="createSimpleOne"> |
| 25 | + <requiredEntity createDataKey="createCategory"/> |
| 26 | + <field key="price">100.00</field> |
| 27 | + </createData> |
| 28 | + <createData entity="ApiSimpleProduct" stepKey="createSimpleTwo"> |
| 29 | + <requiredEntity createDataKey="createCategory"/> |
| 30 | + <field key="price">150.00</field> |
| 31 | + </createData> |
| 32 | + <!-- Step 1: Login as admin --> |
| 33 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 34 | + <!-- Step 3: Create tax zone (add a new tax zone for the UK, all regions and zip codes, at a rate of 20%. ) --> |
| 35 | + <createData entity="taxRateCustomRateUK" stepKey="createUkTaxRate"> |
| 36 | + <field key="rate">20.0000</field> |
| 37 | + <field key="zip_is_range">0</field> |
| 38 | + <field key="tax_postcode">*</field> |
| 39 | + <field key="tax_region_id">0</field> |
| 40 | + </createData> |
| 41 | + <!-- Step 4: Create tax rule and assign UK. --> |
| 42 | + <actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createUkTaxRule"> |
| 43 | + <argument name="taxRate" value="$$createUkTaxRate$$"/> |
| 44 | + <argument name="taxRule" value="SimpleTaxRule"/> |
| 45 | + </actionGroup> |
| 46 | + <!-- Step 5: Set both options to "Including and Excluding Tax" under Store > Configuration > Sales > Tax > Price Display Settings --> |
| 47 | + <magentoCLI command="config:set {{CustomDisplayProductPricesInCatalog.path}} {{CustomDisplayProductPricesInCatalog.value}}" stepKey="setCatalogDisplayBoth"/> |
| 48 | + <magentoCLI command="config:set {{CustomDisplayShippingPricesInCatalog.path}} {{CustomDisplayShippingPricesInCatalog.value}}" stepKey="setCatalogShippingBoth"/> |
| 49 | + <magentoCLI command="config:set {{CustomCartDisplayPrice.path}} {{CustomCartDisplayPrice.value}}" stepKey="setCartPriceBoth"/> |
| 50 | + <magentoCLI command="config:set {{CustomCartDisplaySubtotal.path}} {{CustomCartDisplaySubtotal.value}}" stepKey="setCartSubtotalBoth"/> |
| 51 | + <magentoCLI command="config:set {{CustomCartDisplayShipping.path}} {{CustomCartDisplayShipping.value}}" stepKey="setCartShippingBoth"/> |
| 52 | + </before> |
| 53 | + <after> |
| 54 | + <magentoCLI command="config:set {{DisplayProductPricesInCatalog.path}} {{DisplayProductPricesInCatalog.value}}" stepKey="resetCatalogDisplay"/> |
| 55 | + <magentoCLI command="config:set {{DefaultDisplayShippingPricesInCatalog.path}} {{DefaultDisplayShippingPricesInCatalog.value}}" stepKey="resetCatalogShipping"/> |
| 56 | + <magentoCLI command="config:set {{DefaultCartDisplayPrice.path}} {{DefaultCartDisplayPrice.value}}" stepKey="resetCartPrice"/> |
| 57 | + <magentoCLI command="config:set {{DefaultCartDisplaySubtotal.path}} {{DefaultCartDisplaySubtotal.value}}" stepKey="resetCartSubtotal"/> |
| 58 | + <magentoCLI command="config:set {{DisplayShippingAmountConfigData.path}} {{DisplayShippingAmountConfigData.value}}" stepKey="resetCartShipping"/> |
| 59 | + <actionGroup ref="AdminTaxRuleGridOpenPageActionGroup" stepKey="openTaxRuleGrid"/> |
| 60 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteUkTaxRule"> |
| 61 | + <argument name="name" value="{{SimpleTaxRule.code}}"/> |
| 62 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 63 | + </actionGroup> |
| 64 | + <deleteData createDataKey="createUkTaxRate" stepKey="deleteUkTaxRate"/> |
| 65 | + <helper class="Magento\Catalog\Test\Mftf\Helper\ProductApiHelper" method="deleteAllProductsApi" stepKey="deleteProducts"/> |
| 66 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 67 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> |
| 68 | + </after> |
| 69 | + <!-- Step 2: Create grouped product and assign simple products --> |
| 70 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductGrid"/> |
| 71 | + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="startGroupedProductCreation"> |
| 72 | + <argument name="product" value="GroupedProduct"/> |
| 73 | + </actionGroup> |
| 74 | + <waitForElementVisible selector="{{AdminProductFormSection.productName}}" stepKey="waitForGroupedForm"/> |
| 75 | + <actionGroup ref="FillGroupedProductFormActionGroup" stepKey="fillGroupedBasics"> |
| 76 | + <argument name="product" value="GroupedProduct"/> |
| 77 | + </actionGroup> |
| 78 | + <waitForElementClickable selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="waitForCategoryDropdown"/> |
| 79 | + <click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openCategoryDropdown"/> |
| 80 | + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToGroupedProduct"> |
| 81 | + <argument name="categoryName" value="$$createCategory.name$$"/> |
| 82 | + </actionGroup> |
| 83 | + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedSection"/> |
| 84 | + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="openAddProductsModal"/> |
| 85 | + <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForProductsModal"/> |
| 86 | + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterFirstSimple"> |
| 87 | + <argument name="sku" value="$$createSimpleOne.sku$$"/> |
| 88 | + </actionGroup> |
| 89 | + <checkOption selector="{{AdminAddProductsToGroupPanel.nThCheckbox('0')}}" stepKey="selectFirstSimple"/> |
| 90 | + <actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterSecondSimple"> |
| 91 | + <argument name="sku" value="$$createSimpleTwo.sku$$"/> |
| 92 | + </actionGroup> |
| 93 | + <checkOption selector="{{AdminAddProductsToGroupPanel.nThCheckbox('0')}}" stepKey="selectSecondSimple"/> |
| 94 | + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="addSelectedProducts"/> |
| 95 | + <actionGroup ref="FillDefaultQuantityForLinkedToGroupProductInGridActionGroup" stepKey="setQtySimpleOne"> |
| 96 | + <argument name="productName" value="$$createSimpleOne.name$$"/> |
| 97 | + <argument name="qty" value="1"/> |
| 98 | + </actionGroup> |
| 99 | + <actionGroup ref="FillDefaultQuantityForLinkedToGroupProductInGridActionGroup" stepKey="setQtySimpleTwo"> |
| 100 | + <argument name="productName" value="$$createSimpleTwo.name$$"/> |
| 101 | + <argument name="qty" value="1"/> |
| 102 | + </actionGroup> |
| 103 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveGroupedProduct"/> |
| 104 | + <!-- Step 7: Navigate to the category the grouped product belongs to on frontend --> |
| 105 | + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStorefrontHome"/> |
| 106 | + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategory"> |
| 107 | + <argument name="categoryName" value="$$createCategory.name$$"/> |
| 108 | + </actionGroup> |
| 109 | + <waitForText selector="{{StorefrontCategoryProductSection.ProductTitleByName(GroupedProduct.name)}}" userInput="{{GroupedProduct.name}}" stepKey="seeGroupedProductInCategory"/> |
| 110 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openGroupedProductPdp"> |
| 111 | + <argument name="productUrl" value="{{GroupedProduct.urlKey}}"/> |
| 112 | + </actionGroup> |
| 113 | + <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="waitForPdpLoad"/> |
| 114 | + <waitForText selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{GroupedProduct.name}}" stepKey="confirmPdpName"/> |
| 115 | + </test> |
| 116 | +</tests> |
0 commit comments