Skip to content

Commit 17fed2d

Browse files
ENGCOM-8961: Replace repetitive actions with Action Groups in AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest #32539
- Merge Pull Request #32539 from kate-kyzyma/magento2:Refactoring-AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest - Merged commits: 1. 95116a9 2. c05e4c7 3. 4140d58 4. 2972182 5. 39fa294 6. 11212af 7. 6cc8a3c
2 parents d2155b3 + 6cc8a3c commit 17fed2d

File tree

1 file changed

+78
-40
lines changed

1 file changed

+78
-40
lines changed

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

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -39,67 +39,105 @@
3939
<actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openProductCatalogPage">
4040
<argument name="productSku" value="$initialSimpleProduct.sku$"/>
4141
</actionGroup>
42-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProductGrid"/>
43-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickFirstRowToOpenDefaultSimpleProduct"/>
44-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitUntilProductIsOpened"/>
42+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
43+
stepKey="filterProductGrid"/>
44+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
45+
stepKey="clickFirstRowToOpenDefaultSimpleProduct"/>
46+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
47+
stepKey="waitUntilProductIsOpened"/>
4548

4649
<!-- Update simple product with regular price(in stock) -->
47-
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{simpleProductRegularPrice32501InStock.name}}" stepKey="fillSimpleProductName"/>
48-
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{simpleProductRegularPrice32501InStock.sku}}" stepKey="fillSimpleProductSku"/>
49-
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{simpleProductRegularPrice32501InStock.price}}" stepKey="fillSimpleProductPrice"/>
50-
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{simpleProductRegularPrice32501InStock.quantity}}" stepKey="fillSimpleProductQuantity"/>
51-
<selectOption selector="{{AdminProductFormSection.stockStatus}}" userInput="{{simpleProductRegularPrice32501InStock.status}}" stepKey="selectStockStatusInStock"/>
52-
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductRegularPrice32501InStock.weight}}" stepKey="fillSimpleProductWeight"/>
53-
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
54-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$initialCategoryEntity.name$$" stepKey="fillSearchForInitialCategory"/>
55-
<waitForPageLoad stepKey="waitForCategory1"/>
56-
<click selector="{{AdminProductFormSection.selectCategory($$initialCategoryEntity.name$$)}}" stepKey="unselectInitialCategory"/>
57-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$categoryEntity.name$$" stepKey="fillSearchCategory"/>
58-
<waitForPageLoad stepKey="waitForCategory2"/>
59-
<click selector="{{AdminProductFormSection.selectCategory($$categoryEntity.name$$)}}" stepKey="clickOnCategory"/>
50+
<actionGroup ref="FillMainProductFormByStringActionGroup" stepKey="fillSimpleProductName">
51+
<argument name="productName" value="{{simpleProductRegularPrice32501InStock.name}}"/>
52+
<argument name="productSku" value="{{simpleProductRegularPrice32501InStock.sku}}"/>
53+
<argument name="productPrice" value="{{simpleProductRegularPrice32501InStock.price}}"/>
54+
<argument name="productQuantity" value="{{simpleProductRegularPrice32501InStock.quantity}}"/>
55+
<argument name="productStatus" value="{{simpleProductRegularPrice32501InStock.status}}"/>
56+
<argument name="productWeight" value="{{simpleProductRegularPrice32501InStock.weight}}"/>
57+
</actionGroup>
58+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
59+
stepKey="fillSimpleProductSku"/>
60+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
61+
stepKey="fillSimpleProductPrice"/>
62+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
63+
stepKey="fillSimpleProductQuantity"/>
64+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
65+
stepKey="selectStockStatusInStock"/>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
67+
stepKey="fillSimpleProductWeight"/>
68+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
69+
stepKey="clickCategoriesDropDown"/>
70+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
71+
stepKey="fillSearchForInitialCategory"/>
72+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
73+
stepKey="waitForCategory1"/>
74+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
75+
stepKey="unselectInitialCategory"/>
76+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
77+
stepKey="fillSearchCategory"/>
78+
<comment userInput="Comment is added to preserve the step key for backward compatibility"
79+
stepKey="waitForCategory2"/>
80+
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="clickOnCategory">
81+
<argument name="categoryName" value="$$categoryEntity.name$$"/>
82+
</actionGroup>
6083
<actionGroup ref="AdminSubmitCategoriesPopupActionGroup" stepKey="clickOnDoneAdvancedCategorySelect"/>
6184
<selectOption selector="{{AdminProductFormSection.visibility}}" userInput="{{simpleProductRegularPrice32501InStock.visibility}}" stepKey="selectVisibility"/>
62-
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection"/>
63-
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductRegularPrice32501InStock.urlKey}}" stepKey="fillUrlKey"/>
85+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAdminProductSEOSection"/>
86+
<actionGroup ref="SetProductUrlKeyByStringActionGroup" stepKey="fillUrlKey">
87+
<argument name="urlKey" value="{{simpleProductRegularPrice32501InStock.urlKey}}"/>
88+
</actionGroup>
6489
<scrollToTopOfPage stepKey="scrollToTopOfAdminProductFormSection"/>
6590
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="clickSaveButton"/>
6691

6792
<!-- Verify customer see success message -->
68-
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/>
93+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeAssertSimpleProductSaveSuccessMessage">
94+
<argument name="message" value="You saved the product."/>
95+
</actionGroup>
6996

