Skip to content

Commit

Permalink
Merge pull request #3926 from magento-pangolin/community-tests-migrat…
Browse files Browse the repository at this point in the history
…ion-pr

[Pangolin] Community MTF to MFTF tests migration

 - closes magento-commerce/magento-functional-tests-migration#648
  • Loading branch information
okolesnyk authored Mar 21, 2019
2 parents 497e94a + 62cf03d commit 8f45cf8
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@
<var key="sku" entityType="product" entityKey="sku" />
<requiredEntity type="product_option">ProductOptionDropDownWithLongValuesTitle</requiredEntity>
</entity>
<entity name="ProductWithTextFieldAndAreaOptions" type="product">
<var key="sku" entityType="product" entityKey="sku" />
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
<requiredEntity type="product_option">ProductOptionArea</requiredEntity>
</entity>
<entity name="ApiVirtualProductWithDescription" type="product">
<data key="sku" unique="suffix">api-virtual-product</data>
<data key="type_id">virtual</data>
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/Checkout/Test/Mftf/Data/QuoteData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@
<data key="shippingMethod">Flat Rate - Fixed</data>
<data key="currency">$</data>
</entity>
<entity name="quoteQty3Price123" type="Quote">
<data key="price">123.00</data>
<data key="qty">3</data>
<data key="subtotal">369.00</data>
<data key="currency">$</data>
</entity>
<entity name="quoteQty11Subtotal1320" type="Quote">
<data key="price">100.00</data>
<data key="customOptionsPrice">20</data>
<data key="qty">11</data>
<data key="subtotal">1,320.00</data>
<data key="currency">$</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontUpdateShoppingCartSimpleProductQtyTest">
<annotations>
<features value="Checkout"/>
<title value="Check updating shopping cart while updating items qty"/>
<description value="Check updating shopping cart while updating items qty"/>
<testCaseId value="MC-14731" />
<group value="shoppingCart"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="SimpleProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<!-- Add the newly created product to the shopping cart -->
<actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
</before>
<after>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
</after>

<!-- Go to the shopping cart -->
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/>
<waitForPageLoad stepKey="waitForCheckoutPageLoad1"/>

<!-- Change the product QTY -->
<fillField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" userInput="{{quoteQty3Price123.qty}}" stepKey="changeCartQty"/>
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="openShoppingCart"/>
<waitForPageLoad stepKey="waitForCheckoutPageLoad2"/>

<!-- The price and QTY values should be updated for the product -->
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabProductQtyInCart"/>
<see userInput="{{quoteQty3Price123.currency}}{{quoteQty3Price123.subtotal}}" selector="{{CheckoutCartProductSection.productSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
<assertEquals stepKey="assertProductQtyInCart">
<actualResult type="variable">grabProductQtyInCart</actualResult>
<expectedResult type="string">{{quoteQty3Price123.qty}}</expectedResult>
</assertEquals>

<!-- Subtotal should be updated -->
<see userInput="{{quoteQty3Price123.currency}}{{quoteQty3Price123.subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertCartSubtotal"/>

<!-- Minicart product price and subtotal should be updated -->
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/>
<grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/>
<assertEquals stepKey="assertProductQtyInMinicart">
<actualResult type="variable">grabProductQtyInMinicart</actualResult>
<expectedResult type="string">{{quoteQty3Price123.qty}}</expectedResult>
</assertEquals>
<see userInput="{{quoteQty3Price123.currency}}{{quoteQty3Price123.subtotal}}" selector="{{StorefrontMinicartSection.subtotal}}" stepKey="assertMinicartSubtotal"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest">
<annotations>
<features value="Checkout"/>
<title value="Check updating shopping cart while updating qty of items with custom options"/>
<description value="Check updating shopping cart while updating qty of items with custom options"/>
<testCaseId value="MC-14732" />
<group value="shoppingCart"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="ApiSimpleProductWithCustomPrice" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<!-- Add two custom options to the product: field and textarea -->
<updateData createDataKey="createProduct" entity="ProductWithTextFieldAndAreaOptions" stepKey="updateProductWithOption"/>

<!-- Go to the product page, fill the custom options values and add the product to the shopping cart -->
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnProductPage"/>
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>
<fillField userInput="OptionField" selector="{{StorefrontProductInfoMainSection.productOptionFieldInput(ProductOptionField.title)}}" stepKey="fillProductOptionInputField"/>
<fillField userInput="OptionArea" selector="{{StorefrontProductInfoMainSection.productOptionAreaInput(ProductOptionArea.title)}}" stepKey="fillProductOptionInputArea"/>
<actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
<argument name="productName" value="$createProduct.name$"/>
</actionGroup>
</before>
<after>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
</after>

<!-- Go to the shopping cart -->
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/>
<waitForPageLoad stepKey="waitForCheckoutPageLoad"/>

<!-- Change the product QTY -->
<fillField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" userInput="{{quoteQty11Subtotal1320.qty}}" stepKey="changeCartQty"/>
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="updateShoppingCart"/>
<waitForPageLoad stepKey="waitShoppingCartUpdated"/>

<!-- The price and QTY values should be updated for the product -->
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabProductQtyInCart"/>
<see userInput="{{quoteQty11Subtotal1320.currency}}{{quoteQty11Subtotal1320.subtotal}}" selector="{{CheckoutCartProductSection.productSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
<assertEquals stepKey="assertProductQtyInCart">
<expectedResult type="string">{{quoteQty11Subtotal1320.qty}}</expectedResult>
<actualResult type="variable">grabProductQtyInCart</actualResult>
</assertEquals>
<see userInput="{{quoteQty11Subtotal1320.currency}}{{quoteQty11Subtotal1320.subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/>

<!-- Minicart product price and subtotal should be updated -->
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/>
<grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/>
<assertEquals stepKey="assertProductQtyInMinicart">
<expectedResult type="string">{{quoteQty11Subtotal1320.qty}}</expectedResult>
<actualResult type="variable">grabProductQtyInMinicart</actualResult>
</assertEquals>
<see userInput="{{quoteQty11Subtotal1320.currency}}{{quoteQty11Subtotal1320.subtotal}}" selector="{{StorefrontMinicartSection.subtotal}}" stepKey="assertMinicartSubtotal"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Checkout\Test\TestCase\UpdateShoppingCartTest" summary="Update Shopping Cart" ticketId="MAGETWO-25081">
<variation name="UpdateShoppingCartTestVariation1">
<data name="tag" xsi:type="string">severity:S0</data>
<data name="tag" xsi:type="string">severity:S0,mftf_migrated:yes</data>
<data name="product/dataset" xsi:type="string">default</data>
<data name="product/data/price/value" xsi:type="string">100</data>
<data name="product/data/checkout_data/qty" xsi:type="string">3</data>
Expand All @@ -20,7 +20,7 @@
<constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" />
</variation>
<variation name="UpdateShoppingCartTestVariation2">
<data name="tag" xsi:type="string">severity:S0</data>
<data name="tag" xsi:type="string">severity:S0,mftf_migrated:yes</data>
<data name="product/dataset" xsi:type="string">with_two_custom_option</data>
<data name="product/data/price/value" xsi:type="string">50</data>
<data name="product/data/checkout_data/qty" xsi:type="string">11</data>
Expand Down

0 comments on commit 8f45cf8

Please sign in to comment.