Skip to content

Commit 21f33bc

Browse files
author
Alexander Akimov
authored
Merge pull request #2860 from magento-tsg/2.2-develop-mftf-pr3
[TSG] MFTF for 2.2 (pr3) (2.2.6)
2 parents ff31001 + 205b628 commit 21f33bc

File tree

48 files changed

+1428
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1428
-3
lines changed

app/code/Magento/Bundle/Test/Mftf/Data/BundleProductData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
<entity name="BundleProduct" type="product">
1212
<data key="type_id">bundle</data>
1313
<data key="attribute_set_id">4</data>
14+
<data key="optionTitle1">BundleOption</data>
15+
<data key="optionInputType1">checkbox</data>
16+
<data key="defaultQuantity">10</data>
1417
<data key="name" unique="suffix">BundleProduct</data>
1518
<data key="sku" unique="suffix">BundleProduct</data>
1619
<data key="status">1</data>
20+
<data key="urlKey" unique="suffix">bundleproduct</data>
1721
<data key="visibility">4</data>
1822
<data key="option_title" unique="suffix">TestOption</data>
1923
<data key="input_type" >Drop-down</data>
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11+
<page name="AdminProductCreatePage" url="catalog/product/new/set/{{set}}/type/{{type}}/" area="admin" module="Magento_Catalog" parameterized="true">
12+
<section name="AdminProductFormBundleSection"/>
13+
</page>
14+
</pages>
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11+
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Magento_Catalog" parameterized="true">
12+
<section name="StorefrontBundledSection"/>
13+
</page>
14+
</pages>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductFormBundleSection">
12+
<element name="bundleItemsToggle" type="button" selector="//span[text()='Bundle Items']"/>
13+
<element name="addOption" type="button" selector="button[data-index='add_button']"/>
14+
<element name="bundleOptionXTitle" type="input" selector="[name='bundle_options[bundle_options][{{x}}][title]']" parameterized="true"/>
15+
<element name="bundleOptionXInputType" type="select" selector="[name='bundle_options[bundle_options][{{x}}][type]']" parameterized="true"/>
16+
<element name="addProductsToOption" type="button" selector="[data-index='modal_set']" timeout="30"/>
17+
<element name="bundleOptionXProductYQuantity" type="input" selector="[name='bundle_options[bundle_options][{{x}}][bundle_selections][{{y}}][selection_qty]']" parameterized="true"/>
18+
<element name="bundledItems" type="block" selector="[data-index=bundle-items]"/>
19+
</section>
20+
</sections>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="StorefrontBundledSection">
12+
<element name="bundleOption" type="input" selector=".option:nth-of-type({{numOption}}) .choice:nth-of-type({{numOptionSelect}}) input" parameterized="true"/>
13+
<element name="addToCart" type="button" selector="#bundle-slide" timeout="30"/>
14+
<element name="addToCartConfigured" type="button" selector="#product-addtocart-button" timeout="30"/>
15+
<element name="updateCart" type="button" selector="#product-updatecart-button" timeout="30"/>
16+
<element name="configuredPrice" type="block" selector=".price-configured_price .price"/>
17+
</section>
18+
</sections>
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="StorefrontEditBundleProductTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Bundle products list on Storefront"/>
15+
<title value="Customer should be able to change chosen options for Bundle Product when clicking Edit button in Shopping Cart page"/>
16+
<description value="Customer should be able to change chosen options for Bundle Product when clicking Edit button in Shopping Cart page"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-77523"/>
19+
<group value="bundle"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<createData entity="SimpleProduct3" stepKey="simpleProduct1"/>
24+
<createData entity="SimpleProduct3" stepKey="simpleProduct2"/>
25+
</before>
26+
<after>
27+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
28+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
29+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
30+
</after>
31+
32+
<!-- Create a bundle product -->
33+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/>
34+
<waitForPageLoad stepKey="waitForProductPageLoadBundle"/>
35+
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct">
36+
<argument name="product" value="BundleProduct"/>
37+
</actionGroup>
38+
39+
<actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillBundleProductNameAndSku">
40+
<argument name="product" value="BundleProduct"/>
41+
</actionGroup>
42+
43+
<!-- Add two bundle items -->
44+
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
45+
<scrollTo selector="{{AdminProductFormBundleSection.bundledItems}}" stepKey="scrollToBundleItems"/>
46+
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3"/>
47+
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleOptions"/>
48+
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillOptionTitle"/>
49+
<selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType"/>
50+
<waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle"/>
51+
<click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption"/>
52+
<waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts"/>
53+
<actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions">
54+
<argument name="product" value="$$simpleProduct1$$"/>
55+
</actionGroup>
56+
<checkOption selector="{{AdminAddProductsToOptionPanelSection.firstCheckbox}}" stepKey="selectFirstGridRow"/>
57+
<actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions2">
58+
<argument name="product" value="$$simpleProduct2$$"/>
59+
</actionGroup>
60+
<checkOption selector="{{AdminAddProductsToOptionPanelSection.firstCheckbox}}" stepKey="selectFirstGridRow2"/>
61+
<click selector="{{AdminAddProductsToOptionPanelSection.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>
62+
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty1"/>
63+
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty2"/>
64+
65+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductBundle"/>
66+
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="assertSuccess"/>
67+
68+
<!-- Go to the storefront bundled product page -->
69+
<amOnPage url="/{{BundleProduct.urlKey}}.html" stepKey="visitStoreFrontBundle"/>
70+
<waitForPageLoad stepKey="waitForStorefront"/>
71+
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="customizeAndAddToCart"/>
72+
<waitForPageLoad stepKey="waitCustomizableOptionsPopUp"/>
73+
74+
<!-- add two products to the shopping cart, each with one different option -->
75+
<click selector="{{StorefrontBundledSection.bundleOption('1','1')}}" stepKey="selectFirstBundleOption"/>
76+
<waitForPageLoad stepKey="waitForPriceUpdate"/>
77+
<see selector="{{StorefrontBundledSection.configuredPrice}}" userInput="1,230.00" stepKey="seeSinglePrice"/>
78+
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="addFirstItemToCart"/>
79+
<waitForPageLoad stepKey="waitForElementAdded"/>
80+
81+
<click selector="{{StorefrontBundledSection.bundleOption('1','1')}}" stepKey="unselectFirstBundleOption"/>
82+
<click selector="{{StorefrontBundledSection.bundleOption('1','2')}}" stepKey="selectSecondBundleOption"/>
83+
<waitForPageLoad stepKey="waitForPriceUpdate2"/>
84+
<see selector="{{StorefrontBundledSection.configuredPrice}}" userInput="1,230.00" stepKey="seeSinglePrice2"/>
85+
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="addSecondItemToCart"/>
86+
<waitForPageLoad stepKey="waitForElementAdded2"/>
87+
88+
<!-- Go to the shopping cart page and edit the first product -->
89+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
90+
<waitForPageLoad stepKey="waitForCartPageLoad"/>
91+
<waitForElementVisible selector="{{CheckoutCartSummarySection.total}}" stepKey="waitForInfoDropdown"/>
92+
<waitForPageLoad stepKey="waitForCartPageLoad3"/>
93+
<grabTextFrom selector="{{CheckoutCartSummarySection.total}}" stepKey="grabTotalBefore"/>
94+
<click selector="{{CheckoutCartProductSection.editItemParametersButton('1')}}" stepKey="clickEdit"/>
95+
<waitForPageLoad stepKey="waitForStorefront2"/>
96+
97+
<!-- Choose both of the options on the storefront -->
98+
<click selector="{{StorefrontBundledSection.bundleOption('1','1')}}" stepKey="selectFirstBundleOption2"/>
99+
<click selector="{{StorefrontBundledSection.bundleOption('1','2')}}" stepKey="selectSecondBundleOption2"/>
100+
101+
<waitForPageLoad stepKey="waitForPriceUpdate3"/>
102+
<see selector="{{StorefrontBundledSection.configuredPrice}}" userInput="2,460.00" stepKey="seeDoublePrice"/>
103+
104+
<click selector="{{StorefrontBundledSection.updateCart}}" stepKey="addFirstItemToCart2"/>
105+
<waitForPageLoad stepKey="waitForElementAdded3"/>
106+
107+
<!-- Go to the shopping cart page -->
108+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart2"/>
109+
<waitForPageLoad stepKey="waitForCartPageLoad2"/>
110+
111+
<!-- Assert that the options are both there and the proce no longer matches -->
112+
<see selector="{{CheckoutCartProductSection.itemOptionsBlock('2')}}" userInput="$$simpleProduct1.sku$$" stepKey="assertBothOptions"/>
113+
<see selector="{{CheckoutCartProductSection.itemOptionsBlock('2')}}" userInput="$$simpleProduct2.sku$$" stepKey="assertBothOptions2"/>
114+
<waitForElementVisible selector="{{CheckoutCartSummarySection.total}}" stepKey="waitForInfoDropdown2"/>
115+
<waitForPageLoad stepKey="waitForCartPageLoad4"/>
116+
<grabTextFrom selector="{{CheckoutCartSummarySection.total}}" stepKey="grabTotalAfter"/>
117+
<assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/>
118+
119+
<!-- Delete the bundled product -->
120+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundle">
121+
<argument name="product" value="BundleProduct"/>
122+
</actionGroup>
123+
</test>
124+
</tests>

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,30 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8+
89
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
910
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<!--Navigate to create product page from product grid page-->
12+
<actionGroup name="goToCreateProductPage">
13+
<arguments>
14+
<argument name="product" defaultValue="_defaultProduct"/>
15+
</arguments>
16+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/>
17+
<waitForElementVisible selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="waitForAddProductDropdown" time="30"/>
18+
<click selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="clickAddProductType"/>
19+
<waitForPageLoad stepKey="waitForCreateProductPageLoad"/>
20+
<seeInCurrentUrl url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, product.type_id)}}" stepKey="seeNewProductUrl"/>
21+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/>
22+
</actionGroup>
23+
24+
<!--Fill main fields in create product form with name and sku -->
25+
<actionGroup name="fillProductNameAndSkuInProductForm">
26+
<arguments>
27+
<argument name="product"/>
28+
</arguments>
29+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/>
30+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/>
31+
</actionGroup>
1032

