|
| 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="UseLayeredNavigationToFilterProductsByOutOfStockOptionOfConfigurableProductTest"> |
| 12 | + <annotations> |
| 13 | + <stories value="Search Term"/> |
| 14 | + <title value="Use Layered Navigation to filter Products by Out of Stock option of configurable product"/> |
| 15 | + <description value="Use Layered Navigation to filter Products by Out of Stock option of configurable product"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-5228"/> |
| 18 | + </annotations> |
| 19 | + <before> |
| 20 | + <actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/> |
| 21 | + <createData entity="SimpleSubCategory" stepKey="createCategory"> |
| 22 | + <field key="name">Test Out Of Stock Filter</field> |
| 23 | + </createData> |
| 24 | + <createData entity="ApiSimpleProduct" stepKey="createProduct"> |
| 25 | + <requiredEntity createDataKey="createCategory"/> |
| 26 | + <field key="name">Product Simple 1</field> |
| 27 | + <field key="price">200</field> |
| 28 | + <field key="quantity">100</field> |
| 29 | + </createData> |
| 30 | + <createData entity="ConfigurableProductWithAttributeSet" stepKey="createConfigurableProduct"> |
| 31 | + <requiredEntity createDataKey="createCategory"/> |
| 32 | + <field key="name">Product Configurable 1</field> |
| 33 | + <field key="price">300</field> |
| 34 | + <field key="quantity">500</field> |
| 35 | + </createData> |
| 36 | + <!-- Create product attribute with 3 options --> |
| 37 | + <actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="navigateToNewProductAttributePage"/> |
| 38 | + <!-- Set attribute properties --> |
| 39 | + <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="Test Out Of Stock Attribute" stepKey="fillDefaultLabel"/> |
| 40 | + <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="Dropdown" stepKey="fillInputType"/> |
| 41 | + <!-- Set advanced attribute properties --> |
| 42 | + <click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="showAdvancedAttributePropertiesSection"/> |
| 43 | + <waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOut"/> |
| 44 | + <fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="TestOutOfStockAttribute" stepKey="fillAttributeCode"/> |
| 45 | + <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/> |
| 46 | + <!-- Add new attribute options --> |
| 47 | + <click selector="{{AttributeOptionsSection.AddOption}}" stepKey="clickAddOption1"/> |
| 48 | + <fillField selector="{{DropdownAttributeOptionsSection.nthOptionAdminLabel('1')}}" userInput="one" stepKey="fillAdminValue1"/> |
| 49 | + <click selector="{{AttributeOptionsSection.AddOption}}" stepKey="clickAddOption2"/> |
| 50 | + <fillField selector="{{DropdownAttributeOptionsSection.nthOptionAdminLabel('2')}}" userInput="two" stepKey="fillAdminValue2"/> |
| 51 | + <click selector="{{AttributeOptionsSection.AddOption}}" stepKey="clickAddOption3"/> |
| 52 | + <fillField selector="{{DropdownAttributeOptionsSection.nthOptionAdminLabel('3')}}" userInput="three" stepKey="fillAdminValue3"/> |
| 53 | + <!-- Set Use In Layered Navigation --> |
| 54 | + <scrollToTopOfPage stepKey="scrollToTopOfThePage"/> |
| 55 | + <click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="goToStorefrontProperties"/> |
| 56 | + <selectOption selector="{{AttributePropertiesSection.useInLayeredNavigation}}" userInput="1" stepKey="selectUseInLayeredNavigation"/> |
| 57 | + <!-- Save the new product attribute --> |
| 58 | + <click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSave"/> |
| 59 | + <waitForPageLoad stepKey="waitForGridPageLoad"/> |
| 60 | + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> |
| 61 | + <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSets"/> |
| 62 | + <waitForPageLoad stepKey="waitForProductAttributeSetPageToLoad"/> |
| 63 | + <click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickOnResetFilter"/> |
| 64 | + <!-- Filter created Product Attribute Set --> |
| 65 | + <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="Default" stepKey="fillAttributeSetName"/> |
| 66 | + <click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickOnSearchButton"/> |
| 67 | + <waitForPageLoad stepKey="waitForPageToLoad"/> |
| 68 | + <click selector="{{AdminProductAttributeSetGridSection.AttributeSetName('Default')}}" stepKey="clickOnAttributeSet"/> |
| 69 | + <waitForPageLoad stepKey="waitForAttributeSetEditPageToLoad"/> |
| 70 | + <!--Assign Attribute to the Group and save the attribute set --> |
| 71 | + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttribute"> |
| 72 | + <argument name="group" value="Product Details"/> |
| 73 | + <argument name="attribute" value="TestOutOfStockAttribute"/> |
| 74 | + </actionGroup> |
| 75 | + <click selector="{{AdminProductAttributeSetActionSection.save}}" stepKey="clickOnSaveButton"/> |
| 76 | + <waitForPageLoad stepKey="waitForPageToSave"/> |
| 77 | + <see userInput="You saved the attribute set" selector="{{AdminMessagesSection.success}}" stepKey="successMessage"/> |
| 78 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openSimpleProductEditPage"> |
| 79 | + <argument name="productId" value="$createProduct.id$"/> |
| 80 | + </actionGroup> |
| 81 | + <selectOption selector="{{AdminProductFormSection.customSelectField('TestOutOfStockAttribute')}}" userInput="two" stepKey="setFirstAttributeValue"/> |
| 82 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveFirstProduct"/> |
| 83 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openConfigurableProductEditPage"> |
| 84 | + <argument name="productId" value="$createConfigurableProduct.id$"/> |
| 85 | + </actionGroup> |
| 86 | + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/> |
| 87 | + <actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="checkSecondAttribute"> |
| 88 | + <argument name="attributeCode" value="TestOutOfStockAttribute"/> |
| 89 | + </actionGroup> |
| 90 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/> |
| 91 | + <waitForPageLoad stepKey="waitForStepLoad"/> |
| 92 | + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> |
| 93 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickSecondNextStep"/> |
| 94 | + <click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantityToEachSkus}}" stepKey="clickOnApplyUniqueQuantitiesToEachSku"/> |
| 95 | + <selectOption selector="{{AdminCreateProductConfigurationsPanel.selectQuantity}}" userInput="Test Out Of Stock Attribute" stepKey="selectOption"/> |
| 96 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity('one')}}" userInput="200" stepKey="enterAttributeQuantity1"/> |
| 97 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity('two')}}" userInput="0" stepKey="enterAttributeQuantity2"/> |
| 98 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity('three')}}" userInput="600" stepKey="enterAttributeQuantity3"/> |
| 99 | + <waitForElement selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitThirdNextButton"/> |
| 100 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickThirdStep"/> |
| 101 | + <waitForElement selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitGenerateConfigurationsButton"/> |
| 102 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickToGenerateConfigurations"/> |
| 103 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveButton"/> |
| 104 | + <magentoCLI stepKey="reindex" command="indexer:reindex"/> |
| 105 | + <magentoCLI stepKey="flushCache" command="cache:flush"/> |
| 106 | + </before> |
| 107 | + <after> |
| 108 | + <!-- Delete all created data --> |
| 109 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 110 | + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> |
| 111 | + <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openProductAttributeFromSearchResultInGrid"> |
| 112 | + <argument name="productAttributeCode" value="TestOutOfStockAttribute"/> |
| 113 | + </actionGroup> |
| 114 | + <actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteSecondProductAttributeByAttributeCode"> |
| 115 | + <argument name="productAttributeCode" value="TestOutOfStockAttribute"/> |
| 116 | + </actionGroup> |
| 117 | + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductAttributesFilter"/> |
| 118 | + <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductsGridFilter"/> |
| 119 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 120 | + <magentoCron groups="index" stepKey="reindexInvalidatedIndices"/> |
| 121 | + </after> |
| 122 | + <actionGroup ref="StorefrontNavigateToCategoryUrlActionGroup" stepKey="openCategoryPage"> |
| 123 | + <argument name="categoryUrl" value="$$createCategory.custom_attributes[url_key]$$"/> |
| 124 | + </actionGroup> |
| 125 | + <seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($createProduct.name$)}}" stepKey="seeSimpleProductInCategoryPage"/> |
| 126 | + <seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($createConfigurableProduct.name$)}}" stepKey="seeConfigurableProductInCategoryPage"/> |
| 127 | + <!-- Verify the Layered Navigation first option tab --> |
| 128 | + <click selector="{{StorefrontLayeredNavigationSection.shoppingOptionsByName('Test Out Of Stock Attribute')}}" stepKey="clickTheAttributeFromShoppingOptions"/> |
| 129 | + <seeElement selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('one')}}" stepKey="verifyFirstOptionName"/> |
| 130 | + <seeElement selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpandedCount('one','1')}}" stepKey="verifyFirstOptionNameCount"/> |
| 131 | + <!-- second option --> |
| 132 | + <seeElement selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('two')}}" stepKey="verifySecondOptionName"/> |
| 133 | + <seeElement selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpandedCount('two','1')}}" stepKey="verifySecondOptionNameCount"/> |
| 134 | + <!-- third option --> |
| 135 | + <seeElement selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('three')}}" stepKey="verifyThirdOptionName"/> |
| 136 | + <seeElement selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpandedCount('three','1')}}" stepKey="verifyThirdOptionNameCount"/> |
| 137 | + <!-- Click on the attribute --> |
| 138 | + <click selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('two')}}" stepKey="clickOnSecondAttributeValue"/> |
| 139 | + <seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($createProduct.name$)}}" stepKey="seeSimpleProductInPage"/> |
| 140 | + </test> |
| 141 | +</tests> |
| 142 | + |
0 commit comments