Skip to content

Commit b5c06d7

Browse files
committed
Refactoring the NewProductsListWidgetSimpleProductTest
1 parent 9a68d68 commit b5c06d7

File tree

3 files changed

+55
-10
lines changed

3 files changed

+55
-10
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.
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="AdminSetProductAsNewDateActionGroup">
11+
<arguments>
12+
<argument name="fromDate" type="string"/>
13+
<argument name="toDate" type="string"/>
14+
</arguments>
15+
16+
<fillField selector="{{AdminProductFormSection.setProductAsNewFrom}}" userInput="{{fromDate}}" stepKey="fillProductNewFrom"/>
17+
<fillField selector="{{AdminProductFormSection.setProductAsNewTo}}" userInput="{{toDate}}" stepKey="fillProductNewTo"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/NewProductsListWidgetSimpleProductTest.xml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,27 @@
2424

2525
<!-- Create a Simple Product to appear in the widget -->
2626
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductList"/>
27-
<click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddProduct"/>
28-
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{_defaultProduct.name}}" stepKey="fillProductName"/>
29-
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{_defaultProduct.sku}}" stepKey="fillProductSku"/>
30-
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{_defaultProduct.price}}" stepKey="fillProductPrice"/>
31-
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQuantity"/>
32-
<fillField selector="{{AdminProductFormSection.setProductAsNewFrom}}" userInput="01/1/2000" stepKey="fillProductNewFrom"/>
33-
<fillField selector="{{AdminProductFormSection.setProductAsNewTo}}" userInput="01/1/2099" stepKey="fillProductNewTo"/>
27+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="clickAddProduct"/>
28+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductName"/>
29+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductSku"/>
30+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductPrice"/>
31+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductQuantity"/>
32+
<actionGroup ref="AdminSetProductAsNewDateActionGroup" stepKey="fillProductNewFrom">
33+
<argument name="fromDate" value="01/1/2000"/>
34+
<argument name="toDate" value="01/1/2099"/>
35+
</actionGroup>
36+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductNewTo"/>
3437
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveProduct"/>
3538

3639
<!-- If PageCache is enabled, Cache clearing happens here via merge -->
3740

3841
<!-- Check for product on the CMS page with the New Products widget -->
39-
<amOnPage url="{{_newDefaultCmsPage.identifier}}" stepKey="amOnCmsPage"/>
40-
<waitForPageLoad stepKey="waitForCmsPage"/>
41-
<see selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="{{_defaultProduct.name}}" stepKey="seeProductName"/>
42+
<actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="amOnCmsPage">
43+
<argument name="identifier" value="{{_newDefaultCmsPage.identifier}}"/>
44+
</actionGroup>
45+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCmsPage"/>
46+
<actionGroup ref="AssertStorefrontProductIsShownOnCmsPageActionGroup" stepKey="seeProductName">
47+
<argument name="cmsTitle" value="{{_newDefaultCmsPage.title}}"/>
48+
</actionGroup>
4249
</test>
4350
</tests>
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.
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="AssertStorefrontProductIsShownOnCmsPageActionGroup">
11+
<arguments>
12+
<argument name="cmsTitle" type="string"/>
13+
<argument name="productName" type="string" defaultValue="{{_defaultProduct.name}}"/>
14+
</arguments>
15+
16+
<seeInTitle userInput="{{cmsTitle}}" stepKey="seePageTitle"/>
17+
<see selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" userInput="{{productName}}" stepKey="seeProductName"/>
18+
</actionGroup>
19+
</actionGroups>

0 commit comments

Comments
 (0)