<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * @copyright  Vertex. All rights reserved.  https://www.vertexinc.com/
  * @author     Mediotype                     https://www.mediotype.com/
  */
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
    <test name="VertexAsRegisteredCustomerWithBillToAndShipToTheSameCheckPhysicalProductTaxOnShoppingCartPageSummaryTest">
        <annotations>
            <features value="Vertex"/>
            <group value="Vertex"/>

            <stories value="As a store owner, I must have accurate taxes calculated for a registered customer"/>
            <title value="Validate Taxes on Cart Summary, Registered User, Physical Product, Bill-To=Ship-To"/>
            <description value="Validate that a registered customer with a bill-to and a ship-to address that are the same and with a cart containing a simple product receives taxes when estimating shipping &amp; tax"/>

            <severity value="MAJOR"/>
        </annotations>
        <before>
            <actionGroup ref="VertexCreateTwoOptionConfigurableProductActionGroup" stepKey="createConfigurableProduct1">
                <argument name="option1Price" value="{{Vertex_100USD_PA_Only_Values.price}}" />
            </actionGroup>
            <actionGroup ref="VertexCreateTwoOptionConfigurableProductActionGroup" stepKey="createConfigurableProduct2">
                <argument name="option1Price" value="{{Vertex_18USD_PA_Only_Values.price}}" />
            </actionGroup>
            <createData entity="VertexProductTaxClass_Clothing" stepKey="createTaxClass" />
            <createData entity="VertexSimpleProduct" stepKey="createSimpleProduct">
                <field key="price">{{Vertex_100USD_Clothing_PA_Only_Values.price}}</field>
                <requiredEntity createDataKey="createCategoryCreateConfigurableProduct1"/>
                <requiredEntity createDataKey="createTaxClass" />
            </createData>

            <createData entity="Vertex_Customer_JacindaArdern" stepKey="createCustomer"/>
        </before>
        <after>
            <deleteData stepKey="deleteSimpleProduct" createDataKey="createSimpleProduct"/>
            <deleteData stepKey="deleteTaxClass" createDataKey="createTaxClass" />
            <deleteData stepKey="deleteChildProduct1" createDataKey="createConfigChildProduct1CreateConfigurableProduct1" />
            <deleteData stepKey="deleteChildProduct2" createDataKey="createConfigChildProduct2CreateConfigurableProduct1" />
            <deleteData stepKey="deleteConfigProduct" createDataKey="ProductCreateConfigurableProduct1"/>
            <deleteData stepKey="deleteConfigProductAttribute" createDataKey="ProductAttributeCreateConfigurableProduct1" />
            <deleteData stepKey="deleteCategory" createDataKey="createCategoryCreateConfigurableProduct1"/>
            <deleteData stepKey="deleteChildProduct1Config2" createDataKey="createConfigChildProduct1CreateConfigurableProduct2" />
            <deleteData stepKey="deleteChildProduct2Config2" createDataKey="createConfigChildProduct2CreateConfigurableProduct2" />
            <deleteData stepKey="deleteConfigProductConfig2" createDataKey="ProductCreateConfigurableProduct2"/>
            <deleteData stepKey="deleteConfigProductAttributeConfig2" createDataKey="ProductAttributeCreateConfigurableProduct2" />
            <deleteData stepKey="deleteCategoryConfig2" createDataKey="createCategoryCreateConfigurableProduct2"/>
            <deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/>
        </after>
        <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
            <argument name="Customer" value="$$createCustomer$$"/>
        </actionGroup>

        <actionGroup ref="VertexAddSingleOptionConfigurableProductToCartActionGroup" stepKey="addFirstConfigToCart">
            <argument name="product" value="$$ProductCreateConfigurableProduct1$$" />
            <argument name="optionConfig" value="$$Option1CreateConfigurableProduct1$$" />
            <argument name="attributeConfig" value="$$ProductAttributeCreateConfigurableProduct1$$" />
        </actionGroup>

        <actionGroup ref="VertexAddSingleOptionConfigurableProductToCartActionGroup" stepKey="addSecondConfigToCart">
            <argument name="product" value="$$ProductCreateConfigurableProduct2$$" />
            <argument name="optionConfig" value="$$Option1CreateConfigurableProduct2$$" />
            <argument name="attributeConfig" value="$$ProductAttributeCreateConfigurableProduct2$$" />
        </actionGroup>

        <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToCart">
            <argument name="product" value="$$createSimpleProduct$$" />
        </actionGroup>

        <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="gotoCart"/>

        <waitForPageLoad stepKey="waitForCartPage"/>
        <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.shippingMethodForm}}" visible="false" stepKey="openEstimateShippingSection"/>
        <checkOption selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="selectFlatRateShipping"/>
        <waitForPageLoad stepKey="waitForTotals"/>

        <actionGroup ref="VertexCheckTotalsInCartActionGroup" stepKey="checkTotals">
            <argument name="subtotalExclTax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.subtotal}}" />
            <argument name="subtotalInclTax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.subtotalInclTax}}" />
            <argument name="shippingExclTax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.shipping}}" />
            <argument name="shippingInclTax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.shippingInclTax}}" />
            <argument name="tax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.tax}}" />
            <argument name="totalExclTax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.total}}" />
            <argument name="totalInclTax" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.totalInclTax}}" />
        </actionGroup>
        <actionGroup ref="VertexCheckProductAndShippingTaxTotalsInCartActionGroup" stepKey="checkTaxSummary">
            <argument name="product" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.productTax}}" />
            <argument name="shipping" value="{{Vertex_100USD_and_18USD_and_100USD_Clothing_PA_Only_Totals.shippingTax}}" />
        </actionGroup>
        <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
    </test>
</tests>
