Skip to content

Commit

Permalink
ENGCOM-7169: MFTF: Refactor \amOnPage\ for Admin product edit page #…
Browse files Browse the repository at this point in the history
…27378

 - Merge Pull Request #27378 from lbajsarowicz/magento2:mftf/admin-product-page-by-id
 - Merged commits:
   1. 722be2f
   2. 2e273eb
   3. 1d3cfbb
   4. 14ea469
  • Loading branch information
magento-engcom-team committed Mar 21, 2020
2 parents a95a465 + 14ea469 commit c7e5171
Show file tree
Hide file tree
Showing 58 changed files with 241 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</after>

<!-- Create a cart price rule with 10% discount for whole cart -->
<click selector="{{AdminMenuSection.marketing}}" stepKey="clickOnMarketing" />
<click selector="{{AdminMenuSection.marketing}}" stepKey="clickOnMarketing"/>
<waitForPageLoad stepKey="waitForMarketing"/>
<click selector="{{CartPriceRulesSubmenuSection.cartPriceRules}}" stepKey="clickOnCartPriceRules"/>
<waitForPageLoad stepKey="waitForCartPriceRules"/>
Expand All @@ -93,7 +93,9 @@
<actionGroup ref="ChangeShippingTaxClassActionGroup" stepKey="changeShippingTaxClass"/>

<!--Adding Special price to product-->
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="openAdminProductEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminProductEditPage">
<argument name="productId" value="$$simpleProduct.id$$"/>
</actionGroup>
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPrice"/>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@
<requiredEntity createDataKey="bundleOption"/>
<requiredEntity createDataKey="createSimpleProduct2"/>
</createData>
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
<argument name="productId" value="$$createProduct.id$$"/>
</actionGroup>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
</before>
<after>
<!-- Delete created data -->
<comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/>
<deleteData createDataKey="createCustomerViaTheStorefront" stepKey="deleteCustomerViaTheStorefront"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct" />
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<!-- Log out -->
<comment userInput="Log out" stepKey="commentLogOut"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand All @@ -74,8 +76,8 @@
<actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addToWishlistProduct">
<argument name="productVar" value="$$createProduct$$"/>
</actionGroup>
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName($$createProduct.name$$)}}" stepKey="moveMouseOverProduct" />
<click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName($$createProduct.name$$)}}" stepKey="clickAddToCart" />
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName($$createProduct.name$$)}}" stepKey="moveMouseOverProduct"/>
<click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName($$createProduct.name$$)}}" stepKey="clickAddToCart"/>
<waitForPageLoad stepKey="waitForProductBundlePage"/>
<!-- See error message -->
<comment userInput="See error message" stepKey="commentSeeErrorMessage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@
<!-- Add tier prices to simple products -->
<!-- Simple product 1 -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct1CreateBundleProduct.id$$)}}" stepKey="openAdminEditPageProduct1"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminEditPageProduct1">
<argument name="productId" value="$$simpleProduct1CreateBundleProduct.id$$"/>
</actionGroup>
<actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="addTierPriceProduct1">
<argument name="group" value="ALL GROUPS"/>
<argument name="quantity" value="5"/>
<argument name="price" value="Discount"/>
<argument name="amount" value="50"/>
</actionGroup>
<!-- Simple product 2 -->
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct2CreateBundleProduct.id$$)}}" stepKey="openAdminEditPageProduct2"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminEditPageProduct2">
<argument name="productId" value="$$simpleProduct2CreateBundleProduct.id$$"/>
</actionGroup>
<actionGroup ref="ProductSetAdvancedPricingActionGroup" stepKey="addTierPriceProduct2">
<argument name="group" value="ALL GROUPS"/>
<argument name="quantity" value="7"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@

<!--Add special price to simple product-->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct5.id$$)}}" stepKey="openAdminEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminEditPage">
<argument name="productId" value="$$simpleProduct5.id$$"/>
</actionGroup>
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPrice"/>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="GoToProductPageViaIDActionGroup">
<annotations>
<description>Goes to the Product edit page for the provided Product ID.</description>
</annotations>
<actionGroup name="AdminProductPageOpenByIdActionGroup">
<arguments>
<argument name="productId" type="string"/>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="GoToProductPageViaIDActionGroup" extends="AdminProductPageOpenByIdActionGroup" deprecated="Use AdminProductPageOpenByIdActionGroup instead"/>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AddToCartCrossSellTest">
<annotations>
<features value="Catalog"/>
Expand Down Expand Up @@ -42,7 +42,9 @@
</after>

<!-- Go to simpleProduct1, add simpleProduct2 and simpleProduct3 as cross-sell-->
<amOnPage url="{{AdminProductEditPage.url($simpleProduct1.id$)}}" stepKey="goToProduct1"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProduct1">
<argument name="productId" value="$simpleProduct1.id$"/>
</actionGroup>
<click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/>

<actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addProduct2ToSimp1">
Expand All @@ -55,7 +57,9 @@
<waitForPageLoad stepKey="waitForPageLoad1"/>

