Skip to content

Commit 6615f86

Browse files
MacMac
authored andcommitted
Merge remote-tracking branch 'remotes/github/MAGETWO-95834' into EPAM-PR-28
2 parents 2731834 + 3fc2606 commit 6615f86

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminChooseAffectedAttributeSetPopup">
1212
<element name="confirm" type="button" selector="button[data-index='confirm_button']" timeout="30"/>
13+
<element name="closePopUp" type="button" selector="//*[contains(@class,'product_form_product_form_configurable_attribute_set')]//button[@data-role='closeBtn']" timeout="30"/>
1314
</section>
14-
</sections>
15+
</sections>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
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="confProductSku" type="input" selector="//*[@name='configurable-matrix[{{arg}}][sku]']" parameterized="true"/>
26+
<element name="confProductSkuMessage" type="text" selector="//*[@name='configurable-matrix[{{arg}}][sku]']/following-sibling::label" parameterized="true"/>
2527
<element name="variationsSkuInputByRow" selector="[data-index='configurable-matrix'] table > tbody > tr:nth-of-type({{row}}) input[name*='sku']" type="input" parameterized="true"/>
2628
<element name="variationsSkuInputErrorByRow" selector="[data-index='configurable-matrix'] table > tbody > tr:nth-of-type({{row}}) .admin__field-error" type="text" parameterized="true"/>
2729
</section>
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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+
<title value="Check that validator works correctly when creating Configurations for Configurable Products"/>
15+
<description value="Verify validator works correctly for Configurable Products"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-95995"/>
18+
<useCaseId value="MAGETWO-95834"/>
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+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
37+
<actionGroup ref="deleteProductBySku" stepKey="deleteProduct">
38+
<argument name="sku" value="{{ApiConfigurableProduct.name}}-thisIsShortName"/>
39+
</actionGroup>
40+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}"
41+
dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
42+
<!-- Remove attribute -->
43+
<actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute">
44+
<argument name="ProductAttribute" value="productDropDownAttribute"/>
45+
</actionGroup>
46+
<actionGroup ref="logout" stepKey="logout"/>
47+
</after>
48+
49+
<!-- Find the product that we just created using the product grid -->
50+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
51+
<waitForPageLoad stepKey="waitForAdminProductPageLoad"/>
52+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}"
53+
dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
54+
<actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct">
55+
<argument name="product" value="ApiConfigurableProduct"/>
56+
</actionGroup>
57+
<waitForPageLoad stepKey="waitForProductFilterLoad"/>
58+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/>
59+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
60+
61+
<!-- Create configurations based off the Text Swatch we created earlier -->
62+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
63+
64+
<!--Create new attribute-->
65+
<waitForElementVisible stepKey="waitForNewAttributePageOpened" selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}"/>
66+
<click selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="clickCreateNewAttribute" after="waitForNewAttributePageOpened"/>
67+
<switchToIFrame selector="{{AdminNewAttributePanel.newAttributeIFrame}}" stepKey="enterAttributePanelIFrame" after="clickCreateNewAttribute"/>
68+
<waitForElementVisible selector="{{AdminNewAttributePanel.defaultLabel}}" time="30" stepKey="waitForIframeLoad" after="enterAttributePanelIFrame"/>
69+
<fillField selector="{{AdminNewAttributePanel.defaultLabel}}" userInput="{{productDropDownAttribute.attribute_code}}" stepKey="fillDefaultLabel" after="waitForIframeLoad"/>
70+
<selectOption selector="{{AdminNewAttributePanel.inputType}}" userInput="{{colorProductAttribute.input_type}}" stepKey="selectAttributeInputType" after="fillDefaultLabel"/>
71+
<!--Add option to attribute-->
72+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption1" after="selectAttributeInputType"/>
73+
<waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('1')}}" time="30" stepKey="waitForOptionRow1" after="clickAddOption1"/>
74+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('0')}}" userInput="ThisIsLongNameNameLengthMoreThanSixtyFourThisIsLongNameNameLength" stepKey="fillAdminLabel1" after="waitForOptionRow1"/>
75+
<fillField selector="{{AdminNewAttributePanel.optionDefaultStoreValue('0')}}" userInput="{{colorProductAttribute1.name}}" stepKey="fillDefaultLabel1" after="fillAdminLabel1"/>
76+
77+
<!--Save attribute-->
78+
<click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/>
79+
<waitForPageLoad stepKey="waitForSaveAttribute"/>
80+
<switchToIFrame stepKey="switchOutOfIFrame"/>
81+
82+
<!--Find attribute in grid and select-->
83+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/>
84+
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="clickOnFilters"/>
85+
<fillField selector="{{AdminDataGridHeaderSection.attributeCodeFilterInput}}" userInput="{{productDropDownAttribute.attribute_code}}" stepKey="fillFilterAttributeCodeField"/>
86+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
87+
<click selector="{{AdminDataGridTableSection.rowCheckbox('1')}}" stepKey="clickOnFirstCheckbox"/>
88+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep1"/>
89+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(productDropDownAttribute.attribute_code)}}" stepKey="waitForNextPageOpened"/>
90+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(productDropDownAttribute.attribute_code)}}" stepKey="clickSelectAll"/>
91+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextStep2"/>
92+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" stepKey="waitForNextPageOpened2"/>
93+
<click selector="{{AdminCreateProductConfigurationsPanel.applySinglePriceToAllSkus}}" stepKey="clickOnApplySinglePriceToAllSkus"/>
94+
<fillField selector="{{AdminCreateProductConfigurationsPanel.singlePrice}}" userInput="10" stepKey="enterAttributePrice"/>
95+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
96+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="100" stepKey="enterAttributeQuantity"/>
97+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextStep3"/>
98+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitForNextPageOpened3"/>
99+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="generateProducts"/>
100+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveButtonVisible"/>
101+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
102+
<waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitForPopUpVisible"/>
103+
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/>
104+
<dontSeeElement selector="{{AdminMessagesSection.success}}" stepKey="dontSeeSaveProductMessage"/>
105+
106+
<!--Close modal window-->
107+
<click selector="{{AdminChooseAffectedAttributeSetPopup.closePopUp}}" stepKey="clickOnClosePopup"/>
108+
<waitForElementNotVisible selector="{{AdminChooseAffectedAttributeSetPopup.closePopUp}}" stepKey="waitForDialogClosed"/>
109+
110+
<!--See that validation message is shown under the fields-->
111+
<scrollTo selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" stepKey="scrollTConfigurationTab"/>
112+
<see userInput="Please enter less or equal than 64 symbols." selector="{{AdminProductFormConfigurationsSection.confProductSkuMessage('0')}}" stepKey="SeeValidationMessage"/>
113+
114+
<!--Edit "SKU" with valid quantity-->
115+
<fillField stepKey="fillValidValue" selector="{{AdminProductFormConfigurationsSection.confProductSku('0')}}" userInput="{{ApiConfigurableProduct.name}}-thisIsShortName"/>
116+
117+
<!--Click on "Save"-->
118+
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveBtnVisible"/>
119+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductAgain"/>
120+
121+
<!--Click on "Confirm". Product is saved, success message appears -->
122+
<waitForElementVisible selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="waitPopUpVisible"/>
123+
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmPopup"/>
124+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSaveProductMessage"/>
125+
</test>
126+
</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)