|
| 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="SpecialPriceForConfigurableProductBasedOnVisualSwatchAttributeTest"> |
| 12 | + <annotations> |
| 13 | + <features value="ConfigurableProduct"/> |
| 14 | + <stories value="Special price for configurable product based on visual swatch attribute"/> |
| 15 | + <title value="Special price for configurable product based on visual swatch attribute"/> |
| 16 | + <description value="Special price for configurable product based on visual swatch attribute"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-4385"/> |
| 19 | + <group value="catalog"/> |
| 20 | + <group value="configurableProduct"/> |
| 21 | + <group value="swatch"/> |
| 22 | + </annotations> |
| 23 | + |
| 24 | + <before> |
| 25 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 26 | + </before> |
| 27 | + |
| 28 | + <after> |
| 29 | + <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProductsWithAllVariations"> |
| 30 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 31 | + </actionGroup> |
| 32 | + <!-- Delete attribute --> |
| 33 | + |
| 34 | + <actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteProductAttributeByCode"> |
| 35 | + <argument name="attribute_code" value="{{ProductAttributeFrontendLabel.label}}"/> |
| 36 | + </actionGroup> |
| 37 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 38 | + <argument name="indices" value=""/> |
| 39 | + </actionGroup> |
| 40 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> |
| 41 | + </after> |
| 42 | + |
| 43 | + <!-- Step1 Create Visual Swatch attribute --> |
| 44 | + <actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="goToNewProductAttributePage"/> |
| 45 | + <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/> |
| 46 | + <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="swatch_text" stepKey="selectInputType"/> |
| 47 | + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch0"/> |
| 48 | + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('0')}}" userInput="red" stepKey="fillSwatch0"/> |
| 49 | + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('0')}}" userInput="CodeRed" stepKey="fillDescription0"/> |
| 50 | + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch1"/> |
| 51 | + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('1')}}" userInput="green" stepKey="fillSwatch1"/> |
| 52 | + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('1')}}" userInput="CodeGreen" stepKey="fillDescription1"/> |
| 53 | + <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> |
| 54 | + <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/> |
| 55 | + <!-- Save and verify --> |
| 56 | + <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSave"/> |
| 57 | + <seeInField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/> |
| 58 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchText('1')}}" userInput="red" stepKey="seeSwatch0"/> |
| 59 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('1')}}" userInput="CodeRed" stepKey="seeDescription0"/> |
| 60 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchText('2')}}" userInput="green" stepKey="seeSwatch1"/> |
| 61 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('2')}}" userInput="CodeGreen" stepKey="seeDescription1"/> |
| 62 | + |
| 63 | + <!-- Step 2 Create a configurable product to verify the storefront with --> |
| 64 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductGridPage"/> |
| 65 | + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct"> |
| 66 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 67 | + </actionGroup> |
| 68 | + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> |
| 69 | + <fillField userInput="{{_defaultProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> |
| 70 | + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> |
| 71 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 72 | + </actionGroup> |
| 73 | + |
| 74 | + <!-- Create configurations based off the Text Swatch we created earlier --> |
| 75 | + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/> |
| 76 | + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> |
| 77 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFilterAttributeCodeField"/> |
| 78 | + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> |
| 79 | + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> |
| 80 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> |
| 81 | + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> |
| 82 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> |
| 83 | + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> |
| 84 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/> |
| 85 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> |
| 86 | + <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.configProductName('1')}}" stepKey="grabRedConfigProdName"/> |
| 87 | + <grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.configProductName('2')}}" stepKey="grabGreenConfigProdName"/> |
| 88 | + |
| 89 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> |
| 90 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> |
| 91 | + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> |
| 92 | + |
| 93 | + <!-- Step 3 Set the special price here for red product --> |
| 94 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/> |
| 95 | + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfPresent"/> |
| 96 | + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> |
| 97 | + <fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{$grabRedConfigProdName}" stepKey="fillKeywordSearchField"/> |
| 98 | + <click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/> |
| 99 | + <waitForPageLoad stepKey="waitForProductSearch"/> |
| 100 | + <click selector="{{AdminProductGridSection.selectRowBasedOnName({$grabRedConfigProdName})}}" stepKey="selectProductToEditForSpecialPrice"/> |
| 101 | + <waitForPageLoad stepKey="waitForProductEditPageToLoad"/> |
| 102 | + <actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceTopTheProduct"> |
| 103 | + <argument name="price" value="10"/> |
| 104 | + </actionGroup> |
| 105 | + <click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/> |
| 106 | + <waitForPageLoad time='30' stepKey="waitForChildConfigProductToBeSaved"/> |
| 107 | + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSaveSuccessMessagePostSpecialPrice"/> |
| 108 | + |
| 109 | + <!-- Step 4 Go to the product page and see text swatch options --> |
| 110 | + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnProductPage"/> |
| 111 | + <waitForPageLoad stepKey="waitForProductPage"/> |
| 112 | + <see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="red" stepKey="seeRed"/> |
| 113 | + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('1')}}" userInput="data-option-label" stepKey="grabRedLabel"/> |
| 114 | + <assertEquals stepKey="assertRedLabel"> |
| 115 | + <expectedResult type="string">CodeRed</expectedResult> |
| 116 | + <actualResult type="string">{$grabRedLabel}</actualResult> |
| 117 | + </assertEquals> |
| 118 | + <see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="green" stepKey="seeGreen"/> |
| 119 | + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('2')}}" userInput="data-option-label" stepKey="grabGreenLabel"/> |
| 120 | + <assertEquals stepKey="assertGreenLabel"> |
| 121 | + <expectedResult type="string">CodeGreen</expectedResult> |
| 122 | + <actualResult type="string">{$grabGreenLabel}</actualResult> |
| 123 | + </assertEquals> |
| 124 | + |
| 125 | + <!-- Step 5 Open Configurable product with special price --> |
| 126 | + <click selector="{{StorefrontProductInfoMainSection.visualSwatchOptionText('red')}}" stepKey="clickRedProduct"/> |
| 127 | + <grabTextFrom selector="{{StorefrontProductInfoMainSection.specialPriceAmount}}" stepKey="specialPriceAmount"/> |
| 128 | + <assertEquals stepKey="assertSpecialPriceTextOnProductPage"> |
| 129 | + <expectedResult type="string">$10.00</expectedResult> |
| 130 | + <actualResult type="variable">specialPriceAmount</actualResult> |
| 131 | + </assertEquals> |
| 132 | + <seeElement selector="{{StorefrontProductInfoMainSection.oldPriceTag}}" stepKey="verifyRegulaPriceTag"/> |
| 133 | + <!-- Verify customer see product old price on the storefront page for red product --> |
| 134 | + <grabTextFrom selector="{{StorefrontProductInfoMainSection.oldPriceAmount}}" stepKey="oldPriceAmount"/> |
| 135 | + <assertEquals stepKey="assertOldPriceTextOnProductPage"> |
| 136 | + <expectedResult type="string">$123.00</expectedResult> |
| 137 | + <actualResult type="variable">oldPriceAmount</actualResult> |
| 138 | + </assertEquals> |
| 139 | + |
| 140 | + <!-- Step 6 Open green Configurable product without special price --> |
| 141 | + <click selector="{{StorefrontProductInfoMainSection.visualSwatchOptionText('green')}}" stepKey="clickGreenProduct"/> |
| 142 | + <see userInput="$123.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/> |
| 143 | + <dontSeeElement selector="{{StorefrontProductInfoMainSection.oldPriceTag}}" stepKey="verifyRegularPriceTagIsNotPresent"/> |
| 144 | + <dontSeeElement selector="{{StorefrontProductInfoMainSection.specialPriceAmount}}" stepKey="verifySpecialPriceIsNotPresent"/> |
| 145 | + </test> |
| 146 | +</tests> |
0 commit comments