<!-- Go to simpleProduct3, add simpleProduct1 and simpleProduct2 as cross-sell-->
<amOnPage url="{{AdminProductEditPage.url($simpleProduct3.id$)}}" stepKey="goToProduct3"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProduct3">
<argument name="productId" value="$simpleProduct3.id$"/>
</actionGroup>
<click stepKey="openHeader2" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/>

<actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addProduct1ToSimp3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
</after>

<!-- Open created product for edit -->
<amOnPage url="{{AdminProductEditPage.url($createSimpleProduct.id$)}}" stepKey="goToProductEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
<argument name="productId" value="$createSimpleProduct.id$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad"/>

<!-- Add created attribute to the product -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/>
</after>

<actionGroup ref="GoToProductPageViaIDActionGroup" stepKey="goToSimpleProduct">
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToSimpleProduct">
<argument name="productId" value="$$createSimpleProduct.id$$"/>
</actionGroup>
<actionGroup ref="AdminOpenProductImagesSectionActionGroup" stepKey="openProductImagesSection"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
</after>
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
<argument name="productId" value="$$createSimpleProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForSimpleProductPageLoad"/>
<!--Save and duplicated the product once-->
<comment userInput="Save and duplicated the product once" stepKey="commentSaveAndDuplicateProduct"/>
Expand All @@ -45,7 +47,9 @@
<assertContains expectedType="string" expected="-1" actual="$grabDuplicatedProductUrlKey" stepKey="assertDuplicatedProductUrlKey1"/>
<!--Add duplicated product to the simple product-->
<comment userInput="Add duplicated product to the simple product" stepKey="commentAddProduct"/>
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToSimpleProductPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToSimpleProductPage">
<argument name="productId" value="$$createSimpleProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForSimpleProductPageLoad1"/>
<actionGroup ref="AddCrossSellProductBySkuActionGroup" stepKey="addCrossSellProduct">
<argument name="sku" value="$$createSimpleProduct.sku$$"/>
Expand All @@ -63,7 +67,9 @@
<see selector="{{AdminProductFormRelatedUpSellCrossSellSection.selectedProductSku('crosssell')}}" userInput="$$createSimpleProduct.sku$$-1" stepKey="seeCrossSellProduct"/>
<!--Save and duplicated the product second time-->
<comment userInput="Save and duplicated the product second time" stepKey="commentSaveAndDuplicateProduct1"/>
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage1"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage1">
<argument name="productId" value="$$createSimpleProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForSimpleProductPageLoad2"/>
<actionGroup ref="AdminFormSaveAndDuplicateActionGroup" stepKey="saveAndDuplicateProductFormSecondTime"/>
<conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.urlKeyInput}}" visible="false" stepKey="openProductSEOSection"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
</actionGroup>

<!--Go to created product page and create new attribute-->
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="openAdminEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminEditPage">
<argument name="productId" value="$$createProduct.id$$"/>
</actionGroup>
<actionGroup ref="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPageActionGroup" stepKey="createAttribute">
<argument name="attributeName" value="{{productDropDownAttribute.attribute_code}}"/>
<argument name="attributeType" value="Dropdown"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@
<createData entity="SimpleProduct2" stepKey="createProduct"/>
<createData entity="SubCategory" stepKey="createSubCategory"/>
<createData entity="NewRootCategory" stepKey="createRootCategory"/>
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="visitAdminProductPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="visitAdminProductPage">
<argument name="productId" value="$$createProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad0"/>
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="['Default Category', $$createRootCategory.name$$, $$createSubCategory.name$$]" stepKey="fillCategory"/>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
<!--Add images to the product-->
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="visitAdminProductPage2"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="visitAdminProductPage2">
<argument name="productId" value="$$createProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad1"/>
<actionGroup ref="AddProductImageActionGroup" stepKey="addImageToProduct">
<argument name="image" value="ProductImage"/>
Expand Down Expand Up @@ -80,7 +84,9 @@
<click selector="{{AdminStoresGridSection.resetButton}}" stepKey="clickResetButton"/>
<waitForPageLoad stepKey="waitForStorePageLoad"/>
<!--Open product page on admin-->
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="openProductEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
<argument name="productId" value="$$createProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
<!--Enable the newly created website and save the product-->
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToEditPage"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToEditPage">
<argument name="productId" value="$$createSimpleProduct.id$$"/>
</actionGroup>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToDefaultStoreView">
<argument name="storeView" value="_defaultStore.name"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
</after>
<!--Change second product sku to first product sku-->
<amOnPage url="{{AdminProductEditPage.url($$createSecondProduct.id$$)}}" stepKey="goToProductEditPage1"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage1">
<argument name="productId" value="$$createSecondProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductEditPageLoad1"/>
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="$$createFirstProduct.sku$$" stepKey="fillProductSku1"/>
<!--Import customizable options and check-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/>

<!-- Assign <product1> to the <Sub1> -->
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProduct">
<argument name="productId" value="$$simpleProduct.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDownCategory"/>
<fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearch"/>
Expand Down
Loading

0 comments on commit c7e5171

Please sign in to comment.