Skip to content

Commit bb806e5

Browse files
committed
Merge remote-tracking branch 'origin/MC-4399' into mtf-eol
2 parents 16d720c + 84d440d commit bb806e5

File tree

6 files changed

+146
-0
lines changed

6 files changed

+146
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,25 @@
241241
<click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/>
242242
</actionGroup>
243243

244+
<!--Click AddCrossSellProducts and adds product by SKU-->
245+
<actionGroup name="addCrossSellProductBySku">
246+
<arguments>
247+
<argument name="sku"/>
248+
</arguments>
249+
<!--Scroll up to avoid error-->
250+
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/>
251+
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/>
252+
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/>
253+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
254+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
255+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
256+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
257+
<waitForPageLoad stepKey="waitForPageToLoad"/>
258+
<click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
259+
<click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/>
260+
<waitForPageLoad stepKey="waitForModalDisappear"/>
261+
</actionGroup>
262+
244263
<!--Add special price to product in Admin product page-->
245264
<actionGroup name="AddSpecialPriceToProductActionGroup">
246265
<arguments>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminProductCrossSellModalSection">
12+
<element name="addSelectedProducts" type="button" selector=".product_form_product_form_related_crosssell_modal .action-primary"/>
13+
</section>
14+
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductFormRelatedUpSellCrossSellSection">
12+
<element name="sectionHeader" type="block" selector=".fieldset-wrapper.admin__collapsible-block-wrapper[data-index='related']"/>
1213
<element name="AddRelatedProductsButton" type="button" selector="button[data-index='button_related']" timeout="30"/>
1314
<element name="AddUpSellProductsButton" type="button" selector="button[data-index='button_upsell']" timeout="30"/>
15+
<element name="AddCrossSellProductsButton" type="button" selector="button[data-index='button_crosssell']" timeout="30"/>
1416
<element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='related']"/>
1517
<element name="upSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='upsell']"/>
1618
<element name="crossSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='crosssell']"/>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AddToCartCrossSellTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Promote Products as Cross-Sells"/>
15+
<title value="Admin should be able to add cross-sell to products."/>
16+
<description value="Create products, add products to cross sells, and check that they appear in the Shopping Cart page."/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-113"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<createData entity="SimpleSubCategory" stepKey="category1"/>
23+
<createData entity="_defaultProduct" stepKey="simpleProduct1">
24+
<requiredEntity createDataKey="category1"/>
25+
</createData>
26+
<createData entity="_defaultProduct" stepKey="simpleProduct2">
27+
<requiredEntity createDataKey="category1"/>
28+
</createData>
29+
<createData entity="_defaultProduct" stepKey="simpleProduct3">
30+
<requiredEntity createDataKey="category1"/>
31+
</createData>
32+
33+
<actionGroup ref="LoginAsAdmin" stepKey="logInAsAdmin"/>
34+
</before>
35+
<after>
36+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
37+
38+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimp1"/>
39+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimp2"/>
40+
<deleteData createDataKey="simpleProduct3" stepKey="deleteSimp3"/>
41+
<deleteData createDataKey="category1" stepKey="deleteCategory"/>
42+
</after>
43+
44+
<!-- Go to simpleProduct1, add simpleProduct2 and simpleProduct3 as cross-sell-->
45+
<amOnPage url="{{AdminProductEditPage.url($simpleProduct1.id$)}}" stepKey="goToProduct1"/>
46+
<click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/>
47+
48+
<actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp1">
49+
<argument name="sku" value="$simpleProduct2.sku$"/>
50+
</actionGroup>
51+
<actionGroup ref="addCrossSellProductBySku" stepKey="addProduct3ToSimp1">
52+
<argument name="sku" value="$simpleProduct3.sku$"/>
53+
</actionGroup>
54+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/>
55+
<waitForPageLoad stepKey="waitForPageLoad1"/>
56+
57+
<!-- Go to simpleProduct3, add simpleProduct1 and simpleProduct2 as cross-sell-->
58+
<amOnPage url="{{AdminProductEditPage.url($simpleProduct3.id$)}}" stepKey="goToProduct3"/>
59+
<click stepKey="openHeader2" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/>
60+
61+
<actionGroup ref="addCrossSellProductBySku" stepKey="addProduct1ToSimp3">
62+
<argument name="sku" value="$simpleProduct1.sku$"/>
63+
</actionGroup>
64+
<actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp3">
65+
<argument name="sku" value="$simpleProduct2.sku$"/>
66+
</actionGroup>
67+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave2"/>
68+
<waitForPageLoad stepKey="waitForPageLoad2"/>
69+
70+
<!-- Go to frontend, add simpleProduct1 to cart-->
71+
<actionGroup ref="AddSimpleProductToCart" stepKey="addSimp1ToCart">
72+
<argument name="product" value="$simpleProduct1$"/>
73+
</actionGroup>
74+
75+
<!-- Check that cart page contains cross-sell to simpleProduct2 and simpleProduct3-->
76+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart1"/>
77+
<waitForPageLoad stepKey="waitForCartToLoad"/>
78+
<waitForElementVisible selector="{{CheckoutCartCrossSellSection.products}}" stepKey="waitForCrossSellLoading"/>
79+
<see stepKey="seeProduct2InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/>
80+
<see stepKey="seeProduct3InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct3.name$"/>
81+
82+
<!-- Add simpleProduct3 to cart, check cross-sell contains product2 but not product3-->
83+
<click stepKey="addSimp3ToCart" selector="{{CheckoutCartCrossSellSection.productRowByName($simpleProduct3.name$)}}{{CheckoutCartCrossSellSection.addToCart}}"/>
84+
<waitForPageLoad stepKey="waitForCartToLoad2"/>
85+
<see stepKey="seeProduct2StillInCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/>
86+
<dontSee stepKey="dontSeeProduct3InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct3.name$"/>
87+
88+
<!-- Add simpleProduct2 to cart, check cross-sell doesn't contain product 2 anymore.-->
89+
<click stepKey="addSimp2ToCart" selector="{{CheckoutCartCrossSellSection.productRowByName($simpleProduct2.name$)}}{{CheckoutCartCrossSellSection.addToCart}}"/>
90+
<waitForPageLoad stepKey="waitForCartToLoad3"/>
91+
<dontSee stepKey="dontSeeProduct2InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/>
92+
</test>
93+
</tests>

app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<page name="CheckoutCartPage" url="/checkout/cart" module="Magento_Checkout" area="storefront">
1212
<section name="CheckoutCartProductSection"/>
1313
<section name="CheckoutCartSummarySection"/>
14+
<section name="CheckoutCartCrossSellSection"/>
1415
</page>
1516
</pages>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="CheckoutCartCrossSellSection">
12+
<element name="title" type="text" selector=".block.crosssell .block-title"/>
13+
<element name="products" type="block" selector=".block.crosssell .block-content"/>
14+
<element name="productRowByName" type="block" selector="//li[@class='item product product-item'and .//a[@title='{{name}}']]" parameterized="true"/>
15+
<element name="addToCart" type="block" selector="//button[@title='Add to Cart']"/>
16+
</section>
17+
</sections>

0 commit comments

Comments
 (0)