Skip to content

Commit 921f9fe

Browse files
ACQE-8163: Configurable product swatches appears as available but are out of stock
- Added waitforelementvisible before click and created entity for options
1 parent 9fcb020 commit 921f9fe

File tree

4 files changed

+70
-34
lines changed

4 files changed

+70
-34
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@
2525
<arguments>
2626
<argument name="attributeLabel1" type="string" defaultValue="{{colorProductAttribute.default_label}}"/>
2727
<argument name="attributeLabel2" type="string" defaultValue="{{sizeAttribute.default_label}}"/>
28+
<argument name="quantity" type="string" defaultValue="100"/>
2829
</arguments>
30+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitForNext" />
2931
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextToSelectOptions"/>
32+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attributeLabel1)}}" stepKey="waitForSelectAllColor" />
3033
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attributeLabel1)}}" stepKey="selectAllSwatchAttributeOptions"/>
34+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attributeLabel2)}}" stepKey="waitForSelectAllSize" />
3135
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute(attributeLabel2)}}" stepKey="selectAllSwatchAttributeOptions1"/>
36+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitForNextAgain" />
3237
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickNextToApplyQuantity"/>
38+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="waitForQtyField" />
3339
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
34-
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="100" stepKey="enterAttributeQuantity"/>
40+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="{{quantity}}" stepKey="enterAttributeQuantity"/>
41+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitForNextAgain2" />
3542
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
43+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitForNextAgain3" />
3644
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
3745
</actionGroup>
3846
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<argument name="inputType" type="string" defaultValue="Dropdown"/>
2929
<argument name="scope" type="string" defaultValue="Store View"/>
3030
</arguments>
31+
<waitForElementVisible selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="waitForAddNewButton"/>
3132
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="clickAddNewAttributeButton"/>
3233
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeLabel}}" stepKey="fillAttributeLabel"/>
3334
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{inputType}}" stepKey="selectDropdown"/>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,18 @@
8080
<data key="input_type">Dropdown</data>
8181
<data key="attribute_code" unique="suffix">size</data>
8282
</entity>
83+
<entity name="colorProductAttributeWithOptions" extends="colorProductAttribute" type="ProductAttribute">
84+
<data key="input_type">Text Swatch</data>
85+
<data key="scope">Global</data>
86+
<data key="option1">Black</data>
87+
<data key="option2">Blue</data>
88+
<data key="option3">White</data>
89+
</entity>
90+
<entity name="sizeProductAttributeWithOptions" extends="sizeAttribute" type="ProductAttribute">
91+
<data key="input_type">Text Swatch</data>
92+
<data key="scope">Global</data>
93+
<data key="option1">Small</data>
94+
<data key="option2">Medium</data>
95+
<data key="option3">Large</data>
96+
</entity>
8397
</entities>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckOutOfStockProductSwatchesAppearOnConfigurationUpdateTest.xml

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,17 @@
4646
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
4747
<argument name="product" value="$$createConfigProduct$$"/>
4848
</actionGroup>
49+
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
4950
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>
5051
<waitForElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>
5152
<click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/>
5253
<!-- Delete color attribute -->
5354
<actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteColorAttribute">
54-
<argument name="attribute_code" value="{{colorProductAttribute.default_label}}"/>
55+
<argument name="attribute_code" value="{{colorProductAttributeWithOptions.default_label}}"/>
5556
</actionGroup>
5657
<!-- Delete size attribute -->
5758
<actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteSizeAttribute">
58-
<argument name="attribute_code" value="{{sizeAttribute.default_label}}"/>
59+
<argument name="attribute_code" value="{{sizeProductAttributeWithOptions.default_label}}"/>
5960
</actionGroup>
6061
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
6162
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
@@ -65,80 +66,88 @@
6566
<!-- Step 2 - Navigate to Stores > Attributes > Products > Product Attribute-->
6667
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="navigateToProductAttributeGrid" />
6768
<actionGroup ref="FillProductAttributeFieldsActionGroup" stepKey="fillColorAttributeFields">
68-
<argument name="attributeLabel" value="{{colorProductAttribute.default_label}}" />
69-
<argument name="attributeCode" value="{{colorProductAttribute.default_label}}" />
70-
<argument name="inputType" value="{{textSwatchAttribute.input_type}}" />
71-
<argument name="scope" value="{{productAttributeDropdownTwoOptions.scope}}" />
69+
<argument name="attributeLabel" value="{{colorProductAttributeWithOptions.default_label}}" />
70+
<argument name="attributeCode" value="{{colorProductAttributeWithOptions.default_label}}" />
71+
<argument name="inputType" value="{{colorProductAttributeWithOptions.input_type}}" />
72+
<argument name="scope" value="{{colorProductAttributeWithOptions.scope}}" />
7273
</actionGroup>
74+
<waitForElementVisible selector="{{AttributePropertiesSection.addSwatch}}" stepKey="waitForAddBlackSwatch" />
7375
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddBlackSwatch"/>
7476
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
7577
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addBlackSwatchOption">
7678
<argument name="position" value="0"/>
77-
<argument name="swatchName" value="Black"/>
78-
<argument name="swatchDescription" value="Black"/>
79+
<argument name="swatchName" value="{{colorProductAttributeWithOptions.option1}}"/>
80+
<argument name="swatchDescription" value="{{colorProductAttributeWithOptions.option1}}"/>
7981
</actionGroup>
82+
<waitForElementVisible selector="{{AttributePropertiesSection.addSwatch}}" stepKey="waitForAddBlueSwatch" />
8083
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddBlueSwatch"/>
8184
<waitForAjaxLoad stepKey="waitForAjaxLoad1"/>
8285
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addBlueSwatchOption">
8386
<argument name="position" value="1"/>
84-
<argument name="swatchName" value="Blue"/>
85-
<argument name="swatchDescription" value="Blue"/>
87+
<argument name="swatchName" value="{{colorProductAttributeWithOptions.option2}}"/>
88+
<argument name="swatchDescription" value="{{colorProductAttributeWithOptions.option2}}"/>
8689
</actionGroup>
90+
<waitForElementVisible selector="{{AttributePropertiesSection.addSwatch}}" stepKey="waitForAddWhiteSwatch" />
8791
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddWhiteSwatch"/>
8892
<waitForAjaxLoad stepKey="waitForAjaxLoad2"/>
8993
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addWhiteSwatchOption">
9094
<argument name="position" value="2"/>
91-
<argument name="swatchName" value="White"/>
92-
<argument name="swatchDescription" value="White"/>
95+
<argument name="swatchName" value="{{colorProductAttributeWithOptions.option3}}"/>
96+
<argument name="swatchDescription" value="{{colorProductAttributeWithOptions.option3}}"/>
9397
</actionGroup>
98+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="waitForColorSaveButton" />
9499
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnColorSaveAttribute"/>
95100
<waitForPageLoad stepKey="waitForColorAttributeToSave"/>
96101
<waitForElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeColorSaveProductMessage"/>
97102
<!-- Step 3: Create other new Attribute with label size -->
98103
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="navigateToProductAttributeGrid1" />
99104
<actionGroup ref="FillProductAttributeFieldsActionGroup" stepKey="fillSizeAttributeFields">
100-
<argument name="attributeLabel" value="{{sizeAttribute.default_label}}" />
101-
<argument name="attributeCode" value="{{sizeAttribute.default_label}}" />
102-
<argument name="inputType" value="{{textSwatchAttribute.input_type}}" />
103-
<argument name="scope" value="{{productAttributeDropdownTwoOptions.scope}}" />
105+
<argument name="attributeLabel" value="{{sizeProductAttributeWithOptions.default_label}}" />
106+
<argument name="attributeCode" value="{{sizeProductAttributeWithOptions.default_label}}" />
107+
<argument name="inputType" value="{{sizeProductAttributeWithOptions.input_type}}" />
108+
<argument name="scope" value="{{sizeProductAttributeWithOptions.scope}}" />
104109
</actionGroup>
110+
<waitForElementVisible selector="{{AttributePropertiesSection.addSwatch}}" stepKey="waitForAddSmallSwatch" />
105111
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddSmallSwatch"/>
106112
<waitForAjaxLoad stepKey="waitForAjaxLoad3"/>
107113
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addSmallSwatchOption">
108114
<argument name="position" value="0"/>
109-
<argument name="swatchName" value="Small"/>
110-
<argument name="swatchDescription" value="Small"/>
115+
<argument name="swatchName" value="{{sizeProductAttributeWithOptions.option1}}"/>
116+
<argument name="swatchDescription" value="{{sizeProductAttributeWithOptions.option1}}"/>
111117
</actionGroup>
118+
<waitForElementVisible selector="{{AttributePropertiesSection.addSwatch}}" stepKey="waitForAddMediumSwatch" />
112119
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddMediumSwatch"/>
113120
<waitForAjaxLoad stepKey="waitForAjaxLoad4"/>
114121
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addMediumSwatchOption">
115122
<argument name="position" value="1"/>
116-
<argument name="swatchName" value="Medium"/>
117-
<argument name="swatchDescription" value="Medium"/>
123+
<argument name="swatchName" value="{{sizeProductAttributeWithOptions.option2}}"/>
124+
<argument name="swatchDescription" value="{{sizeProductAttributeWithOptions.option2}}"/>
118125
</actionGroup>
126+
<waitForElementVisible selector="{{AttributePropertiesSection.addSwatch}}" stepKey="waitForAddLargeSwatch" />
119127
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddLargeSwatch"/>
120128
<waitForAjaxLoad stepKey="waitForAjaxLoad5"/>
121129
<actionGroup ref="AdminAddTextSwatchForAdminActionGroup" stepKey="addLargeSwatchOption">
122130
<argument name="position" value="2"/>
123-
<argument name="swatchName" value="Large"/>
124-
<argument name="swatchDescription" value="Large"/>
131+
<argument name="swatchName" value="{{sizeProductAttributeWithOptions.option3}}"/>
132+
<argument name="swatchDescription" value="{{sizeProductAttributeWithOptions.option3}}"/>
125133
</actionGroup>
134+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="waitForSizeSaveButton" />
126135
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSizeSaveAttribute"/>
127136
<waitForPageLoad stepKey="waitForSizeAttributeToSave"/>
128137
<waitForElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSizeSaveProductMessage"/>
129138
<actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/>
130139
<actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openAttributeSetForColor">
131140
<argument name="attributeSetName" value="Default"/>
132141
</actionGroup>
133-
<waitForText userInput="{{colorProductAttribute.default_label}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeColorAttributeInUnassigned"/>
142+
<waitForText userInput="{{colorProductAttributeWithOptions.default_label}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeColorAttributeInUnassigned"/>
134143
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignColorAttributeToGroup">
135144
<argument name="group" value="Product Details"/>
136-
<argument name="attribute" value="{{colorProductAttribute.default_label}}"/>
145+
<argument name="attribute" value="{{colorProductAttributeWithOptions.default_label}}"/>
137146
</actionGroup>
138-
<waitForText userInput="{{sizeAttribute.default_label}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeSizeAttributeInUnassigned"/>
147+
<waitForText userInput="{{sizeProductAttributeWithOptions.default_label}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeSizeAttributeInUnassigned"/>
139148
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignSizeAttributeToGroup">
140149
<argument name="group" value="Product Details"/>
141-
<argument name="attribute" value="{{sizeAttribute.default_label}}"/>
150+
<argument name="attribute" value="{{sizeProductAttributeWithOptions.default_label}}"/>
142151
</actionGroup>
143152
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveSizeAttributeSet"/>
144153
<!-- Step 4 - Edit Configurable Product -->
@@ -149,32 +158,35 @@
149158
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct2">
150159
<argument name="product" value="$$createConfigProduct$$"/>
151160
</actionGroup>
161+
<waitForElementVisible selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="waitForCreateConfigurations" />
152162
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/>
153163
<actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="selectColorAttribute">
154-
<argument name="attributeCode" value="{{colorProductAttribute.default_label}}"/>
164+
<argument name="attributeCode" value="{{colorProductAttributeWithOptions.default_label}}"/>
155165
</actionGroup>
156166
<actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="selectSizeAttribute">
157-
<argument name="attributeCode" value="{{sizeAttribute.default_label}}"/>
167+
<argument name="attributeCode" value="{{sizeProductAttributeWithOptions.default_label}}"/>
158168
</actionGroup>
159169
<actionGroup ref="AdminSelectAllValueOfTwoAttributesPageActionGroup" stepKey="selectColorOptions">
160-
<argument name="attributeLabel1" value="{{colorProductAttribute.default_label}}" />
161-
<argument name="attributeLabel2" value="{{sizeAttribute.default_label}}" />
170+
<argument name="attributeLabel1" value="{{colorProductAttributeWithOptions.default_label}}" />
171+
<argument name="attributeLabel2" value="{{sizeProductAttributeWithOptions.default_label}}" />
172+
<argument name="quantity" value="100" />
162173
</actionGroup>
163-
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/>
174+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveConfigurableProductAfterGeneratingVariations"/>
164175
<!-- Step 5 - open child product and make out of stock -->
165176
<actionGroup ref="AdminOpenChildVariationOfConfigurableProductActionGroup" stepKey="OpenChildVariation">
166177
<argument name="variation" value="$$createConfigProduct.name$$-Blue-Medium" />
167178
</actionGroup>
168179
<switchToNextTab stepKey="switchToConfigChildProductPage"/>
169180
<waitForPageLoad stepKey="waitForProductPageLoad"/>
170-
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{UpdateAttributeQtyAndStockToOutOfStock.stockAvailability}}" stepKey="selectChildProductStockStatus"/>
171-
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct2"/>
181+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{UpdateAttributeQtyAndStockToOutOfStock.stockAvailability}}" stepKey="setChildProductStockStatusToOutOfStock"/>
182+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAfterSettingChildProductToOutOfStock"/>
172183
<closeTab stepKey="closeConfigChildProductPage"/>
173184
<!-- Step 6 - Navigate to Storefront product page -->
174185
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
175186
<argument name="productUrl" value="$$createConfigProduct.custom_attributes[url_key]$$"/>
176187
</actionGroup>
177188
<!-- Step 7 - Verify Blue Medium combination is disabled -->
189+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="waitForBlueSwatch" />
178190
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="clickBlueSwatch1"/>
179191
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Medium')}}" stepKey="waitForMediumSwatchVisible"/>
180192
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Medium')}}" userInput="disabled" stepKey="grabMediumAttribute"/>
@@ -184,6 +196,7 @@
184196
</assertEquals>
185197
<!-- Step 8 - Verify Blue Large combination is enabled -->
186198
<!-- Select Blue color swatch -->
199+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="waitForBlueSwatchAgain" />
187200
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="clickBlueSwatch2"/>
188201
<waitForElementClickable selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Large')}}" stepKey="waitForLargeSwatchClickable"/>
189202
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Large')}}" stepKey="clickLargeSize"/>

0 commit comments

Comments
 (0)