Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 225d00b

Browse files
authored
Merge pull request #2038 from magento-borg/MAGETWO-80489-B2C-admin-create-products
Fixed issues: - MAGETWO-80489 Implement Step 1 of B2C Admin scenario "Admin creates product"
2 parents 054d060 + dd97421 commit 225d00b

File tree

57 files changed

+1360
-52
lines changed

Some content is hidden

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

57 files changed

+1360
-52
lines changed
Loading
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminHeaderSection">
12+
<element name="pageTitle" type="text" selector=".page-header h1.page-title"/>
13+
</section>
14+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
<!--Fill main fields in create product form-->
12+
<actionGroup name="fillMainBundleProductForm">
13+
<arguments>
14+
<argument name="product" defaultValue="BundleProduct"/>
15+
</arguments>
16+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/>
17+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/>
18+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/>
19+
</actionGroup>
20+
21+
<!--Check that required fields are actually required-->
22+
<actionGroup name="checkRequiredFieldsInBundleProductForm">
23+
<clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/>
24+
<clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/>
25+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
26+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/>
27+
<see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/>
28+
<see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/>
29+
</actionGroup>
30+
31+
<!--Filter product grid and see expected product-->
32+
<actionGroup name="viewBundleProductInAdminGrid">
33+
<arguments>
34+
<argument name="product" defaultValue="BundleProduct"/>
35+
<argument name="thumbnail" defaultValue="ProductPlaceholderImage"/>
36+
</arguments>
37+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
38+
<waitForPageLoad stepKey="waitForPageLoadInitial"/>
39+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
40+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
41+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillProductNameFilter"/>
42+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
43+
<selectOption selector="{{AdminProductGridFilterSection.typeFilter}}" userInput="{{product.type_id}}" stepKey="selectionProductType"/>
44+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
45+
<see selector="{{AdminProductGridSection.firstProductRow}}" userInput="{{product.name}}" stepKey="seeProductNameInGrid"/>
46+
<click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/>
47+
</actionGroup>
48+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="name" unique="suffix">BundleProduct</data>
13+
<data key="sku" unique="suffix">bundleproduct</data>
14+
<data key="type_id">bundle</data>
15+
<data key="attribute_set_id">4</data>
16+
<data key="optionTitle1">BundleOption</data>
17+
<data key="optionInputType1">checkbox</data>
18+
<data key="defaultQuantity">10</data>
19+
<data key="status">1</data>
20+
</entity>
21+
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Page/AdminProductEditPage.xml renamed to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Page/AdminProductCreatePage.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="AdminProductEditPage" url="catalog/product/new/set/4/type/simple/" area="admin" module="Magento_Catalog">
12-
<section name="AdminProductFormSection"/>
13-
<section name="AdminProductFormActionSection"/>
14-
<section name="AdminMessagesSection"/>
11+
<page name="AdminProductCreatePage" url="catalog/product/new/set/{{set}}/type/{{type}}/" area="admin" module="Magento_Catalog" parameterized="true">
12+
<section name="AdminProductFormBundleSection"/>
1513
</page>
1614
</pages>
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductFormBundleSection">
12+
<element name="shipmentType" type="select" selector=".admin__control-select[name='product[shipment_type]']"/>
13+
<element name="addOption" type="button" selector="button[data-index='add_button']"/>
14+
<element name="firstOptionTitle" type="input" selector="[name='bundle_options[bundle_options][0][title]']"/>
15+
<element name="firstInputType" type="select" selector="[name='bundle_options[bundle_options][0][type]']"/>
16+
<element name="firstRequired" type="checkbox" selector="[name='bundle_options[bundle_options][0][required]']"/>
17+
<element name="firstProductQuantity" type="input" selector="[name='bundle_options[bundle_options][0][bundle_selections][0][selection_qty]']"/>
18+
<element name="addProductsToOption" type="button" selector="[data-index='modal_set']" timeout="30"/>
19+
</section>
20+
</sections>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<test name="EndToEndB2CAdminTest">
11+
<!--Create Bundle Product-->
12+
<amOnPage url="{{AdminProductIndexPage}}" stepKey="visitAdminProductPageBundle" after="viewVirtualProductInGrid"/>
13+
<waitForPageLoad stepKey="waitForProductPageLoadBundle" after="visitAdminProductPageBundle"/>
14+
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateBundleProduct" after="waitForProductPageLoadBundle">
15+
<argument name="product" value="BundleProduct"/>
16+
</actionGroup>
17+
18+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{BundleProduct.sku}}" stepKey="fillBundleName" after="goToCreateBundleProduct"/>
19+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillBundleSku" after="fillBundleName"/>
20+
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3" after="fillBundleSku"/>
21+
<waitForElementVisible selector="{{AdminProductFormBundleSection.firstOptionTitle}}" stepKey="waitForBundleOptions" after="clickAddOption3"/>
22+
<fillField selector="{{AdminProductFormBundleSection.firstOptionTitle}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillOptionTitle" after="waitForBundleOptions"/>
23+
<selectOption selector="{{AdminProductFormBundleSection.firstInputType}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectInputType" after="fillOptionTitle"/>
24+
<waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProductsToBundle" after="selectInputType"/>
25+
<click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProductsToOption" after="waitForAddProductsToBundle"/>
26+
<waitForPageLoad stepKey="waitForPageLoadAfterBundleProducts" after="clickAddProductsToOption"/>
27+
<actionGroup ref="filterProductGridBySku" stepKey="filterBundleProductOptions" after="waitForPageLoadAfterBundleProducts">
28+
<argument name="product" value="SimpleProduct"/>
29+
</actionGroup>
30+
<checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="selectFirstGridRow" after="filterBundleProductOptions"/>
31+
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts" after="selectFirstGridRow"/>
32+
<fillField selector="{{AdminProductFormBundleSection.firstProductQuantity}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillProductDefaultQty" after="clickAddSelectedBundleProducts"/>
33+
<actionGroup ref="saveProductForm" stepKey="saveBundleProduct" after="fillProductDefaultQty"/>
34+
<actionGroup ref="viewBundleProductInAdminGrid" stepKey="viewBundleProductInGrid" after="saveBundleProduct">
35+
<argument name="product" value="BundleProduct"/>
36+
</actionGroup>
37+
38+
<!--TODO - Move to 'after' block when MQE-732 is fixed-->
39+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteBundleProduct" after="deleteVirtualProduct">
40+
<argument name="product" value="BundleProduct"/>
41+
</actionGroup>
42+
</test>
43+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
<!--Create a new category-->
12+
<actionGroup name="CreateCategory">
13+
<arguments>
14+
<argument name="categoryEntity" defaultValue="_defaultCategory"/>
15+
</arguments>
16+
17+
<seeInCurrentUrl url="{{AdminCategoryPage}}" stepKey="seeOnCategoryPage"/>
18+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
19+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Category" stepKey="seeCategoryPageTitle"/>
20+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryEntity.name}}" stepKey="enterCategoryName"/>
21+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/>
22+
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryEntity.name_lwr}}" stepKey="enterURLKey"/>
23+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
24+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/>
25+
<seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeNewCategoryPageTitle"/>
26+
<seeElement selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="seeCategoryInTree"/>
27+
</actionGroup>
28+
29+
<!--Actions to check if a category exists on StoreFront-->
30+
<actionGroup name="CheckCategoryOnStorefront">
31+
<arguments>
32+
<argument name="categoryEntity" defaultValue="_defaultCategory"/>
33+
</arguments>
34+
35+
<amOnPage url="/{{categoryEntity.name_lwr}}.html" stepKey="goToCategoryFrontPage"/>
36+
<waitForPageLoad stepKey="waitForPageLoad1"/>
37+
<see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{categoryEntity.name_lwr}}" stepKey="assertCategoryOnStorefront"/>
38+
<seeInTitle userInput="{{categoryEntity.name}}" stepKey="seeCategoryNameInTitle"/>
39+
</actionGroup>
40+
41+
<!--Actions to delete category-->
42+
<actionGroup name="DeleteCategory">
43+
<arguments>
44+
<argument name="categoryEntity" defaultValue="_defaultCategory"/>
45+
</arguments>
46+
<seeInCurrentUrl url="{{AdminCategoryPage}}" stepKey="seeOnCategoryPage"/>
47+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="clickCategoryLink"/>
48+
<click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/>
49+
<waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/>
50+
<see selector="{{AdminCategoryModalSection.message}}" userInput="Are you sure you want to delete this category?" stepKey="seeDeleteConfirmationMessage"/>
51+
<click selector="{{AdminCategoryModalSection.ok}}" stepKey="confirmDelete"/>
52+
<waitForPageLoad stepKey="waitForDeleteToFinish"/>
53+
<see selector="You deleted the category." stepKey="seeDeleteSuccess"/>
54+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/>
55+
<dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/>
56+
</actionGroup>
57+
58+
<!--Check that name field is required-->
59+
<actionGroup name="CheckCategoryNameIsRequiredField">
60+
<seeInCurrentUrl url="{{AdminCategoryPage}}" stepKey="seeOnCategoryPage"/>
61+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
62+
<clearField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" stepKey="makeNameFieldEmpty"/>
63+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
64+
<seeInCurrentUrl url="{{AdminCategoryPage.url}}add" stepKey="seeBackOnCreateCategoryPage"/>
65+
<see selector="{{AdminCategoryBasicFieldSection.FieldError('uid')}}" userInput="This is a required field." stepKey="seeErrorMessage"/>
66+
</actionGroup>
67+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<!--Navigate to create product page from product grid page-->
11+
<actionGroup name="goToCreateProductPage">
12+
<arguments>
13+
<argument name="product" defaultValue="_defaultProduct"/>
14+
</arguments>
15+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/>
16+
<waitForElementVisible selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="waitForAddProductDropdown" time="30"/>
17+
<click selector="{{AdminProductGridActionSection.addTypeProduct(product.type_id)}}" stepKey="clickAddProductType"/>
18+
<waitForPageLoad stepKey="waitForCreateProductPageLoad"/>
19+
<seeInCurrentUrl url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, product.type_id)}}" stepKey="seeNewProductUrl"/>
20+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/>
21+
</actionGroup>
22+
23+
<!--Fill main fields in create product form-->
24+
<actionGroup name="fillMainProductForm">
25+
<arguments>
26+
<argument name="product" defaultValue="_defaultProduct"/>
27+
</arguments>
28+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductSku"/>
29+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductName"/>
30+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/>
31+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/>
32+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/>
33+
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/>
34+
</actionGroup>
35+
36+
<!--Check that required fields are actually required-->
37+
<actionGroup name="checkRequiredFieldsInProductForm">
38+
<clearField selector="{{AdminProductFormSection.productName}}" stepKey="clearProductSku"/>
39+
<clearField selector="{{AdminProductFormSection.productSku}}" stepKey="clearProductName"/>
40+
<clearField selector="{{AdminProductFormSection.productPrice}}" stepKey="clearProductPrice"/>
41+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
42+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeStillOnEditPage"/>
43+
<see selector="{{AdminProductFormSection.fieldError('name')}}" userInput="This is a required field." stepKey="seeNameRequired"/>
44+
<see selector="{{AdminProductFormSection.fieldError('sku')}}" userInput="This is a required field." stepKey="seeSkuRequired"/>
45+
<see selector="{{AdminProductFormSection.priceFieldError}}" userInput="This is a required field." stepKey="seePriceRequired"/>
46+
</actionGroup>
47+
48+
<!--Save product and see success message-->
49+
<actionGroup name="saveProductForm">
50+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
51+
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
52+
</actionGroup>
53+
54+
<!--Upload image for product-->
55+
<actionGroup name="addProductImage">
56+
<arguments>
57+
<argument name="image" defaultValue="ImageUpload"/>
58+
</arguments>
59+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
60+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
61+
<waitForAjaxLoad stepKey="waitForAjaxUpload"/>
62+
</actionGroup>
63+
</actionGroups>

0 commit comments

Comments
 (0)