7097
<!-- Search updated simple product(from above step) in the grid page -->
7198
<actionGroup ref="AdminProductCatalogPageOpenActionGroup" stepKey="openProductCatalogPageToSearchUpdatedSimpleProduct"/>
72-
<conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clickClearAll"/>
73-
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/>
74-
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{simpleProductRegularPrice32501InStock.name}}" stepKey="fillSimpleProductNameInNameFilter"/>
75-
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{simpleProductRegularPrice32501InStock.sku}}" stepKey="fillProductSku"/>
76-
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
99+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickClearAll"/>
100+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickFiltersButton"/>
101+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillSimpleProductNameInNameFilter"/>
102+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductSku"/>
103+
<actionGroup ref="FilterProductGridBySkuAndNameActionGroup" stepKey="clickApplyFiltersButton">
104+
<argument name="product" value="simpleProductRegularPrice32501InStock"/>
105+
</actionGroup>
77106
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickFirstRowToVerifyUpdatedSimpleProductVisibleInGrid"/>
78107
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitUntilSimpleProductPageIsOpened"/>
79108

80109
<!-- Verify customer see updated simple product in the product form page -->
81-
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{simpleProductRegularPrice32501InStock.name}}" stepKey="seeSimpleProductName"/>
82-
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{simpleProductRegularPrice32501InStock.sku}}" stepKey="seeSimpleProductSku"/>
83-
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{simpleProductRegularPrice32501InStock.price}}" stepKey="seeSimpleProductPrice"/>
84-
<seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{simpleProductRegularPrice32501InStock.quantity}}" stepKey="seeSimpleProductQuantity"/>
85-
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{simpleProductRegularPrice32501InStock.status}}" stepKey="seeSimpleProductStockStatus"/>
86-
<seeInField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductRegularPrice32501InStock.weight}}" stepKey="seeSimpleProductWeight"/>
87-
88-
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickCategoriesDropDownToVerify"/>
89-
<actionGroup ref="AssertAdminProductIsAssignedToCategoryActionGroup" stepKey="selectedCategories">
110+
<actionGroup ref="AdminAssertProductInfoOnEditPageActionGroup" stepKey="seeSimpleProductName">
111+
<argument name="productName" value="{{simpleProductRegularPrice32501InStock.name}}"/>
112+
<argument name="productSku" value="{{simpleProductRegularPrice32501InStock.sku}}"/>
113+
<argument name="productPrice" value="{{simpleProductRegularPrice32501InStock.price}}"/>
114+
<argument name="productQuantity" value="{{simpleProductRegularPrice32501InStock.quantity}}"/>
115+
<argument name="productWeight" value="{{simpleProductRegularPrice32501InStock.weight}}"/>
116+
<argument name="productVisibility" value="{{simpleProductRegularPrice32501InStock.visibility}}"/>
90117
<argument name="categoryName" value="$$categoryEntity.name$$"/>
91118
</actionGroup>
92-
<seeInField selector="{{AdminProductFormSection.visibility}}" userInput="{{simpleProductRegularPrice32501InStock.visibility}}" stepKey="seeVisibility"/>
119+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSimpleProductSku"/>
120+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSimpleProductPrice"/>
121+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSimpleProductQuantity"/>
122+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSimpleProductStockStatus"/>
123+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSimpleProductWeight"/>
124+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickCategoriesDropDownToVerify"/>
125+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectedCategories"/>
126+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeVisibility"/>
93127
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSection1"/>
94128
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection1"/>
95129
<seeInField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductRegularPrice32501InStock.urlKey}}" stepKey="seeUrlKey"/>
96-
97130
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
98131

99132
<!--Verify customer see updated simple product link on category page -->
100-
<amOnPage url="{{StorefrontCategoryPage.url($$categoryEntity.custom_attributes[url_key]$$)}}" stepKey="openCategoryPage"/>
101-
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
102-
<see selector="{{StorefrontCategoryMainSection.productLink}}" userInput="{{simpleProductRegularPrice32501InStock.name}}" stepKey="seeSimpleProductNameOnCategoryPage"/>
133+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
134+
<argument name="categoryName" value="$$categoryEntity.name$$"/>
135+
</actionGroup>
136+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryPageLoad"/>
137+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSimpleProductNameOnCategoryPage"/>
138+
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="assertFirstBundleProduct">
139+
<argument name="productName" value="{{simpleProductRegularPrice32501InStock.name}}"/>
140+
</actionGroup>
103141

104142
<!-- Verify customer see updated simple product (from the above step) on the storefront page -->
105143
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
@@ -127,8 +165,8 @@
127165
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="assertOldPriceTextOnProductPage"/>
128166

129167
<!--Verify customer don't see updated simple product link on magento storefront page and is searchable by sku -->
130-
<amOnPage url="{{StorefrontProductPage.url(simpleProductRegularPrice32501InStock.urlKey)}}" stepKey="goToMagentoStorefrontPage"/>
131-
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/>
168+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToMagentoStorefrontPage"/>
169+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStoreFrontProductPageLoad"/>
132170
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="fillSimpleProductSkuInSearchTextBox">
133171
<argument name="phrase" value="{{simpleProductRegularPrice32501InStock.sku}}"/>
134172
</actionGroup>

0 commit comments

Comments
 (0)