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" xsi : noNamespaceSchemaLocation =" urn:magento:mftf:Test/etc/testSchema.xsd" >
10
+ <test name =" StoreFrontAdminCreateTextSwatchAttributeAndAssertInStoreFrontTest" >
11
+ <annotations >
12
+ <features value =" Product" />
13
+ <stories value =" Create Text Swatch from Stores ->Attributes section: Product" />
14
+ <title value =" Create Text Swatch from Stores ->Attributes section: Product" />
15
+ <description value =" Admin create product attribute with text swatch and assert them in storefront" />
16
+ <severity value =" MAJOR" />
17
+ </annotations >
18
+ <before >
19
+ <!-- Login to admin-->
20
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" LoginAsAdmin" />
21
+ </before >
22
+ <after >
23
+ <actionGroup ref =" DeleteProductUsingProductGridActionGroup" stepKey =" deleteConfigurableProductsWithAllVariations" >
24
+ <argument name =" product" value =" ApiConfigurableProduct" />
25
+ </actionGroup >
26
+ <actionGroup ref =" ClearFiltersAdminDataGridActionGroup" stepKey =" clearFilter" />
27
+ <!-- Delete created attribute-->
28
+ <actionGroup ref =" DeleteProductAttributeActionGroup" stepKey =" deleteCreatedAttribute" >
29
+ <argument name =" ProductAttribute" value =" sizeAttribute" />
30
+ </actionGroup >
31
+ <!-- Clear filter-->
32
+ <actionGroup ref =" ClearFiltersAdminDataGridActionGroup" stepKey =" clearFilterInProductAttributePage" />
33
+ <!-- Logout-->
34
+ <actionGroup ref =" AdminLogoutActionGroup" stepKey =" logout" />
35
+ </after >
36
+ <actionGroup ref =" AdminNavigateToNewProductAttributePageActionGroup" stepKey =" navigateToNewProductAttributePage" />
37
+ <fillField userInput =" {{sizeAttribute.attribute_code}}" selector =" {{AttributePropertiesSection.DefaultLabel}}" stepKey =" fillDefaultLabel" />
38
+ <selectOption selector =" {{AttributePropertiesSection.InputType}}" userInput =" Text Swatch" stepKey =" selectInputType" />
39
+ <click selector =" {{AttributePropertiesSection.addSwatch}}" stepKey =" clickAddSwatch" />
40
+ <waitForAjaxLoad stepKey =" waitForAjaxLoad" />
41
+
42
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminSwatchValue('0')}}" userInput =" S" stepKey =" fillSwatchForAdmin" />
43
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminDescriptionValue('0')}}" userInput =" Small" stepKey =" fillDescriptionForAdmin" />
44
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchDefaultStoreSwatchValue('0')}}" userInput =" S1" stepKey =" fillSwatchForStoreView" />
45
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchDefaultStoreDescriptionValue('0')}}" userInput =" Small_1" stepKey =" fillDescriptionForStoreView" />
46
+ <!-- Add swatch for Medium-->
47
+ <click selector =" {{AttributePropertiesSection.addSwatch}}" stepKey =" clickAddSwatchForMedium" />
48
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminSwatchValue('1')}}" userInput =" M" stepKey =" fillMediumSwatchForAdmin" />
49
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminDescriptionValue('1')}}" userInput =" Medium" stepKey =" fillDescriptionForMediumForAdmin" />
50
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchDefaultStoreSwatchValue('1')}}" userInput =" M2" stepKey =" fillMediumSwatchForStoreView" />
51
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchDefaultStoreDescriptionValue('1')}}" userInput =" Medium_2" stepKey =" fillDescriptionForMediumForStoreView" />
52
+ <!-- Add swatch for Large-->
53
+ <click selector =" {{AttributePropertiesSection.addSwatch}}" stepKey =" clickAddSwatchForLarge" />
54
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminSwatchValue('2')}}" userInput =" L" stepKey =" fillLargeSwatchForAdmin" />
55
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminDescriptionValue('2')}}" userInput =" Large" stepKey =" fillDescriptionForLargeForAdmin" />
56
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchDefaultStoreSwatchValue('2')}}" userInput =" L3" stepKey =" fillLargeSwatchForStoreView" />
57
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchDefaultStoreDescriptionValue('2')}}" userInput =" Large_3" stepKey =" fillDescriptionForLargeForStoreView" />
58
+ <!-- Add swatch for Extra Large-->
59
+ <click selector =" {{AttributePropertiesSection.addSwatch}}" stepKey =" clickAddSwatchForExtraLarge" />
60
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminSwatchValue('3')}}" userInput =" XL" stepKey =" fillExtraLargeSwatchForAdmin" />
61
+ <fillField selector =" {{AttributeManageSwatchSection.textSwatchAdminDescriptionValue('3')}}" userInput =" Extra Large" stepKey =" fillDescriptionForExtraLargeForAdmin" />
62
+ <!-- Select Scope-->
63
+ <waitForElementClickable selector =" {{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey =" waitForAdvancedPropertiesFieldIsVisible" />
64
+ <click selector =" {{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey =" openAttributeAdvancedSection" />
65
+ <selectOption selector =" {{AdvancedAttributePropertiesSection.Scope}}" userInput =" Global" stepKey =" selectScope" />
66
+ <!-- Save attribute-->
67
+ <waitForElementClickable selector =" {{AdminNewAttributePanel.saveAttribute}}" stepKey =" waitForClickSaveAttributeButton" />
68
+ <click selector =" {{AdminNewAttributePanel.saveAttribute}}" stepKey =" clickSaveAttribute" />
69
+ <waitForPageLoad stepKey =" waitForSavingAttribute" />
70
+ <!-- Open created attribute-->
71
+ <fillField selector =" {{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput =" {{sizeAttribute.attribute_code}}" stepKey =" setAttributeCode" />
72
+ <click selector =" {{AdminProductAttributeGridSection.Search}}" stepKey =" searchForAttributeFromTheGrid" />
73
+ <click selector =" {{AdminProductAttributeGridSection.FirstRow}}" stepKey =" clickOnAttributeRow" />
74
+ <waitForPageLoad stepKey =" waitForPageLoad2" />
75
+ <!-- Assert textual swatch value configured for each store view-->
76
+ <waitForElementVisible selector =" {{AttributeManageSwatchSection.textSwatchStoreViewValue('S1')}}" stepKey =" assertSSizeStoreViewValue" />
77
+ <waitForElementVisible selector =" {{AttributeManageSwatchSection.textSwatchStoreViewValue('M2')}}" stepKey =" assertMSizeStoreViewValue" />
78
+ <waitForElementVisible selector =" {{AttributeManageSwatchSection.textSwatchStoreViewValue('L3')}}" stepKey =" assertLSizeStoreViewValue" />
79
+ <waitForElementVisible selector =" {{AttributeManageSwatchSection.textSwatchStoreViewValue('XL')}}" stepKey =" assertXLSizeStoreViewValue" />
80
+ <!-- Add created attribute to default attribute set-->
81
+ <actionGroup ref =" AdminOpenAttributeSetGridPageActionGroup" stepKey =" openAttributeSetPage" />
82
+ <actionGroup ref =" AdminOpenAttributeSetByNameActionGroup" stepKey =" openDefaultAttributeSet" />
83
+ <dragAndDrop selector1 =" {{AdminProductAttributeSetSection.attribute('size')}}" selector2 =" {{AdminProductAttributeSetSection.attribute('Product Details')}}" stepKey =" assignTestAttributes" />
84
+ <click selector =" {{AdminProductAttributeSetSection.saveBtn}}" stepKey =" clickAttributeSetSave" />
85
+ <!-- Navigate to Catalog-> Products and click On Configurable product dropdown -->
86
+ <actionGroup ref =" GotoCatalogProductsPageActionGroup" stepKey =" goToCatalogProductsPage" />
87
+ <actionGroup ref =" GotoConfigurableProductPageActionGroup" stepKey =" goToConfigurableProductPage" />
88
+ <!-- Assert Page title and Fill New product information-->
89
+ <waitForText selector =" {{AdminHeaderSection.pageTitle}}" userInput =" New Product" stepKey =" seeNewProductPageTitle" />
90
+ <waitForElementVisible selector =" {{NewProduct.productName}}" stepKey =" waitForProductNameToBeDisplayed" />
91
+ <fillField stepKey =" fillInProductNameFields" selector =" {{NewProduct.productName}}" userInput =" {{ApiConfigurableProduct.name}}" />
92
+ <waitForElementVisible selector =" {{NewProduct.productSku}}" stepKey =" waitForProductSkuToBeDisplayed" />
93
+ <fillField stepKey =" fillInProductSkuFields" selector =" {{NewProduct.productSku}}" userInput =" {{ApiConfigurableProduct.sku}}" />
94
+ <waitForElementVisible selector =" {{NewProduct.price}}" stepKey =" waitForPriceToBeDisplayed" />
95
+ <fillField stepKey =" fillInPriceFields" selector =" {{NewProduct.price}}" userInput =" {{ApiConfigurableProduct.price}}" />
96
+ <waitForElementVisible selector =" {{NewProduct.weight}}" stepKey =" waitForWeightToBeDisplayed" />
97
+ <fillField stepKey =" fillInWeightFields" selector =" {{NewProduct.weight}}" userInput =" {{ApiConfigurableProduct.weight}}" />
98
+ <!-- Click on create configuration button-->
99
+ <scrollTo selector =" {{NewProduct.title('Configurations')}}" stepKey =" scrollToConfigurationsSection" />
100
+ <waitForText userInput =" Configurations" selector =" {{NewProduct.title('Configurations')}}" stepKey =" seeConfigurationsSection" />
101
+ <waitForText userInput =" Create Configurations" selector =" {{NewProduct.title('Create Configurations')}}" stepKey =" seeCreateConfigurationsButtonIsPresent" />
102
+ <waitForElementClickable selector =" {{NewProduct.createConfigurationButton}}" stepKey =" waitForCreateConfigurationButtonToBeClickable" />
103
+ <click stepKey =" clickOnCreateConfigurationsButton" selector =" {{NewProduct.createConfigurationButton}}" />
104
+ <waitForPageLoad stepKey =" waitForCreateProductConfigurationPageToLoad" />
105
+ <actionGroup ref =" AdminSelectAttributeInConfigurableAttributesGrid" stepKey =" checkFirstAttribute" >
106
+ <argument name =" attributeCode" value =" {{sizeAttribute.attribute_code}}" />
107
+ </actionGroup >
108
+ <waitForElementClickable selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" waitToClickOnNextButton" />
109
+ <click selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" clickOnNextButton" />
110
+ <waitForPageLoad stepKey =" waitForStepLoad" />
111
+ <!-- Select All options-->
112
+ <waitForElementClickable selector =" {{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey =" waitToClickOnSelectAll" />
113
+ <click selector =" {{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey =" clickOnSelectAll" />
114
+ <waitForElementClickable selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" waitToClickSecondNextStep" />
115
+ <click selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" clickSecondNextStep" />
116
+ <!-- Assigning quantities to each SKU's -->
117
+ <waitForElementClickable selector =" {{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey =" waitToClickOnApplySingleQuantityToEachSku" />
118
+ <click selector =" {{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey =" clickOnApplySingleQuantityToEachSku" />
119
+ <waitForElementVisible selector =" {{AdminCreateProductConfigurationsPanel.quantity}}" stepKey =" waitForQuantityField" />
120
+ <fillField selector =" {{AdminCreateProductConfigurationsPanel.quantity}}" userInput =" 100" stepKey =" enterAttributeQuantity" />
121
+ <waitForElementClickable selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" waitForNextButtonToBecomeClickable" />
122
+ <click selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" clickOnNextButtonToNavigateToSummaryTab" />
123
+ <!-- Click on next to generate products-->
124
+ <waitForElementClickable selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" waitForGenerateProductButtonIsPresent" />
125
+ <click selector =" {{AdminCreateProductConfigurationsPanel.next}}" stepKey =" generateProductButtonIsPresent" />
126
+ <!-- Choose affected attribute set and Save product and then see success message-->
127
+ <waitForElementClickable selector =" {{AdminProductFormActionSection.saveButton}}" stepKey =" waitForSaveConfigurableProduct" />
128
+ <click selector =" {{AdminProductFormActionSection.saveButton}}" stepKey =" saveConfigurableProduct" />
129
+ <conditionalClick selector =" {{AdminChooseAffectedAttributeSetPopup.confirm}}" dependentSelector =" {{AdminChooseAffectedAttributeSetPopup.confirm}}" visible =" true" stepKey =" confirmDefaultAttributeSetForConfigurableProduct" />
130
+ <seeElement selector =" {{AdminProductMessagesSection.successMessage}}" stepKey =" checkProductSavedMessage" />
131
+ <!-- Do flush and clear cache-->
132
+ <actionGroup ref =" CliIndexerReindexActionGroup" stepKey =" performReindex" >
133
+ <argument name =" indices" value =" " />
134
+ </actionGroup >
135
+ <actionGroup ref =" CliCacheCleanActionGroup" stepKey =" cleanInvalidatedCaches" >
136
+ <argument name =" tags" value =" config full_page" />
137
+ </actionGroup >
138
+ <!-- Open the product in storefront-->
139
+ <actionGroup ref =" StorefrontOpenProductPageActionGroup" stepKey =" GoToProductPage" >
140
+ <argument name =" productUrl" value =" {{ApiConfigurableProduct.urlKey}}" />
141
+ </actionGroup >
142
+ <!-- Open product3 in storefront and add it to cart-->
143
+ <!-- Assert textaul swatch-->
144
+ <waitForElementVisible selector =" {{StorefrontProductInfoMainSection.productSwatchText('S1')}}" stepKey =" assertSSizeSwatch" />
145
+ <waitForElementVisible selector =" {{StorefrontProductInfoMainSection.productSwatchText('M2')}}" stepKey =" assertMSizeSwatch" />
146
+ <waitForElementVisible selector =" {{StorefrontProductInfoMainSection.productSwatchText('L3')}}" stepKey =" assertLSizeSwatch" />
147
+ <waitForElementVisible selector =" {{StorefrontProductInfoMainSection.productSwatchText('XL')}}" stepKey =" assertXLSizeSwatch" />
148
+ </test >
149
+ </tests >
0 commit comments