Skip to content

Commit f5184bf

Browse files
committed
ACP2E-1342:Create test coverage for ACP2E-1334
1 parent 093ddc6 commit f5184bf

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontConfigurableProductWithTwoAttributeSwatchWithDisplayOutOfStockEnabledTest">
11+
<annotations>
12+
<features value="Swatches"/>
13+
<stories value="Configurable product with swatch attribute and display out of stock enabled"/>
14+
<title value="Configurable product with swatch attribute and display out of stock enabled"/>
15+
<description value="Storefront selection of out of stock child products of configurable products are
16+
disabled when display out of stock options are enabled"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="ACP2E-1342"/>
19+
<group value="Swatches"/>
20+
</annotations>
21+
<before>
22+
<!--Set Display out of stock Enabled-->
23+
<magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 1"/>
24+
<!-- Create Category -->
25+
<createData entity="ApiCategory" stepKey="createCategory"/>
26+
<!-- Create Configurable Product -->
27+
<createData entity="ApiConfigurableProduct" stepKey="createConfigurableProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<!-- Login as Admin -->
31+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
32+
</before>
33+
<after>
34+
<!--Set Display out of stock Disabled-->
35+
<magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 0"/>
36+
<!-- Delete Category -->
37+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
38+
<!-- Delete Configurable Product -->
39+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProducts">
40+
<argument name="sku" value="{{ApiConfigurableProduct.sku}}"/>
41+
</actionGroup>
42+
<!-- Clear Filters -->
43+
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="clearFilters"/>
44+
<!-- Delete Color Attribute -->
45+
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteColorAttribute">
46+
<argument name="ProductAttribute" value="ProductColorAttribute"/>
47+
</actionGroup>
48+
<!-- Delete Size Attribute -->
49+
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteSizeAttribute">
50+
<argument name="ProductAttribute" value="ProductSizeAttribute"/>
51+
</actionGroup>
52+
<!-- Logout from Admin Area -->
53+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
54+
</after>
55+
<!-- Create Color Attribute -->
56+
<actionGroup ref="AddTextSwatchToProductActionGroup" stepKey="addColorAttribute">
57+
<argument name="attributeName" value="{{ProductColorAttribute.frontend_label}}"/>
58+
<argument name="attributeCode" value="{{ProductColorAttribute.attribute_code}}"/>
59+
<argument name="option1" value="Black"/>
60+
<argument name="option2" value="White"/>
61+
<argument name="option3" value="Blue"/>
62+
</actionGroup>
63+
<!--Create Size swatch attribute with 3 options: Small, Medium and Large-->
64+
<actionGroup ref="AddTextSwatchToProductActionGroup" stepKey="addSizeAttribute">
65+
<argument name="attributeName" value="{{ProductSizeAttribute.frontend_label}}"/>
66+
<argument name="attributeCode" value="{{ProductSizeAttribute.attribute_code}}"/>
67+
<argument name="option1" value="Small"/>
68+
<argument name="option2" value="Medium"/>
69+
<argument name="option3" value="Large"/>
70+
</actionGroup>
71+
<!--Go to product page and Configure Size and Color-->
72+
<amOnPage url="{{AdminProductEditPage.url($createConfigurableProduct.id$)}}" stepKey="goToConfigurableProduct"/>
73+
<actionGroup ref="CreateConfigurationsForTwoAttributeActionGroup" stepKey="createConfigurations">
74+
<argument name="attributeCode" value="{{ProductColorAttribute.attribute_code}}"/>
75+
<argument name="secondAttributeCode" value="{{ProductSizeAttribute.attribute_code}}"/>
76+
</actionGroup>
77+
<!--Make Simple product OOS-->
78+
<actionGroup ref="FilterAndSelectProductActionGroup" stepKey="filterProduct">
79+
<argument name="productSku" value="$$createConfigurableProduct.sku$$-Blue-Medium"/>
80+
</actionGroup>
81+
<!-- Set Stock Status of Product to Out Of Stock-->
82+
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="outOfStockStatus">
83+
<argument name="stockStatus" value="Out of Stock"/>
84+
</actionGroup>
85+
<!-- Save Product-->
86+
<actionGroup ref="SaveProductFormActionGroup" stepKey="clickSaveProduct"/>
87+
<!-- Perform Reindex-->
88+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
89+
<argument name="indices" value=""/>
90+
</actionGroup>
91+
<!--Go to Storefront Product Page-->
92+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openConfigurableProductPage">
93+
<argument name="productUrl" value="$createConfigurableProduct.custom_attributes[url_key]$"/>
94+
</actionGroup>
95+
<waitForPageLoad stepKey="waitForConfigurableProductPage"/>
96+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Blue')}}" stepKey="clickBlueAttribute"/>
97+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Medium')}}" userInput="disabled" stepKey="grabMediumAttribute"/>
98+
<assertEquals stepKey="assertMediumDisabled">
99+
<actualResult type="const">$grabMediumAttribute</actualResult>
100+
<expectedResult type="string">true</expectedResult>
101+
</assertEquals>
102+
<click selector="{{StorefrontProductInfoMainSection.swatchOptionByLabel('Large')}}" stepKey="clickLargeAttribute"/>
103+
</test>
104+
</tests>

0 commit comments

Comments
 (0)