|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 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="StorefrontVerifySwatchesDisplayedInSearchResultsTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Swatches"/> |
| 14 | + <stories value="Swatches are displayed when using search"/> |
| 15 | + <title value="Swatches displayed in search results"/> |
| 16 | + <description value="This test case verifies whether the swatches are displayed when using search"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-4126"/> |
| 19 | + <group value="swatch"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Pre-condition 2: Create swatch attribute visual with options --> |
| 23 | + <createData entity="visualSwatchProductAttribute" stepKey="swatchAttribute"/> |
| 24 | + <createData entity="SwatchProductAttributeOption1" stepKey="swatchOption1"> |
| 25 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 26 | + </createData> |
| 27 | + <createData entity="SwatchProductAttributeOption2" stepKey="swatchOption2"> |
| 28 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 29 | + </createData> |
| 30 | + <createData entity="AddToDefaultSet" stepKey="addAttrToDefaultSet"> |
| 31 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 32 | + </createData> |
| 33 | + <!-- Resolve option data for use in products and assertions --> |
| 34 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getSwatchOption1"> |
| 35 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 36 | + </getData> |
| 37 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getSwatchOption2"> |
| 38 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 39 | + </getData> |
| 40 | + <!-- Pre-condition 1: Create configurable product --> |
| 41 | + <createData entity="BaseConfigurableProduct" stepKey="configProduct"/> |
| 42 | + <!-- Two child simples assigned attribute value --> |
| 43 | + <createData entity="ApiSimpleOne" stepKey="child1"> |
| 44 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 45 | + <requiredEntity createDataKey="getSwatchOption1"/> |
| 46 | + </createData> |
| 47 | + <createData entity="ApiSimpleTwo" stepKey="child2"> |
| 48 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 49 | + <requiredEntity createDataKey="getSwatchOption2"/> |
| 50 | + </createData> |
| 51 | + <!-- Apply configurable attribute and add children --> |
| 52 | + <createData entity="ConfigurableProductTwoOptions" stepKey="configOptions"> |
| 53 | + <requiredEntity createDataKey="configProduct"/> |
| 54 | + <requiredEntity createDataKey="swatchAttribute"/> |
| 55 | + <requiredEntity createDataKey="getSwatchOption1"/> |
| 56 | + <requiredEntity createDataKey="getSwatchOption2"/> |
| 57 | + </createData> |
| 58 | + <createData entity="ConfigurableProductAddChild" stepKey="addChild1"> |
| 59 | + <requiredEntity createDataKey="configProduct"/> |
| 60 | + <requiredEntity createDataKey="child1"/> |
| 61 | + </createData> |
| 62 | + <createData entity="ConfigurableProductAddChild" stepKey="addChild2"> |
| 63 | + <requiredEntity createDataKey="configProduct"/> |
| 64 | + <requiredEntity createDataKey="child2"/> |
| 65 | + </createData> |
| 66 | + <!-- Pre-condition 3,4: Ensure Used in product listing is enabled for the swatch attribute --> |
| 67 | + <actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/> |
| 68 | + <actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="openAttrGrid"/> |
| 69 | + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openSwatchAttribute"> |
| 70 | + <argument name="productAttributeCode" value="$$swatchAttribute.attribute_code$$"/> |
| 71 | + </actionGroup> |
| 72 | + <actionGroup ref="AdminUpdateAttributeUsedInProductListingActionGroup" stepKey="setUsedInProductListingToYes"/> |
| 73 | + <actionGroup ref="SaveProductAttributeActionGroup" stepKey="saveForYesNoAttribute"/> |
| 74 | + </before> |
| 75 | + <after> |
| 76 | + <!-- Delete products, swatches and logout from admin --> |
| 77 | + <deleteData createDataKey="configProduct" stepKey="deleteConfig"/> |
| 78 | + <deleteData createDataKey="child1" stepKey="deleteChild1"/> |
| 79 | + <deleteData createDataKey="child2" stepKey="deleteChild2"/> |
| 80 | + <deleteData createDataKey="swatchAttribute" stepKey="deleteAttribute"/> |
| 81 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> |
| 82 | + </after> |
| 83 | + <!-- Step 1: Go to storefront --> |
| 84 | + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openHome"/> |
| 85 | + <!-- Step 2: Use basic search to find product--> |
| 86 | + <actionGroup ref="StoreFrontFillSearchActionGroup" stepKey="fillSearch"> |
| 87 | + <argument name="query" value="$$configProduct.name$$"/> |
| 88 | + </actionGroup> |
| 89 | + <waitForElementClickable selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="waitToSubmitSearch"/> |
| 90 | + <click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="submitSearch"/> |
| 91 | + <waitForPageLoad stepKey="waitSearchResults"/> |
| 92 | + <waitForElementVisible selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="waitListBasic"/> |
| 93 | + <!--Step 2: Assert product is displayed with swatches --> |
| 94 | + <waitForText selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$configProduct.name$$" stepKey="seeProductBasic"/> |
| 95 | + <waitForElementVisible selector="{{StorefrontCategoryPageProductInfoSection.visualSwatchOption($$configProduct.id$$, $$getSwatchOption1.label$$)}}" stepKey="seeListingSwatchBasic"/> |
| 96 | + <waitForElementVisible selector="{{StorefrontCategoryPageProductInfoSection.visualSwatchOption($$configProduct.id$$, $$getSwatchOption2.label$$)}}" stepKey="seeListingSwatch"/> |
| 97 | + <!-- Step 3: Use advance search to find product--> |
| 98 | + <actionGroup ref="StorefrontOpenAdvancedSearchActionGroup" stepKey="openAdvancedSearch"/> |
| 99 | + <actionGroup ref="StorefrontFillFormAdvancedSearchActionGroup" stepKey="fillAdvancedForm"> |
| 100 | + <argument name="productName" value="$$configProduct.name$$"/> |
| 101 | + <argument name="sku" value="$$configProduct.sku$$"/> |
| 102 | + </actionGroup> |
| 103 | + <waitForElementVisible selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="waitListAdvanced"/> |
| 104 | + <!-- Step 3: Assert product is displayed with swatches --> |
| 105 | + <waitForText selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$configProduct.name$$" stepKey="seeProductAdvanced"/> |
| 106 | + <waitForElementVisible selector="{{StorefrontCategoryPageProductInfoSection.visualSwatchOption($$configProduct.id$$, $$getSwatchOption2.label$$)}}" stepKey="seeListingSwatchAdvanced"/> |
| 107 | + <waitForElementVisible selector="{{StorefrontCategoryPageProductInfoSection.visualSwatchOption($$configProduct.id$$, $$getSwatchOption1.label$$)}}" stepKey="seeListing1SwatchBasic"/> |
| 108 | + </test> |
| 109 | +</tests> |
0 commit comments