1133
<!--Fill main fields in create product form with no weight, useful for virtual and downloadable products -->
1234
<actionGroup name="fillMainProductFormNoWeight">
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminProductCheckUnsupportedFileActionGroup">
12+
<arguments>
13+
<argument name="filename" type="string"/>
14+
</arguments>
15+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{filename}}" stepKey="attachImage"/>
16+
<waitForPageLoad stepKey="waitForUploadImage"/>
17+
<see selector="{{AdminConfirmationModalSection.message}}" userInput="We don't recognize or support this file extension type." stepKey="seeErrorMessage"/>
18+
<click selector="{{AdminProductImagesSection.modalOkBtn}}" stepKey="closeModal"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,37 @@
1616
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
1717
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
1818
</actionGroup>
19+
20+
<!--Filter the product grid by the SKU field-->
21+
<actionGroup name="filterProductGridBySku">
22+
<arguments>
23+
<argument name="product" defaultValue="_defaultProduct"/>
24+
</arguments>
25+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
26+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
27+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
28+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
29+
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
30+
</actionGroup>
31+
32+
<!--Delete a product by filtering grid and using delete action-->
33+
<actionGroup name="deleteProductUsingProductGrid">
34+
<arguments>
35+
<argument name="product"/>
36+
</arguments>
37+
<!--TODO use other action group for filtering grid when MQE-539 is implemented -->
38+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
39+
<waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/>
40+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
41+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
42+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
43+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
44+
<see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/>
45+
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/>
46+
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/>
47+
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
48+
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
49+
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
50+
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
51+
</actionGroup>
1952
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@
6464
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
6565
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
6666
</entity>
67+
<entity name="SimpleProduct3" type="product">
68+
<data key="sku" unique="suffix">SimpleProduct</data>
69+
<data key="type_id">simple</data>
70+
<data key="attribute_set_id">4</data>
71+
<data key="name" unique="suffix">SimpleProduct</data>
72+
<data key="price">123.00</data>
73+
<data key="visibility">4</data>
74+
<data key="status">1</data>
75+
<data key="quantity">1000</data>
76+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
77+
</entity>
6778
<entity name="SimpleOne" type="product2">
6879
<data key="sku" unique="suffix">SimpleOne</data>
6980
<data key="type_id">simple</data>

0 commit comments

Comments
 (0)