Skip to content

Commit f84bb74

Browse files
authored
Merge pull request #2535 from magento-tango/MAGETWO-89726
[MAGETWO-89726] Test *Create bundle product* should be automated
2 parents 8c0ac6d + f18fe59 commit f84bb74

15 files changed

+250
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CreateBundleProductForTwoSimpleProducts">
12+
<arguments>
13+
<argument name="bundleProduct"/>
14+
</arguments>
15+
<fillField userInput="{{bundleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillProductSku"/>
16+
<fillField userInput="{{bundleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillProductName"/>
17+
<click selector="{{AdminProductFormSection.productName}}" stepKey="clickOnProductNameField"/>
18+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createPreReqCategory.name$$]" stepKey="searchAndSelectCategory"/>
19+
<click selector="{{AdminProductFormBundleSection.AddOption}}" stepKey="clickAddOptionButton"/>
20+
<fillField userInput="{{bundleProduct.option_title}}" selector="{{AdminProductFormBundleSection.OptionTitle}}" stepKey="fillOptionTitle"/>
21+
<click selector="{{AdminProductFormBundleSection.AddProductsToOption}}" stepKey="clickAddProductsToOption"/>
22+
<click selector="{{AdminProductFormBundleSection.selectAll}}" stepKey="tickSelectAllCheckbox"/>
23+
<click selector="{{AdminProductFormBundleSection.AddSelectedProducts}}" stepKey="clickAddSelectedProductsButton"/>
24+
<fillField userInput="{{bundleProduct.default_quantity1}}" selector="{{AdminProductFormBundleSection.DefaultQuantity1}}" stepKey="fillDefaultQuantityForFirstProduct"/>
25+
<fillField userInput="{{bundleProduct.default_quantity2}}" selector="{{AdminProductFormBundleSection.DefaultQuantity2}}" stepKey="fillDefaultQuantityForSecondProduct"/>
26+
</actionGroup>
27+
28+
<actionGroup name="OpenNewBundleProductPage">
29+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductsGridPage"/>
30+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
31+
<click selector="{{AdminProductGridActionSection.addBundleProduct}}" stepKey="goToNewBundleProductPage"/>
32+
</actionGroup>
33+
</actionGroups>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="BundleProduct" type="product">
12+
<data key="type_id">bundle</data>
13+
<data key="attribute_set_id">4</data>
14+
<data key="name" unique="suffix">BundleProduct</data>
15+
<data key="sku" unique="suffix">BundleProduct</data>
16+
<data key="status">1</data>
17+
<data key="visibility">4</data>
18+
<data key="option_title" unique="suffix">TestOption</data>
19+
<data key="input_type" >Drop-down</data>
20+
<data key="default_quantity1" >10</data>
21+
<data key="default_quantity2" >20</data>
22+
<data key="input_type" >Drop-down</data>
23+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
24+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
25+
</entity>
26+
</entities>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductFormBundleSection">
12+
<element name="AddOption" type="button" selector="//button[@data-index='add_button']" timeout="30"/>
13+
<element name="OptionTitle" type="input" selector="//input[@name='bundle_options[bundle_options][0][title]']" timeout="30"/>
14+
<element name="InputTypeToggle" type="select" selector="//input[@name='bundle_options[bundle_options][0][title]']" timeout="30"/>
15+
<element name="AddProductsToOption" type="button" selector="//button[@data-index='modal_set']" timeout="30"/>
16+
<element name="DefaultQuantity1" type="input" selector="//input[@name='bundle_options[bundle_options][0][bundle_selections][0][selection_qty]']" timeout="30"/>
17+
<element name="DefaultQuantity2" type="input" selector="//input[@name='bundle_options[bundle_options][0][bundle_selections][1][selection_qty]']" timeout="30"/>
18+
<element name="Save" type="button" selector="//button[@id='save-button']" timeout="30"/>
19+
20+
<!--Add Products to Option-->
21+
<element name="selectAll" type="input" selector="//label[@data-bind='attr: {for: ko.uid}']"/>
22+
<element name="AddSelectedProducts" type="button" selector="//span[contains(text(),'Add Selected Products')]/ancestor::button" timeout="30"/>
23+
</section>
24+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminCreateBundleProductTest">
12+
<annotations>
13+
<features value="Product Creation"/>
14+
<stories value="Create a Bundle Product via Admin"/>
15+
<title value="You should be able to create a Bundle Product in the Magento Admin"/>
16+
<description value="You should be able to create a Bundle Product in the Magento Admin"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-77417"/>
19+
<group value="product"/>
20+
</annotations>
21+
<before>
22+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
23+
<createData entity="SimpleProduct" stepKey="createPreReqSimpleProduct1">
24+
<requiredEntity createDataKey="createPreReqCategory"/>
25+
</createData>
26+
<createData entity="SimpleProduct2" stepKey="createPreReqSimpleProduct2">
27+
<requiredEntity createDataKey="createPreReqCategory"/>
28+
</createData>
29+
</before>
30+
<after>
31+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
32+
<deleteData createDataKey="createPreReqSimpleProduct1" stepKey="deletePreReqSimpleProduct1"/>
33+
<deleteData createDataKey="createPreReqSimpleProduct2" stepKey="deletePreReqSimpleProduct2"/>
34+
<actionGroup ref="DeleteProductOnProductsGridPageByName" stepKey="DeleteProductOnProductsGridPageByName">
35+
<argument name="product" value="BundleProduct"/>
36+
</actionGroup>
37+
</after>
38+
<!--Step1. Login as admin-->
39+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin" />
40+
41+
<!--Step2. Navigate to the Products>Inventory>Catalog-->
42+
<!--Step3. Click on "+" dropdown and select Bundle Product type-->
43+
<actionGroup ref="OpenNewBundleProductPage" stepKey="OpenNewBundleProductPage"/>
44+
45+
<!--Step4. Fill in all data according to data set-->
46+
<actionGroup ref="CreateBundleProductForTwoSimpleProducts" stepKey="CreateBundleProductForTwoSimpleProducts">
47+
<argument name="bundleProduct" value="BundleProduct"/>
48+
</actionGroup>
49+
50+
<!--Step5. Save product-->
51+
<actionGroup ref="SaveProductOnProductPageOnAdmin" stepKey="SaveProductOnProductPageOnAdmin"/>
52+
53+
<!--Step6. Verify created bundle product in the Magento Admin-->
54+
<actionGroup ref="CheckVisibilityOfProductOnProductsGridPageByName" stepKey="CheckVisibilityOfProductOnProductsGridPageByName">
55+
<argument name="product" value="BundleProduct"/>
56+
</actionGroup>
57+
58+
<!--Step6. Verify created bundle product on Front End-->
59+
<actionGroup ref="CheckVisibilityOfProductOnCategoryPageByName" stepKey="CheckVisibilityOfProductOnPageByName">
60+
<argument name="product" value="BundleProduct"/>
61+
</actionGroup>
62+
</test>
63+
</tests>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AddProductToCartActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
<waitForPageLoad stepKey="waitForPageLoad"/>
3131
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
3232
</actionGroup>
33-
</actionGroups>
33+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="SaveProductOnProductPageOnAdmin">
12+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
13+
<see userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
14+
</actionGroup>
15+
16+
<actionGroup name="DeleteProductOnProductsGridPageByName">
17+
<arguments>
18+
<argument name="product"/>
19+
</arguments>
20+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductsGridPage"/>
21+
<waitForPageLoad stepKey="waitForPageLoad"/>
22+
<click selector="{{AdminProductGridSection.checkbox(product.name)}}" stepKey="tickCheckbox"/>
23+
<click selector="{{AdminProductGridActionSection.actionsSelectBox}}" stepKey="openActionsSelectBox"/>
24+
<click selector="{{AdminProductGridActionSection.deleteOptionInActionsSelectBox}}" stepKey="clickDeleteAction"/>
25+
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
26+
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="clickOkInConfirmation"/>
27+
</actionGroup>
28+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CheckVisibilityOfProductOnProductsGridPageByName">
12+
<arguments>
13+
<argument name="product"/>
14+
</arguments>
15+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductsGridPage"/>
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
<see userInput="{{product.name}}" selector="{{AdminProductGridSection.productNameInNameColumn}}" stepKey="seeBundleProductInProductNameColumn"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CheckVisibilityOfProductOnCategoryPageByName">
12+
<arguments>
13+
<argument name="product"/>
14+
</arguments>
15+
<amOnPage url="{{StorefrontCategoryPage.url($$createPreReqCategory.name$$)}}" stepKey="amOnStorefrontTestCategoryPage"/>
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
<see userInput="{{product.name}}" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="seeProductNameOnPage"/>
18+
</actionGroup>
19+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="productAttributeWithTwoOptions" type="ProductAttribute">
12+
<data key="name" unique="suffix">ProductAttributeWithTwoOptions</data>
1213
<data key="attribute_code" unique="suffix">attribute</data>
1314
<data key="frontend_input">textarea</data>
1415
<data key="scope">global</data>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@
2626
<data key="type_id">simple</data>
2727
<data key="attribute_set_id">4</data>
2828
<data key="name" unique="suffix">SimpleProduct</data>
29-
<data key="price">123.00</data>
29+
<data key="price">200.00</data>
3030
<data key="visibility">4</data>
3131
<data key="status">1</data>
3232
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
3333
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
3434
</entity>
35-
<entity name="NewSimpleProduct" type="product">
36-
<data key="price">321.00</data>
35+
<entity name="SimpleProduct2" type="product">
36+
<data key="sku" unique="suffix">SimpleProduct2</data>
37+
<data key="type_id">simple</data>
38+
<data key="attribute_set_id">4</data>
39+
<data key="name" unique="suffix">SimpleProduct2</data>
40+
<data key="price">300.00</data>
41+
<data key="visibility">4</data>
42+
<data key="status">1</data>
43+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
44+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
3745
</entity>
3846
<entity name="SimpleOne" type="product2">
3947
<data key="sku" unique="suffix">SimpleOne</data>
@@ -44,7 +52,7 @@
4452
<data key="visibility">4</data>
4553
<data key="status">1</data>
4654
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
47-
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
55+
<requiredEntity type="custom_attributes">CustomAttributeProductAttribute</requiredEntity>
4856
</entity>
4957
<entity name="ImageUpload" type="uploadImage">
5058
<data key="title" unique="suffix">Image1</data>

0 commit comments

Comments
 (0)