Skip to content

Commit 3d4e815

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-95752' into 2.2-develop-pr72
2 parents 83abd82 + 5bf1958 commit 3d4e815

File tree

7 files changed

+155
-5
lines changed

7 files changed

+155
-5
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<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">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<!--Filter the product grid by new from date filter-->
1212
<actionGroup name="filterProductGridBySetNewFromDate">
1313
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
@@ -33,6 +33,7 @@
3333
<actionGroup name="deleteProductUsingProductGrid">
3434
<arguments>
3535
<argument name="product"/>
36+
<argument name="productCount" type="string" defaultValue="1"/>
3637
</arguments>
3738
<!--TODO use other action group for filtering grid when MQE-539 is implemented -->
3839
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
@@ -48,7 +49,7 @@
4849
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
4950
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
5051
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
51-
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been deleted." stepKey="seeSuccessMessage"/>
52+
<see selector="{{AdminMessagesSection.success}}" userInput="A total of {{productCount}} record(s) have been deleted." stepKey="seeSuccessMessage"/>
5253
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
5354
</actionGroup>
5455

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
-->
88

99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/dataProfileSchema.xsd">
1111
<entity name="colorProductAttribute" type="product_attribute">
1212
<data key="default_label" unique="suffix">Color</data>
1313
<data key="attribute_quantity">1</data>
14+
<data key="input_type">Dropdown</data>
1415
</entity>
1516
<entity name="colorProductAttribute1" type="product_attribute">
1617
<data key="name" unique="suffix">White</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,6 @@
188188
</section>
189189
<section name="AdminChooseAffectedAttributeSetPopup">
190190
<element name="confirm" type="button" selector="button[data-index='confirm_button']" timeout="30"/>
191+
<element name="closePopUp" type="button" selector=".modal-popup._show [data-role='closeBtn']" timeout="30"/>
191192
</section>
192193
</sections>

