Skip to content

Commit 3c422ae

Browse files
ENGCOM-8966: Replace repetitive actions with Action Groups in AdminUpdateSimpleProductWithRegularPriceOutOfStockTest #32529
- Merge Pull Request #32529 from kate-kyzyma/magento2:Refactoring-AdminUpdateSimpleProductWithRegularPriceOutOfStockTest - Merged commits: 1. feaed6b 2. 466a537 3. 93b4863 4. e2f0545 5. 5c5b837 6. f6ad9d9 7. ee0c3ab 8. c587f72
2 parents 32fda1c + c587f72 commit 3c422ae

File tree

2 files changed

+150
-137
lines changed

2 files changed

+150
-137
lines changed

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

Lines changed: 33 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -34,106 +34,60 @@
3434
</after>
3535

3636
<!-- Search default simple product in the grid page -->
37-
<actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openProductCatalogPage">
38-
<argument name="productSku" value="$initialSimpleProduct.sku$"/>
37+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="openProductCatalogPage"/>
38+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProductGrid"/>
39+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickFirstRowToOpenDefaultSimpleProduct">
40+
<argument name="product" value="$$initialSimpleProduct$$"/>
3941
</actionGroup>
40-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
41-
stepKey="filterProductGrid"/>
42-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
43-
stepKey="clickFirstRowToOpenDefaultSimpleProduct"/>
44-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
45-
stepKey="waitUntilProductIsOpened"/>
42+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitUntilProductIsOpened"/>
4643

4744
<!-- Update simple product with regular price(in stock) -->
48-
<actionGroup ref="FillMainProductFormByStringActionGroup" stepKey="fillSimpleProductName">
49-
<argument name="productName" value="{{simpleProductDisabled.name}}"/>
50-
<argument name="productSku" value="{{simpleProductDisabled.sku}}"/>
51-
<argument name="productPrice" value="{{simpleProductDisabled.price}}"/>
52-
<argument name="productQuantity" value="{{simpleProductDisabled.quantity}}"/>
53-
<argument name="productStatus" value="{{simpleProductDisabled.status}}"/>
54-
<argument name="productWeight" value="{{simpleProductDisabled.weight}}"/>
55-
</actionGroup>
56-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
57-
stepKey="fillSimpleProductSku"/>
58-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
59-
stepKey="fillSimpleProductPrice"/>
60-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
61-
stepKey="fillSimpleProductQuantity"/>
62-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
63-
stepKey="selectStockStatusInStock"/>
64-
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="fillSimpleProductWeight">
65-
<argument name="categoryName" value="$$initialCategoryEntity.name$$"/>
66-
</actionGroup>
67-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
68-
stepKey="clickAdminProductSEOSection"/>
69-
<actionGroup ref="SetProductUrlKeyByStringActionGroup" stepKey="fillUrlKey">
70-
<argument name="urlKey" value="{{simpleProductDisabled.urlKey}}"/>
71-
</actionGroup>
45+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{simpleProductDisabled.name}}" stepKey="fillSimpleProductName"/>
46+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{simpleProductDisabled.sku}}" stepKey="fillSimpleProductSku"/>
47+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{simpleProductDisabled.price}}" stepKey="fillSimpleProductPrice"/>
48+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{simpleProductDisabled.quantity}}" stepKey="fillSimpleProductQuantity"/>
49+
<selectOption selector="{{AdminProductFormSection.stockStatus}}" userInput="{{simpleProductDisabled.status}}" stepKey="selectStockStatusInStock"/>
50+
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductDisabled.weight}}" stepKey="fillSimpleProductWeight"/>
51+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection"/>
52+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductDisabled.urlKey}}" stepKey="fillUrlKey"/>
7253
<scrollToTopOfPage stepKey="scrollToTopOfAdminProductFormSection"/>
73-
<actionGroup ref="ToggleProductEnabledActionGroup" stepKey="clickEnableProductLabelToDisableProduct"/>
54+
<click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="clickEnableProductLabelToDisableProduct"/>
7455
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="clickSaveButton"/>
7556

7657
<!-- Verify customer see success message -->
77-
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeAssertSimpleProductSaveSuccessMessage">
78-
<argument name="message" value="You saved the product."/>
79-
</actionGroup>
58+
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/>
8059

