Skip to content

Commit 748fd85

Browse files
author
OlgaVasyltsun
committed
MC-29047: Fix MFTF test
1 parent fa00ff7 commit 748fd85

5 files changed

+182
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontProductDetailPageNameAndUrlActionGroup">
12+
<annotations>
13+
<description>Validates that the Product name and Url are correct.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" defaultValue="{{ApiSimpleProduct.name}}" type="string"/>
17+
<argument name="productUrl" defaultValue="{{ApiSimpleProduct.urlKey}}" type="string"/>
18+
</arguments>
19+
20+
<seeInCurrentUrl url="{{StorefrontProductPage.url(productUrl)}}" stepKey="checkUrl"/>
21+
<seeInTitle userInput="{{productName}}" stepKey="assertProductNameTitle"/>
22+
<see userInput="{{productName}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontCategoryPageOpenProductActionGroup">
11+
<annotations>
12+
<description>Click on the provided product on category page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productName" type="string" defaultValue="{{ApiSimpleProduct.name}}"/>
16+
</arguments>
17+
18+
<click selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo(productName)}}" stepKey="openProductPage"/>
19+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckCategorySimpleProductActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<argument name="product"/>
1717
</arguments>
1818

19+
<waitForElementVisible selector="{{StorefrontCategoryProductSection.ProductTitleByName(productName)}}" stepKey="waitForProduct"/>
1920
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName(product.name)}}" stepKey="assertProductName"/>
2021
<see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/>
2122
<!-- @TODO: MAGETWO-80272 Move to Magento_Checkout -->

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
<annotations>
1313
<features value="ConfigurableProduct"/>
1414
<stories value="View configurable product child in storefront"/>
15-
<title value="It should be possible to only view the child product of a configurable product"/>
15+
<title value="DEPRECATED It should be possible to only view the child product of a configurable product"/>
1616
<description value="Create configurable product, add to category such that only child variation is visible in category"/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MC-5832"/>
1919
<group value="ConfigurableProduct"/>
2020
<skip>
21-
<issueId value="MC-17140"/>
21+
<issueId value="DEPRECATED">Use StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest instead</issueId>
2222
</skip>
2323
</annotations>
2424
<before>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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="StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest">
12+
<annotations>
13+
<features value="ConfigurableProduct"/>
14+
<stories value="View products"/>
15+
<title value="It should be possible to only view the child product of a configurable product"/>
16+
<description value="Create configurable product, add to category such that only child variation is visible in category"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-5832"/>
19+
<group value="configurable_product"/>
20+
</annotations>
21+
<before>
22+
<!-- Create the category -->
23+
<createData entity="ApiCategory" stepKey="createCategory"/>
24+
<createData entity="_defaultCategory" stepKey="secondCategory"/>
25+
26+
<!-- Create an attribute with two options to be used in the first child product -->
27+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
28+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
29+
<requiredEntity createDataKey="createConfigProductAttribute"/>
30+
</createData>
31+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
32+
<requiredEntity createDataKey="createConfigProductAttribute"/>
33+
</createData>
34+
35+
<!-- Add the attribute we just created to default attribute set -->
36+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
37+
<requiredEntity createDataKey="createConfigProductAttribute"/>
38+
</createData>
39+
40+
<!-- Get the first option of the attribute we created -->
41+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
42+
<requiredEntity createDataKey="createConfigProductAttribute"/>
43+
</getData>
44+
45+
<!-- Get the second option of the attribute we created -->
46+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
47+
<requiredEntity createDataKey="createConfigProductAttribute"/>
48+
</getData>
49+
50+
<!-- Create the configurable product and add it to the category -->
51+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
52+
<requiredEntity createDataKey="createCategory"/>
53+
</createData>
54+
55+
<!-- Create a simple product and give it the attribute with the first option -->
56+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
57+
<requiredEntity createDataKey="createConfigProductAttribute"/>
58+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
59+
</createData>
60+
61+
<!-- Create a simple product and give it the attribute with the second option -->
62+
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
63+
<requiredEntity createDataKey="createConfigProductAttribute"/>
64+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
65+
</createData>
66+
67+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
68+
<requiredEntity createDataKey="createConfigProduct"/>
69+
<requiredEntity createDataKey="createConfigProductAttribute"/>
70+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
71+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
72+
</createData>
73+
74+
<!-- Add the first simple product to the configurable product -->
75+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
76+
<requiredEntity createDataKey="createConfigProduct"/>
77+
<requiredEntity createDataKey="createConfigChildProduct1"/>
78+
</createData>
79+
80+
<!-- Add the second simple product to the configurable product -->
81+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
82+
<requiredEntity createDataKey="createConfigProduct"/>
83+
<requiredEntity createDataKey="createConfigChildProduct2"/>
84+
</createData>
85+
86+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/>
87+
</before>
88+
89+
<after>
90+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
91+
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
92+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
93+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
94+
<deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/>
95+
<deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/>
96+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
97+
</after>
98+
99+
<!-- Go to the product page for the first product -->
100+
<actionGroup ref="goToProductPageViaID" stepKey="openConfigChildProduct1Page">
101+
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
102+
</actionGroup>
103+
104+
<!-- Edit the visibility the first simple product -->
105+
<selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/>
106+
<!--Add to category-->
107+
<actionGroup ref="AdminAssignCategoryToProductAndSaveActionGroup" stepKey="addProductToCategoryAndSaveProduct">
108+
<argument name="categoryName" value="$$secondCategory.name$$"/>
109+
</actionGroup>
110+
111+
<magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext" stepKey="reindexSearchIndex"/>
112+
113+
<!-- Go to storefront to view child product -->
114+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToSecondCategoryStorefront">
115+
<argument name="category" value="$$secondCategory$$"/>
116+
</actionGroup>
117+
<actionGroup ref="StorefrontCheckCategorySimpleProductActionGroup" stepKey="seeChildProductInCategory">
118+
<argument name="product" value="$createConfigChildProduct1$"/>
119+
</actionGroup>
120+
<actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeOtherChildProduct">
121+
<argument name="productName" value="$$createConfigChildProduct2.name$$"/>
122+
</actionGroup>
123+
<actionGroup ref="StorefrontCheckProductIsMissingInCategoryProductsPageActionGroup" stepKey="dontSeeParentProduct">
124+
<argument name="productName" value="$$createConfigProduct.name$$"/>
125+
</actionGroup>
126+
<actionGroup ref="StorefrontCategoryPageOpenProductActionGroup" stepKey="openConfigChildProductFromCategoryPage">
127+
<argument name="productName" value="$$createConfigChildProduct1.name$$"/>
128+
</actionGroup>
129+
<actionGroup ref="AssertStorefrontProductDetailPageNameAndUrlActionGroup" stepKey="checkStorefrontConfigChildProductPage">
130+
<argument name="productName" value="$$createConfigChildProduct1.name$$"/>
131+
<argument name="productUrl" value="$$createConfigChildProduct1.custom_attributes[url_key]$$"/>
132+
</actionGroup>
133+
</test>
134+
</tests>

0 commit comments

Comments
 (0)