Skip to content

Commit 0276309

Browse files
committed
MC-4462: Convert DeleteProductsFromShoppingCartTest to MFTF
1 parent 7461cf2 commit 0276309

9 files changed

+391
-6
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.z
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="DeleteProductFromShoppingCartActionGroup">
12+
<arguments>
13+
<argument name="productName" type="string"/>
14+
</arguments>
15+
<click selector="{{CheckoutCartProductSection.removeProductByName(productName)}}" stepKey="deleteProductFromCheckoutCart"/>
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
<see userInput="You have no items in your shopping cart." stepKey="seeNoItemsInShoppingCart"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<element name="ProductPriceByOption" type="text" selector="//*[contains(@class, 'item-options')]/dd[normalize-space(.)='{{var1}}']/ancestor::tr//td[contains(@class, 'price')]//span[@class='price']" parameterized="true"/>
2828
<element name="RemoveItem" type="button"
2929
selector="//table[@id='shopping-cart-table']//tbody//tr[contains(@class,'item-actions')]//a[contains(@class,'action-delete')]"/>
30+
<element name="removeProductByName" selector="//*[contains(text(), '{{productName}}')]/ancestor::tbody//a[@class='action action-delete']" parameterized="true" timeout="30"/>
3031
<element name="productName" type="text" selector="//tbody[@class='cart item']//strong[@class='product-item-name']"/>
3132
<element name="nthItemOption" type="block" selector=".item:nth-of-type({{numElement}}) .item-options" parameterized="true"/>
3233
<element name="nthEditButton" type="block" selector=".item:nth-of-type({{numElement}}) .action-edit" parameterized="true"/>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="DeleteBundleDynamicProductFromShoppingCartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Delete Products from Shopping Cart"/>
15+
<title value="Delete bundle dynamic product from shopping cart test"/>
16+
<description value="Delete bundle dynamic product from shopping cart"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-14689"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create category and simple product -->
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
28+
<!-- Create bundle product -->
29+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleDynamicProduct">
30+
<requiredEntity createDataKey="createCategory"/>
31+
</createData>
32+
<createData entity="DropDownBundleOption" stepKey="bundleOption">
33+
<requiredEntity createDataKey="createBundleDynamicProduct"/>
34+
</createData>
35+
<createData entity="ApiBundleLink" stepKey="createNewBundleLink">
36+
<requiredEntity createDataKey="createBundleDynamicProduct"/>
37+
<requiredEntity createDataKey="bundleOption"/>
38+
<requiredEntity createDataKey="createSimpleProduct"/>
39+
</createData>
40+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
41+
</before>
42+
<after>
43+
<!-- Delete category -->
44+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
45+
46+
<!-- Delete bundle product data -->
47+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
48+
<deleteData createDataKey="createBundleDynamicProduct" stepKey="deleteBundleProduct"/>
49+
</after>
50+
51+
<!-- Go to bundle product page -->
52+
<amOnPage url="{{StorefrontProductPage.url($$createBundleDynamicProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToProductPage"/>
53+
<waitForPageLoad stepKey="waitForPageLoad"/>
54+
55+
<!-- Add product to the cart -->
56+
<click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/>
57+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCart">
58+
<argument name="productName" value="$$createBundleDynamicProduct.name$$"/>
59+
</actionGroup>
60+
61+
<!-- Remove product from cart -->
62+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
63+
<actionGroup ref="DeleteProductFromShoppingCartActionGroup" stepKey="deleteProduct">
64+
<argument name="productName" value="$$createBundleDynamicProduct.name$$"/>
65+
</actionGroup>
66+
</test>
67+
</tests>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="DeleteBundleFixedProductFromShoppingCartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Delete Products from Shopping Cart"/>
15+
<title value="Delete bundle fixed product from shopping cart test"/>
16+
<description value="Delete bundle fixed product from shopping cart"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-14690"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create simple product -->
23+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
24+
25+
<!-- Create bundle product -->
26+
<createData entity="ApiFixedBundleProduct" stepKey="createFixedBundleProduct"/>
27+
<createData entity="DropDownBundleOption" stepKey="createBundleOption">
28+
<requiredEntity createDataKey="createFixedBundleProduct"/>
29+
</createData>
30+
<createData entity="ApiBundleLink" stepKey="addLinkOptionToBundleProduct">
31+
<requiredEntity createDataKey="createFixedBundleProduct"/>
32+
<requiredEntity createDataKey="createBundleOption"/>
33+
<requiredEntity createDataKey="createSimpleProduct"/>
34+
</createData>
35+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
36+
</before>
37+
<after>
38+
<!-- Delete bundle product data -->
39+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
40+
<deleteData createDataKey="createFixedBundleProduct" stepKey="deleteFixedBundleProduct"/>
41+
</after>
42+
43+
<!-- Go to bundle product page -->
44+
<amOnPage url="{{StorefrontProductPage.url($$createFixedBundleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToProductPage"/>
45+
<waitForPageLoad stepKey="waitForPageLoad"/>
46+
47+
<!-- Add product to the cart -->
48+
<click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/>
49+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCart">
50+
<argument name="productName" value="$$createFixedBundleProduct.name$$"/>
51+
</actionGroup>
52+
53+
<!-- Remove product from cart -->
54+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
55+
<actionGroup ref="DeleteProductFromShoppingCartActionGroup" stepKey="deleteProduct">
56+
<argument name="productName" value="$$createFixedBundleProduct.name$$"/>
57+
</actionGroup>
58+
</test>
59+
</tests>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="DeleteConfigurableProductFromShoppingCartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Delete Products from Shopping Cart"/>
15+
<title value="Delete configurable product from shopping cart test"/>
16+
<description value="Delete configurable product from shopping cart"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-14692"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create category -->
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
25+
<!-- Create configurable product -->
26+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
30+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption">
31+
<requiredEntity createDataKey="createConfigProductAttribute"/>
32+
</createData>
33+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
34+
<requiredEntity createDataKey="createConfigProductAttribute"/>
35+
</createData>
36+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption">
37+
<requiredEntity createDataKey="createConfigProductAttribute"/>
38+
</getData>
39+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct">
40+
<requiredEntity createDataKey="createConfigProductAttribute"/>
41+
<requiredEntity createDataKey="getConfigAttributeOption"/>
42+
<requiredEntity createDataKey="createCategory"/>
43+
</createData>
44+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
45+
<requiredEntity createDataKey="createConfigProduct"/>
46+
<requiredEntity createDataKey="createConfigProductAttribute"/>
47+
<requiredEntity createDataKey="getConfigAttributeOption"/>
48+
</createData>
49+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild">
50+
<requiredEntity createDataKey="createConfigProduct"/>
51+
<requiredEntity createDataKey="createConfigChildProduct"/>
52+
</createData>
53+
</before>
54+
<after>
55+
<!-- Delete configurable product data -->
56+
<deleteData createDataKey="createConfigChildProduct" stepKey="deleteConfigChildProduct"/>
57+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
58+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
59+
60+
<!-- Delete category -->
61+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
62+
</after>
63+
64+
<!-- Add configurable product to the cart -->
65+
<actionGroup ref="StorefrontAddConfigurableProductToTheCartActionGroup" stepKey="addConfigurableProductToCart">
66+
<argument name="urlKey" value="$$createConfigProduct.custom_attributes[url_key]$$" />
67+
<argument name="productAttribute" value="$$createConfigProductAttribute.default_value$$"/>
68+
<argument name="productOption" value="$$getConfigAttributeOption.value$$"/>
69+
<argument name="qty" value="1"/>
70+
</actionGroup>
71+
72+
<!-- Remove product from cart -->
73+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
74+
<actionGroup ref="DeleteProductFromShoppingCartActionGroup" stepKey="deleteProduct">
75+
<argument name="productName" value="$$createConfigProduct.name$$"/>
76+
</actionGroup>
77+
</test>
78+
</tests>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="DeleteDownloadableProductFromShoppingCartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Delete Products from Shopping Cart"/>
15+
<title value="Delete downloadable product from shopping cart test"/>
16+
<description value="Delete downloadable product from shopping cart"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-14693"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create downloadable product -->
23+
<createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/>
24+
<createData entity="ApiDownloadableLink" stepKey="addDownloadableLink">
25+
<requiredEntity createDataKey="createDownloadableProduct"/>
26+
</createData>
27+
<createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1">
28+
<requiredEntity createDataKey="createDownloadableProduct"/>
29+
</createData>
30+
</before>
31+
<after>
32+
<!-- Delete downloadable product -->
33+
<deleteData createDataKey="createDownloadableProduct" stepKey="deleteDownloadableProduct"/>
34+
</after>
35+
36+
<!-- Add downloadable product to the cart -->
37+
<amOnPage url="{{StorefrontProductPage.url($$createDownloadableProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToDownloadableProductPage"/>
38+
<waitForPageLoad stepKey="waitForDownloadableProductPageLoad"/>
39+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartDownloadableProductFromStorefrontProductPage">
40+
<argument name="productName" value="$$createDownloadableProduct.name$$"/>
41+
</actionGroup>
42+
43+
<!-- Remove product from cart -->
44+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
45+
<actionGroup ref="DeleteProductFromShoppingCartActionGroup" stepKey="deleteProduct">
46+
<argument name="productName" value="$$createDownloadableProduct.name$$"/>
47+
</actionGroup>
48+
</test>
49+
</tests>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="DeleteGroupedProductFromShoppingCartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Delete Products from Shopping Cart"/>
15+
<title value="Delete grouped product from shopping cart test"/>
16+
<description value="Delete grouped product from shopping cart"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-14694"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create grouped product with three simple products -->
23+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct"/>
24+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/>
25+
<createData entity="SimpleProduct2" stepKey="createThirdSimpleProduct"/>
26+
<createData entity="ApiGroupedProduct" stepKey="createGroupedProduct"/>
27+
<createData entity="OneSimpleProductLink" stepKey="addFirstProductToLink">
28+
<requiredEntity createDataKey="createGroupedProduct"/>
29+
<requiredEntity createDataKey="createFirstSimpleProduct"/>
30+
</createData>
31+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addFirstProductToLink" stepKey="addSecondProductTwo">
32+
<requiredEntity createDataKey="createGroupedProduct"/>
33+
<requiredEntity createDataKey="createSecondSimpleProduct"/>
34+
</updateData>
35+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addFirstProductToLink" stepKey="addThirdProductThree">
36+
<requiredEntity createDataKey="createGroupedProduct"/>
37+
<requiredEntity createDataKey="createThirdSimpleProduct"/>
38+
</updateData>
39+
</before>
40+
<after>
41+
<!-- Delete grouped product data -->
42+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstProduct"/>
43+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondProduct"/>
44+
<deleteData createDataKey="createThirdSimpleProduct" stepKey="deleteThirdProduct"/>
45+
<deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/>
46+
</after>
47+
48+
<!-- Add grouped product to the cart -->
49+
<actionGroup ref="StorefrontAddThreeGroupedProductToTheCartActionGroup" stepKey="addGropedProductsToTheCart">
50+
<argument name="urlKey" value="$$createGroupedProduct.custom_attributes[url_key]$$"/>
51+
<argument name="product1" value="$$createFirstSimpleProduct.name$$"/>
52+
<argument name="product2" value="$$createSecondSimpleProduct.name$$"/>
53+
<argument name="product3" value="$$createThirdSimpleProduct.name$$"/>
54+
<argument name="qty1" value="1"/>
55+
<argument name="qty2" value="1"/>
56+
<argument name="qty3" value="1"/>
57+
</actionGroup>
58+
59+
<!-- Remove products from cart -->
60+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart"/>
61+
<click selector="{{CheckoutCartProductSection.removeProductByName($$createFirstSimpleProduct.name$$)}}" stepKey="deleteFirstProductFromCheckoutCart"/>
62+
<click selector="{{CheckoutCartProductSection.removeProductByName($$createSecondSimpleProduct.name$$)}}" stepKey="deleteSecondProductFromCheckoutCart"/>
63+
<click selector="{{CheckoutCartProductSection.removeProductByName($$createThirdSimpleProduct.name$$)}}" stepKey="deleteThirdProductFromCheckoutCart"/>
64+
<waitForPageLoad stepKey="waitForPageLoad"/>
65+
<see userInput="You have no items in your shopping cart." stepKey="seeNoItemsInShoppingCart"/>
66+
</test>
67+
</tests>

0 commit comments

Comments
 (0)