8160
<!-- Search updated simple product(from above step) in the grid -->
8261
<actionGroup ref="AdminProductCatalogPageOpenActionGroup" stepKey="openProductCatalogPageToSearchUpdatedSimpleProduct"/>
83-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
84-
stepKey="clickClearAll"/>
85-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
86-
stepKey="clickFiltersButton"/>
87-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
88-
stepKey="fillSimpleProductNameInNameFilter"/>
89-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
90-
stepKey="fillProductSku"/>
91-
<actionGroup ref="FilterProductGridBySkuAndNameActionGroup" stepKey="clickApplyFiltersButton">
92-
<argument name="product" value="simpleProductDisabled"/>
93-
</actionGroup>
62+
<conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clickClearAll"/>
63+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/>
64+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{simpleProductDisabled.name}}" stepKey="fillSimpleProductNameInNameFilter"/>
65+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{simpleProductDisabled.sku}}" stepKey="fillProductSku"/>
66+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
9467
<click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowToVerifyUpdatedSimpleProductVisibleInGrid"/>
9568
<waitForPageLoad stepKey="waitUntilSimpleProductPageIsOpened"/>
9669

9770
<!-- Verify customer see updated simple product in the product form page -->
98-
<actionGroup ref="AdminAssertProductInfoOnEditPageActionGroup" stepKey="seeSimpleProductName">
99-
<argument name="productStatus" value="{{SimpleProductDisabled.status}}"/>
100-
<argument name="productName" value="{{simpleProductDisabled.name}}"/>
101-
<argument name="productSku" value="{{simpleProductDisabled.sku}}"/>
102-
<argument name="productPrice" value="{{simpleProductDisabled.price}}"/>
103-
<argument name="productQuantity" value="{{simpleProductDisabled.quantity}}"/>
104-
<argument name="productWeight" value="{{simpleProductDisabled.weight}}"/>
105-
<argument name="categoryName" value="$$initialCategoryEntity.name$$"/>
106-
</actionGroup>
107-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
108-
stepKey="seeSimpleProductSku"/>
109-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
110-
stepKey="seeSimpleProductPrice"/>
111-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
112-
stepKey="seeSimpleProductQuantity"/>
113-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
114-
stepKey="seeSimpleProductStockStatus"/>
115-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
116-
stepKey="seeSimpleProductWeight"/>
71+
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{simpleProductDisabled.name}}" stepKey="seeSimpleProductName"/>
72+
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{simpleProductDisabled.sku}}" stepKey="seeSimpleProductSku"/>
73+
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{simpleProductDisabled.price}}" stepKey="seeSimpleProductPrice"/>
74+
<seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{simpleProductDisabled.quantity}}" stepKey="seeSimpleProductQuantity"/>
75+
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{simpleProductDisabled.status}}" stepKey="seeSimpleProductStockStatus"/>
76+
<seeInField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductDisabled.weight}}" stepKey="seeSimpleProductWeight"/>
11777
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSectionHeader"/>
11878
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSectionHeader"/>
119-
<seeInField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductDisabled.urlKey}}"
120-
stepKey="seeSimpleProductUrlKey"/>
79+
<seeInField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductDisabled.urlKey}}" stepKey="seeSimpleProductUrlKey"/>
12180

12281
<!--Verify customer don't see updated simple product link on magento storefront page -->
123-
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToMagentoStorefrontPage"/>
124-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
125-
stepKey="waitForStoreFrontProductPageLoad"/>
82+
<amOnPage url="{{StorefrontProductPage.url(simpleProductDisabled.urlKey)}}" stepKey="goToMagentoStorefrontPage"/>
83+
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/>
12684
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="fillSimpleProductSkuInSearchTextBox">
12785
<argument name="phrase" value="{{simpleProductDisabled.sku}}"/>
12886
</actionGroup>
129-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
130-
stepKey="waitForSearchTextBox"/>
131-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
132-
stepKey="clickSearchTextBoxButton"/>
133-
<comment userInput="Comment is added to preserve the step key for backward compatibility"
134-
stepKey="waitForSearch"/>
135-
<actionGroup ref="AssertStorefrontProductNameIsNotOnProductMainPageActionGroup"
136-
stepKey="dontSeeProductNameOnStorefrontPage">
87+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSearchTextBox"/>
88+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickSearchTextBoxButton"/>
89+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSearch"/>
90+
<actionGroup ref="AssertStorefrontProductNameIsNotOnProductMainPageActionGroup" stepKey="dontSeeProductNameOnStorefrontPage">
13791
<argument name="productName" value="{{simpleProductDisabled.name}}"/>
13892
</actionGroup>
13993
</test>

0 commit comments

Comments
 (0)