Skip to content

Commit

Permalink
Refactoring the test
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-kyzyma committed Sep 13, 2021
1 parent 84b69d1 commit 36ad6b7
Showing 1 changed file with 79 additions and 57 deletions.
136 changes: 79 additions & 57 deletions app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,48 @@
<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"/>
<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"/>


<!-- 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="$$simpleProduct0$$"/>
<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"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddSelectedBundleProducts"/>
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts1">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$$simpleProduct0.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct1.sku$$"/>
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
</actionGroup>
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterBundleProductOptions2">
<argument name="product" value="$$simpleProduct1$$"/>
</actionGroup>
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow2"/>
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>
<!-- Check that Bundle Options initialized with default quantity -->
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">
<expectedResult type="string">1</expectedResult>
<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>
</assertEquals>
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">
<expectedResult type="string">1</expectedResult>
<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>
</assertEquals>

<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/>
<!--&lt;!&ndash; Check that Bundle Options initialized with default quantity &ndash;&gt;-->
<!--<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantity"/>-->
<!--<assertEquals stepKey="assertFirstBundleOptionDefaultQuantity">-->
<!--<expectedResult type="string">1</expectedResult>-->
<!--<actualResult type="string">$grabbedFirstBundleOptionQuantity</actualResult>-->
<!--</assertEquals>-->
<!--<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantity"/>-->
<!--<assertEquals stepKey="assertSecondBundleOptionDefaultQuantity">-->
<!--<expectedResult type="string">1</expectedResult>-->
<!--<actualResult type="string">$grabbedSecondBundleOptionQuantity</actualResult>-->
<!--</assertEquals>-->

<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 @@ -81,16 +90,20 @@

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

<!--Checking on admin side-->
<scrollToTopOfPage stepKey="scroll"/>
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems2"/>
<seeElement stepKey="LookingForBundleItemPresence" selector="{{AdminProductFormBundleSection.listedBundleItem}}"/>

<!--Checking on customer side-->
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPage"/>
<waitForPageLoad stepKey="waitForBundleProductPageToLoad"/>
<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"/>
<seeElement selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="LookingForAbilityToAddOptions"/>
<click selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="clickButtonToCustomize"/>
<waitForPageLoad stepKey="waitCustomizationDropDown"/>
Expand All @@ -99,53 +112,62 @@
<!--Add another bundle option with 2 items-->
<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
<conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
<waitForPageLoad stepKey="WaitForClear"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="WaitForClear"/>
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<click selector="{{AdminProductFormBundleSection.addOptions}}" stepKey="clickOnBundleProductToEdit"/>
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItemsToEdit"/>
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption"/>
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('1')}}" stepKey="waitForBundleOptionsToAppear"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('1')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillNewestOptionTitle"/>
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('1')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectNewInputType"/>
<actionGroup ref="AdminClickAddProductToOptionActionGroup" stepKey="clickAddProductsToNewOption"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions">
<argument name="product" value="$$simpleProduct2$$"/>
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickOnBundleProductToEdit">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<checkOption selector="//div[@class='admin__data-grid-outer-wrap']//tr[@data-repeat-index='0']//input[@type='checkbox']" stepKey="selectNewFirstGridRow"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterNewBundleProductOptions2">
<argument name="product" value="$$simpleProduct3$$"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="conditionallyOpenSectionBundleItemsToEdit"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddOption"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleOptionsToAppear"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewestOptionTitle"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewInputType"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddProductsToNewOption"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterNewBundleProductOptions"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewFirstGridRow"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterNewBundleProductOptions2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectNewFirstGridRow2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickAddNewSelectedBundleProducts"/>
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2">
<argument name="x" value="1"/>
<argument name="n" value="2"/>
<argument name="prodOneSku" value="$$simpleProduct2.sku$$"/>
<argument name="prodTwoSku" value="$$simpleProduct3.sku$$"/>
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
<argument name="inputType" value="{{BundleProduct.optionInputType1}}"/>
</actionGroup>
<checkOption selector="{{AdminProductFormBundleSection.firstProductOption}}" stepKey="selectNewFirstGridRow2"/>
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddNewSelectedBundleProducts"/>

<!-- Check that existing Bundle Options do not loose user input quantity values -->
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" stepKey="grabbedFirstBundleOptionQuantityAfterUserInput"/>
<assertEquals stepKey="assertFirstBundleOptionDefaultQuantityAfterUserInput">
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
<expectedResult type="string">50</expectedResult>
<actualResult type="string">$grabbedFirstBundleOptionQuantityAfterUserInput</actualResult>
</assertEquals>
<grabValueFrom selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" stepKey="grabbedSecondBundleOptionQuantityAfterUserInput"/>
<assertEquals stepKey="assertSecondBundleOptionDefaultQuantityAfterUserInput">
<expectedResult type="string">{{BundleProduct.defaultQuantity}}</expectedResult>
<expectedResult type="string">50</expectedResult>
<actualResult type="string">$grabbedSecondBundleOptionQuantityAfterUserInput</actualResult>
</assertEquals>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '2')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillNewProductDefaultQty1"/>
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '3')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillNewProductDefaultQty2"/>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewProductDefaultQty1"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillNewProductDefaultQty2"/>
<!--Save the product-->
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonAgain"/>
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShownAgain"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShownAgain">
<argument name="message" value="You saved the product."/>
</actionGroup>

<!--Checking on admin side-->
<scrollToTopOfPage stepKey="scrollAgain"/>
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenNewSectionBundleItems2"/>
<seeElement selector="{{AdminProductFormBundleSection.listedBundleItem2}}" stepKey="LookingForNewBundleItemPresence"/>

<!--Checking on customer side-->
<amOnPage url="{{BundleProduct.urlKey}}.html" stepKey="GoToProductPageAgain"/>
<waitForPageLoad stepKey="waitForBundleProductPageToLoadAgain"/>
<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="waitForBundleProductPageToLoadAgain"/>
<seeElement selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="LookingForAbilityToAddBothOptions"/>
<click selector="{{StorefrontBundledSection.customizeProduct}}" stepKey="clickButtonAgainToCustomize"/>
<waitForPageLoad stepKey="waitForBothCustomizationDropDown"/>
Expand Down

0 comments on commit 36ad6b7

Please sign in to comment.