|
| 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="AddNewProductAttributeInProductPageTest"> |
| 12 | + <annotations> |
| 13 | + <stories value="Create Attribute from product"/> |
| 14 | + <title value="Create Attribute from Product Page"/> |
| 15 | + <description value="Login as admin and create new product attribute from product page with Text Field"/> |
| 16 | + <severity value="BLOCKER"/> |
| 17 | + <testCaseId value="MC-26654"/> |
| 18 | + <group value="mtf_migrated"/> |
| 19 | + </annotations> |
| 20 | + |
| 21 | + <before> |
| 22 | + <!-- Login as admin --> |
| 23 | + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> |
| 24 | + |
| 25 | + <!--Create Category--> |
| 26 | + <createData entity="SimpleSubCategory" stepKey="createCategory"/> |
| 27 | + |
| 28 | + </before> |
| 29 | + <after> |
| 30 | + <!-- delete category --> |
| 31 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 32 | + <!-- delete created product attribute --> |
| 33 | + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute"> |
| 34 | + <argument name="ProductAttribute" value="newProductAttribute"/> |
| 35 | + </actionGroup> |
| 36 | + |
| 37 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 38 | + </after> |
| 39 | + |
| 40 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> |
| 41 | + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="navigateToCreateProductPage"> |
| 42 | + <argument name="product" value="SimpleProduct"/> |
| 43 | + </actionGroup> |
| 44 | + <actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm"> |
| 45 | + <argument name="product" value="SimpleProduct"/> |
| 46 | + </actionGroup> |
| 47 | + <actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct"> |
| 48 | + <argument name="categoryName" value="$createCategory.name$"/> |
| 49 | + </actionGroup> |
| 50 | + |
| 51 | + <!-- Create New Product Attribute --> |
| 52 | + <actionGroup ref="AdminStartCreateProductAttributeOnProductPageActionGroup" stepKey="createDropdownAttribute"> |
| 53 | + <argument name="attributeCode" value="{{newProductAttribute.attribute_code}}" /> |
| 54 | + <argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}" /> |
| 55 | + <argument name="inputType" value="Dropdown" /> |
| 56 | + </actionGroup> |
| 57 | + |
| 58 | + |
| 59 | + <checkOption selector="{{AdminCreateNewProductAttributeSection.isRequired}}" stepKey="enableIsRequiredOption"/> |
| 60 | + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible"/> |
| 61 | + <click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton"/> |
| 62 | + |
| 63 | + <!-- Adding the values in the grid --> |
| 64 | + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" stepKey="waitForDefaultStoreViewToVisible"/> |
| 65 | + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" userInput="value 1" stepKey="fillDefaultStoreView"/> |
| 66 | + <fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('0')}}" userInput="value 1 admin" stepKey="fillAdminField"/> |
| 67 | + <checkOption selector="{{AdminCreateNewProductAttributeSection.defaultRadioButton('1')}}" stepKey="selectRadioButton"/> |
| 68 | + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible2"/> |
| 69 | + <click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton2"/> |
| 70 | + <waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" stepKey="waitForDefaultStoreViewToVisible2"/> |
| 71 | + <fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" userInput="value 2" stepKey="fillDefaultStoreView2"/> |
| 72 | + <fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('1')}}" userInput="value 2 admin" stepKey="fillAdminField2"/> |
| 73 | + |
| 74 | + <!-- Adding the values to the storefront properties --> |
| 75 | + <scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/> |
| 76 | + <click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/> |
| 77 | + <waitForPageLoad stepKey="waitForStoreFrontToLoad"/> |
| 78 | + <scrollTo stepKey="scroll1" selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80"/> |
| 79 | + <checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/> |
| 80 | + <checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/> |
| 81 | + <checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableIsUComparableption"/> |
| 82 | + |
| 83 | + <!-- Save created Attribute --> |
| 84 | + <click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/> |
| 85 | + <waitForPageLoad stepKey="waitForAttributeToSave"/> |
| 86 | + |
| 87 | + <!-- Verify product attribute added in product form --> |
| 88 | + <scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/> |
| 89 | + <waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/> |
| 90 | + <click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/> |
| 91 | + <seeElement selector="{{AdminProductFormSection.attributeRequiredLabelText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/> |
| 92 | + <seeElement selector="{{AdminProductFormSection.newAddedAttributeValue('value 1 admin')}}" stepKey="seeAttributeValue"/> |
| 93 | + |
| 94 | + <!-- Save a Product --> |
| 95 | + <actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="saveTheProduct"/> |
| 96 | + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> |
| 97 | + |
| 98 | + <!--Click on Go Back button --> |
| 99 | + <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackToGridSimple"/> |
| 100 | + |
| 101 | + <!-- Select created attribute as an column --> |
| 102 | + <actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openColumnsDropdown"/> |
| 103 | + <actionGroup ref="CheckAdminProductGridColumnOptionActionGroup" stepKey="checkCreatedAttributeColumn"> |
| 104 | + <argument name="optionName" value="{{ProductAttributeFrontendLabel.label}}"/> |
| 105 | + </actionGroup> |
| 106 | + <wait stepKey="waitPostClickingCheck" time="5"/> |
| 107 | + <actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="closeColumnsDropdown"/> |
| 108 | + |
| 109 | + <!-- Asserting the value of the created column --> |
| 110 | + <actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeCreatedAttributeColumn"> |
| 111 | + <argument name="row" value="1"/> |
| 112 | + <argument name="column" value="{{ProductAttributeFrontendLabel.label}}"/> |
| 113 | + <argument name="value" value="value 1 admin"/> |
| 114 | + </actionGroup> |
| 115 | + |
| 116 | + <!--Verify Product Attribute is present in Category Store Front Page --> |
| 117 | + <amOnPage url="$$createCategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontPage"/> |
| 118 | + <waitForPageLoad stepKey="waitForProductFrontPageToLoad"/> |
| 119 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/> |
| 120 | + <waitForPageLoad stepKey="waitForCategoryPageToLoad"/> |
| 121 | + <click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/> |
| 122 | + <waitForPageLoad stepKey="waitForProductToLoad1"/> |
| 123 | + <scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="scrollToMoreInformation"/> |
| 124 | + <see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/> |
| 125 | + <see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="value 1" stepKey="seeAttributeValueOnStorefront"/> |
| 126 | + |
| 127 | + <!-- Return to catgeory page to assert the layered navigation --> |
| 128 | + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategoryAgain"/> |
| 129 | + <waitForPageLoad stepKey="waitForCategoryPageToLoad2"/> |
| 130 | + <fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{SimpleProduct.name}}" stepKey="fillProductName"/> |
| 131 | + <waitForPageLoad stepKey="waitForSearchButtonEnabled"/> |
| 132 | + <click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/> |
| 133 | + |
| 134 | + <!-- Assert that attribute values present in layered navigation --> |
| 135 | + <actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertAttributeWithOptionInLayeredNavigation"> |
| 136 | + <argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}"/> |
| 137 | + <argument name="attributeOptionLabel" value="value 1 1"/> |
| 138 | + </actionGroup> |
| 139 | + |
| 140 | + <!-- Click on the attribute --> |
| 141 | + <click selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('value 1')}}" stepKey="clickOnAttributeValue"/> |
| 142 | + <seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingBy}}" stepKey="seeNowShoppingBy"/> |
| 143 | + <seeElement selector="{{StorefrontLayeredNavigationSection.actionRemove}}" stepKey="seeX"/> |
| 144 | + <seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingByAttribute(ProductAttributeFrontendLabel.label)}}" stepKey="seeNowShoppingByAttribute"/> |
| 145 | + <seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingByAttributeValue('value 1')}}" stepKey="seeNowShoppingByAttributeValue"/> |
| 146 | + |
| 147 | + </test> |
| 148 | +</tests> |
0 commit comments