app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateConfigurableProductActionGroup.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,29 @@
6565
<conditionalClick selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" dependentSelector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" visible="true" stepKey="clickConfirm"/>
6666
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="assertSuccess"/>
6767
</actionGroup>
68+
69+
<actionGroup name="AdminGenerateProductConfigurations">
70+
<arguments>
71+
<argument name="attributeCode" type="string"/>
72+
<argument name="qty" type="string"/>
73+
<argument name="price" type="string"/>
74+
</arguments>
75+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/>
76+
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="clickOnFilters"/>
77+
<fillField selector="{{AdminProductAttributeGridSection.attributeCodeFilterInput}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/>
78+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
79+
<click selector="{{AdminDataGridTableSection.rowCheckbox('1')}}" stepKey="clickOnFirstCheckbox"/>
80+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep"/>
81+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanelSection.selectAllByAttribute(attributeCode)}}" stepKey="waitForNextPageOpened"/>
82+
<click selector="{{AdminCreateProductConfigurationsPanelSection.selectAllByAttribute(attributeCode)}}" stepKey="clickSelectAll"/>
83+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep1"/>
84+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" stepKey="waitForNextPageOpened1"/>
85+
<click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" stepKey="clickOnApplySinglePriceToAllSkus"/>
86+
<fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="{{price}}" stepKey="enterAttributePrice"/>
87+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
88+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="{{qty}}" stepKey="enterAttributeQuantity"/>
89+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep2"/>
90+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitForNextPageOpened2"/>
91+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="generateProducts"/>
92+
</actionGroup>
6893
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<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">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductFormConfigurationsSection">
1212
<element name="sectionHeader" type="text" selector=".admin__collapsible-block-wrapper[data-index='configurable']"/>
1313
<element name="createConfigurations" type="button" selector="button[data-index='create_configurable_products_button']" timeout="30"/>
@@ -22,5 +22,7 @@
2222
<element name="removeProductBtn" type="button" selector="//a[text()='Remove Product']"/>
2323
<element name="disableProductBtn" type="button" selector="//a[text()='Disable Product']"/>
2424
<element name="enableProductBtn" type="button" selector="//a[text()='Enable Product']"/>
25+
<element name="configurableMatrixSku" type="input" selector="input[name='configurable-matrix[{{index}}][sku]']" parameterized="true"/>
26+
<element name="skuValidationMessage" type="text" selector="input[name='configurable-matrix[{{index}}][sku]'] + label" parameterized="true"/>
2527
</section>
2628
</sections>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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="AdminCheckValidatorConfigurableProductTest">
12+
<annotations>
13+
<features value="ConfigurableProduct"/>
14+
<stories value="Create a Configurable Product via the Admin"/>
15+
<title value="Check that validator works correctly when creating Configurations for Configurable Products"/>
16+
<description value="Verify validator works correctly for Configurable Products"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-13719"/>
19+
<group value="configurableProduct"/>
20+
</annotations>
21+
22+
<before>
23+
<!--Login as admin-->
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
25+
<!--Create Category-->
26+
<createData entity="ApiCategory" stepKey="createCategory"/>
27+
<!--Create Configurable product-->
28+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
29+
<requiredEntity createDataKey="createCategory"/>
30+
</createData>
31+
</before>
32+
33+
<after>
34+
<!--Delete created data-->
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
37+
<argument name="product" value="ApiConfigurableProduct"/>
38+
<argument name="productCount" value="2"/>
39+
</actionGroup>
40+
41+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openAdminProductPage"/>
42+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetProductsFilter" />
43+
44+
<!-- Remove attribute -->
45+
<actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute">
46+
<argument name="ProductAttribute" value="productAttributeWithDropdownTwoOptions"/>
47+
</actionGroup>
48+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributesGridPage"/>
49+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="resetAttributesFilter" />
50+
<actionGroup ref="logout" stepKey="logout"/>
51+
</after>
52+
53+
<!-- Find the product that we just created using the product grid -->
54+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
55+
<actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct">
56+
<argument name="product" value="ApiConfigurableProduct"/>
57+
</actionGroup>
58+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProduct"/>
59+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
60+
61+
<!-- Create configurations for product we created earlier -->
62+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
63+
64+
<!--Create new attribute-->
65+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="waitForNewAttributePageOpened"/>
66+
<click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickCreateNewAttribute"/>
67+
<switchToIFrame selector="{{AdminNewAttributePanelSection.newAttributeIFrame}}" stepKey="enterAttributePanelIFrame"/>
68+
<waitForElementVisible selector="{{AdminNewAttributePanel.defaultLabel}}" time="30" stepKey="waitForIframeLoad"/>
69+
<fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{productAttributeWithDropdownTwoOptions.attribute_code}}" stepKey="fillDefaultLabel"/>
70+
<selectOption selector="{{AdminNewAttributePanelSection.inputType}}" userInput="{{colorProductAttribute.input_type}}" stepKey="selectAttributeInputType"/>
71+
<!--Add option to attribute-->
72+
<click selector="{{AdminNewAttributePanelSection.addOption}}" stepKey="clickAddOption"/>
73+
<waitForElementVisible selector="{{AdminNewAttributePanelSection.isDefault('1')}}" time="30" stepKey="waitForOptionRow"/>
74+
<fillField selector="{{AdminNewAttributePanelSection.optionAdminValue('0')}}" userInput="ThisIsLongNameNameLengthMoreThanSixtyFourThisIsLongNameNameLength" stepKey="fillAdminLabel"/>
75+
<fillField selector="{{AdminNewAttributePanelSection.optionDefaultStoreValue('0')}}" userInput="{{colorProductAttribute1.name}}" stepKey="fillDefaultLabel1"/>
76+
77+
<!--Save attribute-->
78+
<click selector="{{AdminNewAttributePanelSection.saveAttribute}}" stepKey="clickOnNewAttributePanel"/>
79+
<waitForPageLoad stepKey="waitForSaveAttribute"/>
80+
<switchToIFrame stepKey="switchOutOfIFrame"/>
81+
82+
<!-- Generate products -->
83+
<actionGroup ref="AdminGenerateProductConfigurations" stepKey="generateProducts">
84+
<argument name="attributeCode" value="{{productAttributeWithDropdownTwoOptions.attribute_code}}"/>
85+
<argument name="qty" value="100"/>
86+
<argument name="price" value="10"/>
87+
</actionGroup>
88+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveButtonVisible"/>
89+
<scrollToTopOfPage stepKey="scrollToTop"/>
90+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
91+
<waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitForPopUpVisible"/>
92+
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/>
93+
<dontSeeElement selector="{{AdminMessagesSection.success}}" stepKey="dontSeeSaveProductMessage"/>
94+
95+
<!--Close modal window-->
96+
<click selector="{{AdminChooseAffectedAttributeSetPopup.closePopUp}}" stepKey="clickOnClosePopup"/>
97+
<waitForElementNotVisible selector="{{AdminChooseAffectedAttributeSetPopup.closePopUp}}" stepKey="waitForDialogClosed"/>
98+
99+
<!--See that validation message is shown under the fields-->
100+
<scrollTo selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" stepKey="scrollTConfigurationTab"/>
101+
<see userInput="Please enter less or equal than 64 symbols." selector="{{AdminProductFormConfigurationsSection.skuValidationMessage('0')}}" stepKey="seeValidationMessage"/>
102+
103+
<!--Edit "SKU" with valid quantity-->
104+
<fillField selector="{{AdminProductFormConfigurationsSection.configurableMatrixSku('0')}}" userInput="{{ApiConfigurableProduct.sku}}-thisIsShortName" stepKey="fillValidValue"/>
105+
106+
<!--Click on "Save"-->
107+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/>
108+
<scrollToTopOfPage stepKey="scrollToTop1"/>
109+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductAgain"/>
110+
111+
<!--Click on "Confirm". Product is saved, success message appears -->
112+
<waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitPopUpVisible"/>
113+
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmPopup"/>
114+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/>
115+
</test>
116+
</tests>

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,11 @@ define([
383383
* Chose action for the form save button
384384
*/
385385
saveFormHandler: function () {
386-
this.serializeData();
386+
this.formElement().validate();
387+
388+
if (this.formElement().source.get('params.invalid') === false) {
389+
this.serializeData();
390+
}
387391

388392
if (this.checkForNewAttributes()) {
389393
this.formSaveParams = arguments;

0 commit comments

Comments
 (0)