|
| 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="AdminConfigurableProductOutOfStockTest"> |
| 12 | + <annotations> |
| 13 | + <features value="ConfigurableProduct"/> |
| 14 | + <stories value="Product visibility when in stock/out of stock"/> |
| 15 | + <title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> |
| 16 | + <description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> |
| 17 | + <testCaseId value="MAGETWO-79939"/> |
| 18 | + <group value="configurableProduct"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> |
| 22 | + <!-- Create the category to put the product in --> |
| 23 | + <createData entity="SimpleSubCategory" stepKey="createCategory"/> |
| 24 | + |
| 25 | + <!-- Create the configurable product based on the data in the /data folder --> |
| 26 | + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> |
| 27 | + <requiredEntity createDataKey="createCategory"/> |
| 28 | + </createData> |
| 29 | + |
| 30 | + <!-- Make the configurable product have two options, that are children of the default attribute set --> |
| 31 | + <createData entity="productAttributeWithDropdownTwoOptions" stepKey="createConfigProductAttribute"/> |
| 32 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 33 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 34 | + </createData> |
| 35 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> |
| 36 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 37 | + </createData> |
| 38 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 39 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 40 | + </createData> |
| 41 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 42 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 43 | + </getData> |
| 44 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> |
| 45 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 46 | + </getData> |
| 47 | + |
| 48 | + <!-- Create the 2 children that will be a part of the configurable product --> |
| 49 | + <createData entity="SimpleOption" stepKey="createConfigChildProduct1"> |
| 50 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 51 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 52 | + </createData> |
| 53 | + <createData entity="SimpleOption" stepKey="createConfigChildProduct2"> |
| 54 | + <field key="sku">SimpleTwoOption</field> |
| 55 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 56 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 57 | + </createData> |
| 58 | + |
| 59 | + <!-- Assign the two products to the configurable product --> |
| 60 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 61 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 62 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 63 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 64 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 65 | + </createData> |
| 66 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 67 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 68 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 69 | + </createData> |
| 70 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> |
| 71 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 72 | + <requiredEntity createDataKey="createConfigChildProduct2"/> |
| 73 | + </createData> |
| 74 | + |
| 75 | + <!-- log in --> |
| 76 | + <actionGroup ref="LoginAsAdmin" stepKey="login"/> |
| 77 | + </before> |
| 78 | + |
| 79 | + <after> |
| 80 | + <actionGroup ref="logout" stepKey="logout"/> |
| 81 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 82 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 83 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> |
| 84 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> |
| 85 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> |
| 86 | + </after> |
| 87 | + |
| 88 | + <!-- Check to make sure that the configurable product shows up as in stock --> |
| 89 | + <amOnPage url="/$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductPage"/> |
| 90 | + <waitForPageLoad stepKey="waitForStoreFrontLoad"/> |
| 91 | + <see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" stepKey="lookForOfStock"/> |
| 92 | + |
| 93 | + <!-- Find the first simple product that we just created using the product grid and go to its page--> |
| 94 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> |
| 95 | + <waitForPageLoad stepKey="waitForAdminProductGridLoad"/> |
| 96 | + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> |
| 97 | + <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> |
| 98 | + <argument name="product" value="$$createConfigChildProduct1$$"/> |
| 99 | + </actionGroup> |
| 100 | + <waitForPageLoad stepKey="waitForFiltersToBeApplied"/> |
| 101 | + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> |
| 102 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 103 | + |
| 104 | + <!-- Edit the quantity of the simple first product as 0 --> |
| 105 | + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity"/> |
| 106 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> |
| 107 | + <waitForPageLoad stepKey="waitForProductPageSaved"/> |
| 108 | + |
| 109 | + <!-- Check to make sure that the configurable product shows up as in stock --> |
| 110 | + <amOnPage url="/$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductPage2"/> |
| 111 | + <waitForPageLoad stepKey="waitForStoreFrontLoad2"/> |
| 112 | + <see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" stepKey="lookForOutOfStock2"/> |
| 113 | + |
| 114 | + <!-- Find the second simple product that we just created using the product grid and go to its page--> |
| 115 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage2"/> |
| 116 | + <waitForPageLoad stepKey="waitForAdminProductGridLoad2"/> |
| 117 | + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/> |
| 118 | + <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct2"> |
| 119 | + <argument name="product" value="$$createConfigChildProduct2$$"/> |
| 120 | + </actionGroup> |
| 121 | + <waitForPageLoad stepKey="waitForFiltersToBeApplied2"/> |
| 122 | + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage2"/> |
| 123 | + <waitForPageLoad stepKey="waitForProductPageLoad2"/> |
| 124 | + |
| 125 | + <!-- Edit the quantity of the second simple product as 0 --> |
| 126 | + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity2"/> |
| 127 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct2"/> |
| 128 | + <waitForPageLoad stepKey="waitForProductPageSaved2"/> |
| 129 | + |
| 130 | + <!-- Check to make sure that the configurable product shows up as out of stock --> |
| 131 | + <amOnPage url="/$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductPage3"/> |
| 132 | + <waitForPageLoad stepKey="waitForStoreFrontLoad3"/> |
| 133 | + <see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK" stepKey="lookForOutOfStock3"/> |
| 134 | + </test> |
| 135 | +</tests> |
0 commit comments