|
| 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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminCreateTextSwatchTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Swatches"/> |
| 14 | + <stories value="Create/configure swatches"/> |
| 15 | + <title value="Admin can create product attribute with text swatch"/> |
| 16 | + <description value="Admin can create product attribute with text swatch"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-3078"/> |
| 19 | + <group value="Swatches"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 23 | + </before> |
| 24 | + <after> |
| 25 | + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> |
| 26 | + </after> |
| 27 | + |
| 28 | + <!-- Create a new product attribute of type "Text Swatch" --> |
| 29 | + <amOnPage url="{{ProductAttributePage.url}}" stepKey="goToNewProductAttributePage"/> |
| 30 | + <waitForPageLoad stepKey="waitForNewProductAttributePage"/> |
| 31 | + <fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/> |
| 32 | + <selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="swatch_text" stepKey="selectInputType"/> |
| 33 | + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch0"/> |
| 34 | + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('0')}}" userInput="red" stepKey="fillSwatch0"/> |
| 35 | + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('0')}}" userInput="Something red." stepKey="fillDescription0"/> |
| 36 | + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch1"/> |
| 37 | + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('1')}}" userInput="green" stepKey="fillSwatch1"/> |
| 38 | + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('1')}}" userInput="Something green." stepKey="fillDescription1"/> |
| 39 | + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch2"/> |
| 40 | + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('2')}}" userInput="blue" stepKey="fillSwatch2"/> |
| 41 | + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="Something blue." stepKey="fillDescription2"/> |
| 42 | + <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> |
| 43 | + <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/> |
| 44 | + <!-- Save and verify --> |
| 45 | + <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSave"/> |
| 46 | + <seeInField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/> |
| 47 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchText('1')}}" userInput="red" stepKey="seeSwatch0"/> |
| 48 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('1')}}" userInput="Something red." stepKey="seeDescription0"/> |
| 49 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchText('2')}}" userInput="green" stepKey="seeSwatch1"/> |
| 50 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('2')}}" userInput="Something green." stepKey="seeDescription1"/> |
| 51 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchText('3')}}" userInput="blue" stepKey="seeSwatch2"/> |
| 52 | + <seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('3')}}" userInput="Something blue." stepKey="seeDescription2"/> |
| 53 | + |
| 54 | + <!-- Create a configurable product to verify the storefront with --> |
| 55 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> |
| 56 | + <waitForPageLoad time="30" stepKey="waitForProductGrid"/> |
| 57 | + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> |
| 58 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 59 | + </actionGroup> |
| 60 | + <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/> |
| 61 | + <fillField userInput="{{_defaultProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/> |
| 62 | + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> |
| 63 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 64 | + </actionGroup> |
| 65 | + |
| 66 | + <!-- Create configurations based off the Text Swatch we created earlier --> |
| 67 | + <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/> |
| 68 | + <click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/> |
| 69 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFilterAttributeCodeField"/> |
| 70 | + <click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/> |
| 71 | + <click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/> |
| 72 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/> |
| 73 | + <click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/> |
| 74 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/> |
| 75 | + <click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/> |
| 76 | + <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/> |
| 77 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> |
| 78 | + <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> |
| 79 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> |
| 80 | + <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> |
| 81 | + |
| 82 | + <!-- Go to the product page and see text swatch options --> |
| 83 | + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnProductPage"/> |
| 84 | + <waitForPageLoad stepKey="waitForProductPage"/> |
| 85 | + <see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="red" stepKey="seeRed"/> |
| 86 | + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('1')}}" userInput="option-label" stepKey="grabRedLabel"/> |
| 87 | + <assertEquals stepKey="assertRedLabel"> |
| 88 | + <expectedResult type="string">Something red.</expectedResult> |
| 89 | + <actualResult type="string">{$grabRedLabel}</actualResult> |
| 90 | + </assertEquals> |
| 91 | + <see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="green" stepKey="seeGreen"/> |
| 92 | + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('2')}}" userInput="option-label" stepKey="grabGreenLabel"/> |
| 93 | + <assertEquals stepKey="assertGreenLabel"> |
| 94 | + <expectedResult type="string">Something green.</expectedResult> |
| 95 | + <actualResult type="string">{$grabGreenLabel}</actualResult> |
| 96 | + </assertEquals> |
| 97 | + <see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="blue" stepKey="seeBlue"/> |
| 98 | + <grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('3')}}" userInput="option-label" stepKey="grabBlueLabel"/> |
| 99 | + <assertEquals stepKey="assertBlueLabel"> |
| 100 | + <expectedResult type="string">Something blue.</expectedResult> |
| 101 | + <actualResult type="string">{$grabBlueLabel}</actualResult> |
| 102 | + </assertEquals> |
| 103 | + </test> |
| 104 | +</tests> |
0 commit comments