Skip to content

Replace repetitive actions with Action Groups in AdminEditRelatedBundleProductTest, EnableDisableBundleProductStatusTest, AdminMassDeleteBundleProductsTest #34099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@

<!--Save the product-->
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
<argument name="message" value="You saved the product."/>
</actionGroup>

<actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct1">
<argument name="sku" value="$$simpleProduct1.sku$$"/>
Expand All @@ -63,18 +65,27 @@

<!--Save the product-->
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAfterEdit"/>
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShownAgain"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShownAgain">
<argument name="message" value="You saved the product."/>
</actionGroup>

<!--See related product in admin-->
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" stepKey="scrollTo"/>
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedSee"/>
<see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedRelatedProduct}}" userInput="$$simpleProduct1.name$$" stepKey="seeRelatedProduct"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollTo"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openDropDownIfClosedRelatedSee"/>
<actionGroup ref="AssertTextInAdminProductRelatedUpSellCrossSellSectionActionGroup" stepKey="seeRelatedProduct">
<argument name="element" value="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/>
<argument name="expectedText" value="$$simpleProduct1.name$$"/>
</actionGroup>

<magentoCLI command="cron:run --group=index" stepKey="runCronIndexer"/>

<!--See related product in storefront-->
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="goToStorefront"/>
<waitForPageLoad stepKey="waitForStorefront"/>
<see userInput="$$simpleProduct1.name$$" stepKey="seeRelatedProductInStorefront"/>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToStorefront">
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefront"/>
<actionGroup ref="StorefrontAssertRelatedProductOnProductPageActionGroup" stepKey="seeRelatedProductInStorefront">
<argument name="productName" value="$$simpleProduct1.name$$"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,33 @@
</after>

<!--Go to bundle product creation page-->
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage" />
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>

<!--Create bundle product-->
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3"/>
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleOptions"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillOptionTitle"/>
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType"/>
<actionGroup ref="AdminClickAddProductToOptionActionGroup" stepKey="clickAddProductsToOption"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions">
<argument name="product" value="$$simpleProduct1$$"/>
</actionGroup>
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2">
<argument name="product" value="$$simpleProduct2$$"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItems"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption3"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptions"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOptionTitle"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectInputType"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToOption"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow2"/>
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="clickAddSelectedBundleProducts">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
</actionGroup>
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/>
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty1"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty2"/>

<!--Fill out ancillary data on bundle product-->
<actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts">
Expand All @@ -66,34 +72,46 @@

<!--Save the product-->
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
<argument name="message" value="You saved the product."/>
</actionGroup>

<!--Creating Second bundle product-->
<!--Go to bundle product creation page-->
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage2" />
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad2"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage2">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad2"/>

<!--Create bundle product 2-->
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems2"/>
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption32"/>
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleOptions2"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillOptionTitle2"/>
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType2"/>
<actionGroup ref="AdminClickAddProductToOptionActionGroup" stepKey="clickAddProductsToOption2"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptionsx2">
<argument name="product" value="$$simpleProduct3$$"/>
</actionGroup>
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRowx2"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions22">
<argument name="product" value="$$simpleProduct4$$"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItems2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption32"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptions2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillOptionTitle2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectInputType2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToOption2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptionsx2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRowx2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterBundleProductOptions22"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFirstGridRow22"/>
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="clickAddSelectedBundleProducts2">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$$simpleProduct3.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct4.sku$$"/>
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
</actionGroup>
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow22"/>
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts2"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty12"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty22"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty12"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillProductDefaultQty22"/>

<fillField selector="{{AdminProductFormBundleSection.productName}}" userInput="{{BundleProduct.name2}}" stepKey="fillProductName2"/>
<fillField selector="{{AdminProductFormBundleSection.productSku}}" userInput="{{BundleProduct.sku2}}" stepKey="fillProductSku2"/>
<actionGroup ref="AdminFillProductNameOnProductFormActionGroup" stepKey="fillProductName2">
<argument name="productName" value="{{BundleProduct.name2}}"/>
</actionGroup>
<actionGroup ref="AdminFillProductSkuOnProductFormActionGroup" stepKey="fillProductSku2">
<argument name="productSku" value="{{BundleProduct.sku2}}"/>
</actionGroup>

<!--Trigger SEO drop down-->
<scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="moveToSEOSection"/>
Expand All @@ -104,7 +122,9 @@

<!--Save the product-->
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton2"/>
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown2"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown2">
<argument name="message" value="You saved the product."/>
</actionGroup>

<!--Mass delete bundle products-->
<!--Clear Filters-->
Expand All @@ -123,13 +143,21 @@
<actionGroup ref="ClearPageCacheActionGroup" stepKey="ClearPageCaches"/>

<!--Testing deletion of products-->
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPageAgain"/>
<waitForPageLoad stepKey="WaitForProductPageToLoadToShowElement"/>
<dontSeeElement stepKey="LookingForNameOfProduct" selector="{{StorefrontBundledSection.bundleProductName}}"/>
<seeElement stepKey="LookingForPageNotFoundMessage" selector="{{StorefrontBundledSection.pageNotFound}}"/>
<amOnPage url="{{BundleProduct.urlKey2}}.html" stepKey="GoToProductPageAgain2"/>
<waitForPageLoad stepKey="WaitForProductPageToLoadToShowElement2"/>
<dontSeeElement stepKey="LookingForNameOfProduct2" selector="{{StorefrontBundledSection.bundleProductName}}"/>
<seeElement stepKey="LookingForPageNotFoundMessage2" selector="{{StorefrontBundledSection.pageNotFound}}"/>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPageAgain">
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForProductPageToLoadToShowElement"/>
<actionGroup ref="StorefrontAssertProductNameIsNotShownOnProductPageActionGroup" stepKey="LookingForNameOfProduct">
<argument name="productName" value="{{BundleProduct.name}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="LookingForPageNotFoundMessage"/>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPageAgain2">
<argument name="productUrl" value="{{BundleProduct.urlKey2}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForProductPageToLoadToShowElement2"/>
<actionGroup ref="StorefrontAssertProductNameIsNotShownOnProductPageActionGroup" stepKey="LookingForNameOfProduct2">
<argument name="productName" value="{{BundleProduct.name2}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="LookingForPageNotFoundMessage2"/>
</test>
</tests>
Loading