Skip to content

Replace repetitive actions with Action Groups in AdminProductBundleCreationTest #34076

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,34 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- go to bundle product creation page-->
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage" />
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>

<!-- Add two bundle items -->
<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 ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</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="waitForBundleProductCreatePageToLoad"/>

<!-- Add two bundle items -->
<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"/>

<!--Create a bundle product with ancillary data-->
<actionGroup ref="CreateBasicBundleProductActionGroup" stepKey="createBundledProduct">
Expand All @@ -65,13 +72,19 @@

<!--save the product/published by default-->
<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>

<!-- go to page-->
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPage"/>

<!--Test Assertion - on correct page/page has been published-->
<waitForPageLoad stepKey="waitForBundleProductPageToLoad"/>
<seeElement stepKey="LookingForNameOfProduct" selector="{{StorefrontBundledSection.bundleProductName}}"/>

<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductPageToLoad"/>
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="LookingForNameOfProduct">
<argument name="productName" value="{{BundleProduct.name}}"/>
</actionGroup>
</test>
</tests>