|
| 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 | +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> |
| 11 | + <actionGroup name="CreateCustomRadioOptions"> |
| 12 | + <annotations> |
| 13 | + <description>Adds a custom Radio Product Option with 3 Radio Options to a Product based on the provided Options.</description> |
| 14 | + </annotations> |
| 15 | + <!-- ActionGroup will add a single custom option to a product --> |
| 16 | + <!-- You must already be on the product creation page --> |
| 17 | + <arguments> |
| 18 | + <argument name="customOptionName"/> |
| 19 | + <argument name="productOption"/> |
| 20 | + <argument name="productOption2"/> |
| 21 | + </arguments> |
| 22 | + |
| 23 | + <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/> |
| 24 | + <waitForPageLoad stepKey="waitForAddProductPageLoad"/> |
| 25 | + |
| 26 | + <!-- Fill in the option and select the type of radio (once) --> |
| 27 | + <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionName}}"/> |
| 28 | + <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}"/> |
| 29 | + <waitForPageLoad stepKey="waitForDropdownOpen"/> |
| 30 | + <click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType('Radio Buttons')}}"/> |
| 31 | + |
| 32 | + <!-- Add three radio options based on the parameter --> |
| 33 | + <click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> |
| 34 | + |
| 35 | + <fillField stepKey="fillInValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption.title}}"/> |
| 36 | + <fillField stepKey="fillInValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption.price}}"/> |
| 37 | + |
| 38 | + <click stepKey="clickAddValue2" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> |
| 39 | + |
| 40 | + <fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}"/> |
| 41 | + <fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}"/> |
| 42 | + </actionGroup> |
| 43 | + |
| 44 | + <!--Add a custom option of type "file" to a product--> |
| 45 | + <actionGroup name="AddProductCustomOptionFile"> |
| 46 | + <annotations> |
| 47 | + <description>Add a custom File Product Option to a Product based on the provided File.</description> |
| 48 | + </annotations> |
| 49 | + <arguments> |
| 50 | + <argument name="option" defaultValue="ProductOptionFile"/> |
| 51 | + </arguments> |
| 52 | + |
| 53 | + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> |
| 54 | + <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> |
| 55 | + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/> |
| 56 | + <fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/> |
| 57 | + <click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/> |
| 58 | + <click selector="{{AdminProductCustomizableOptionsSection.optionType('File')}}" stepKey="selectTypeFile"/> |
| 59 | + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" stepKey="waitForElements"/> |
| 60 | + <fillField selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" userInput="{{option.price}}" stepKey="fillPrice"/> |
| 61 | + <selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceTypeByTitle(option.title)}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/> |
| 62 | + <fillField selector="{{AdminProductCustomizableOptionsSection.optionFileExtensionByTitle(option.title)}}" userInput="{{option.file_extension}}" stepKey="fillCompatibleExtensions"/> |
| 63 | + </actionGroup> |
| 64 | + |
| 65 | + <actionGroup name="AddProductCustomOptionField"> |
| 66 | + <annotations> |
| 67 | + <description>Add a custom Field Product Option to a Product based on the provided Option.</description> |
| 68 | + </annotations> |
| 69 | + <arguments> |
| 70 | + <argument name="option" defaultValue="ProductOptionField"/> |
| 71 | + </arguments> |
| 72 | + |
| 73 | + <scrollTo selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="scrollToAddButtonOption"/> |
| 74 | + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> |
| 75 | + <click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/> |
| 76 | + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/> |
| 77 | + <fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/> |
| 78 | + <click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/> |
| 79 | + <click selector="{{AdminProductCustomizableOptionsSection.optionType('Field')}}" stepKey="selectTypeFile"/> |
| 80 | + <waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" stepKey="waitForElements"/> |
| 81 | + <fillField selector="{{AdminProductCustomizableOptionsSection.optionPriceByTitle(option.title)}}" userInput="{{option.price}}" stepKey="fillPrice"/> |
| 82 | + <selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceTypeByTitle(option.title)}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/> |
| 83 | + <fillField selector="{{AdminProductCustomizableOptionsSection.optionSkuByTitle(option.title)}}" userInput="{{option.title}}" stepKey="fillSku"/> |
| 84 | + </actionGroup> |
| 85 | + |
| 86 | + <actionGroup name="importProductCustomizableOptions"> |
| 87 | + <annotations> |
| 88 | + <description>Import custom Product Options for the provided Product Name.</description> |
| 89 | + </annotations> |
| 90 | + <arguments> |
| 91 | + <argument name="productName" type="string"/> |
| 92 | + </arguments> |
| 93 | + |
| 94 | + <click selector="{{AdminProductCustomizableOptionsSection.importOptions}}" stepKey="clickImportOptions"/> |
| 95 | + <waitForElementVisible selector="{{AdminProductImportOptionsSection.selectProductTitle}}" stepKey="waitForTitleVisible"/> |
| 96 | + <conditionalClick selector="{{AdminProductImportOptionsSection.resetFiltersButton}}" dependentSelector="{{AdminProductImportOptionsSection.resetFiltersButton}}" visible="true" stepKey="clickResetFilters"/> |
| 97 | + <click selector="{{AdminProductImportOptionsSection.filterButton}}" stepKey="clickFilterButton"/> |
| 98 | + <waitForElementVisible selector="{{AdminProductImportOptionsSection.nameField}}" stepKey="waitForNameField"/> |
| 99 | + <fillField selector="{{AdminProductImportOptionsSection.nameField}}" userInput="{{productName}}" stepKey="fillProductName"/> |
| 100 | + <click selector="{{AdminProductImportOptionsSection.applyFiltersButton}}" stepKey="clickApplyFilters"/> |
| 101 | + <checkOption selector="{{AdminProductImportOptionsSection.firstRowItemCheckbox}}" stepKey="checkProductCheckbox"/> |
| 102 | + <click selector="{{AdminProductImportOptionsSection.importButton}}" stepKey="clickImport"/> |
| 103 | + </actionGroup> |
| 104 | + |
| 105 | + <actionGroup name="resetImportOptionFilter"> |
| 106 | + <annotations> |
| 107 | + <description>Click on the Reset Filters button for the Import Options filters on the Product grid page.</description> |
| 108 | + </annotations> |
| 109 | + |
| 110 | + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/> |
| 111 | + <click selector="{{AdminProductCustomizableOptionsSection.importOptions}}" stepKey="clickImportOptions"/> |
| 112 | + <click selector="{{AdminProductImportOptionsSection.resetFiltersButton}}" stepKey="clickResetFilterButton"/> |
| 113 | + </actionGroup> |
| 114 | + |
| 115 | + <actionGroup name="checkCustomizableOptionImport"> |
| 116 | + <annotations> |
| 117 | + <description>Validate that the Custom Product Option Import value is present and correct.</description> |
| 118 | + </annotations> |
| 119 | + <arguments> |
| 120 | + <argument name="option" defaultValue="ProductOptionField"/> |
| 121 | + <argument name="optionIndex" type="string"/> |
| 122 | + </arguments> |
| 123 | + |
| 124 | + <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionTitleInput(optionIndex)}}" stepKey="grabOptionTitle"/> |
| 125 | + <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionPrice(optionIndex)}}" stepKey="grabOptionPrice"/> |
| 126 | + <grabValueFrom selector="{{AdminProductCustomizableOptionsSection.optionSku(optionIndex)}}" stepKey="grabOptionSku"/> |
| 127 | + <assertEquals expected="{{option.title}}" expectedType="string" actual="$grabOptionTitle" stepKey="assertOptionTitle"/> |
| 128 | + <assertEquals expected="{{option.priceWithDecimals}}" expectedType="string" actual="$grabOptionPrice" stepKey="assertOptionPrice"/> |
| 129 | + <assertEquals expected="{{option.title}}" expectedType="string" actual="$grabOptionSku" stepKey="assertOptionSku"/> |
| 130 | + </actionGroup> |
| 131 | + <!-- Assumes we are on product edit page --> |
| 132 | + <actionGroup name="AdminDeleteAllProductCustomOptions" deprecated="Use AdminDeleteProductCustomOption for each custom option created instead."> |
| 133 | + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> |
| 134 | + <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> |
| 135 | + <executeInSelenium function="function($webdriver) use ($I) { |
| 136 | + $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('[data-index=\'options\'] [data-index=\'delete_button\']')); |
| 137 | + while(!empty($buttons)) { |
| 138 | + $button = reset($buttons); |
| 139 | + $I->executeJS('arguments[0].scrollIntoView(false)', [$button]); |
| 140 | + $button->click(); |
| 141 | + $webdriver->wait()->until(\Facebook\WebDriver\WebDriverExpectedCondition::stalenessOf($button)); |
| 142 | + $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('[data-index=\'options\'] [data-index=\'delete_button\']')); |
| 143 | + } |
| 144 | + }" stepKey="deleteCustomOptions"/> |
| 145 | + <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.customOptionButtonDelete}}" stepKey="assertNoCustomOptions"/> |
| 146 | + </actionGroup> |
| 147 | + |
| 148 | + <!-- Assumes we are on product edit page --> |
| 149 | + <actionGroup name="AdminAssertProductHasNoCustomOptions"> |
| 150 | + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> |
| 151 | + <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> |
| 152 | + <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.customOption}}" stepKey="assertNoCustomOptions"/> |
| 153 | + </actionGroup> |
| 154 | + <!-- Assumes we are on product edit page --> |
| 155 | + <actionGroup name="AdminAssertProductHasNoCustomOption" extends="AdminAssertProductCustomOptionVisible"> |
| 156 | + <remove keyForRemoval="assertCustomOptionVisible"/> |
| 157 | + <dontSeeElement selector="{{AdminProductCustomizableOptionsSection.fillOptionTitle(option.title)}}" after="waitCustomizableOptionsTabOpened" stepKey="assertNoCustomOption"/> |
| 158 | + </actionGroup> |
| 159 | + <!-- Assumes we are on product edit page --> |
| 160 | + <actionGroup name="AdminAssertProductCustomOptionVisible"> |
| 161 | + <arguments> |
| 162 | + <argument name="option" defaultValue="ProductOptionField"/> |
| 163 | + </arguments> |
| 164 | + <conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="expandContentTab"/> |
| 165 | + <waitForPageLoad time="10" stepKey="waitCustomizableOptionsTabOpened"/> |
| 166 | + <seeElement selector="{{AdminProductCustomizableOptionsSection.fillOptionTitle(option.title)}}" stepKey="assertCustomOptionVisible"/> |
| 167 | + </actionGroup> |
| 168 | + <!-- Assumes we are on product edit page --> |
| 169 | + <actionGroup name="AdminDeleteProductCustomOption" extends="AdminAssertProductCustomOptionVisible"> |
| 170 | + <remove keyForRemoval="assertCustomOptionVisible"/> |
| 171 | + <click selector="{{AdminProductCustomizableOptionsSection.deleteCustomOptions(option.title)}}" after="waitCustomizableOptionsTabOpened" stepKey="clickDeleteCustomOption"/> |
| 172 | + </actionGroup> |
| 173 | +</actionGroups> |
0 commit comments