Skip to content

Commit e2d4f02

Browse files
committed
Merge remote-tracking branch 'origin/MC-3085' into 2.3-develop-mftf-pr19
2 parents 3422137 + 055dcf6 commit e2d4f02

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductInfoMainSection">
1212
<element name="AddToCart" type="button" selector="#product-addtocart-button"/>
13+
<element name="updateCart" type="button" selector="#product-updatecart-button" timeout="30"/>
1314
</section>
1415
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<!-- Add Configurable Product with Swatch attribute to the cart -->
12+
<actionGroup name="StorefrontAddProductWithSwatchesToTheCartActionGroup" extends="StorefrontAddProductToCartWithQtyActionGroup">
13+
<arguments>
14+
<argument name="product"/>
15+
<argument name="productOption" type="string"/>
16+
</arguments>
17+
<remove keyForRemoval="seeSuccessSaveMessage"/>
18+
<click selector="{{StorefrontProductInfoMainSection.visualSwatchOption(productOption)}}" after="waitForStorefrontProductPageLoad" stepKey="clickSelectOption"/>
19+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." after="waitForSuccessMessage" stepKey="seeAddToCartSuccessMessage"/>
20+
</actionGroup>
21+
22+
<!-- Update Configurable Product with Swatch attribute in the cart -->
23+
<actionGroup name="StorefrontUpdateCartConfigurableProductWithSwatches">
24+
<arguments>
25+
<argument name="product"/>
26+
<argument name="productOption" type="string"/>
27+
</arguments>
28+
<click selector="{{CheckoutCartProductSection.nthEditButton('1')}}" stepKey="clickEditConfigurableProductButton"/>
29+
<waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/>
30+
<click selector="{{StorefrontProductInfoMainSection.visualSwatchOption(productOption)}}" stepKey="changeSwatchAttributeOption"/>
31+
<click selector="{{StorefrontProductInfoMainSection.updateCart}}" stepKey="clickUpdateCartButton"/>
32+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
33+
<see selector="{{StorefrontMessagesSection.success}}" userInput="{{product.name}} was updated in your shopping cart." stepKey="assertSuccessMessage"/>
34+
</actionGroup>
35+
</actionGroups>

app/code/Magento/Swatches/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<element name="swatchAttributeOptions" type="text" selector="div.swatch-attribute-options"/>
1616
<element name="nthSwatchOptionText" type="button" selector="div.swatch-option.text:nth-of-type({{n}})" parameterized="true"/>
1717
<element name="productSwatch" type="button" selector="//div[@class='swatch-option'][@aria-label='{{var1}}']" parameterized="true"/>
18+
<element name="visualSwatchOption" type="button" selector=".swatch-option[option-tooltip-value='#{{visualSwatchOption}}']" parameterized="true"/>
1819
</section>
1920
</sections>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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="StorefrontCustomerCanChangeProductOptionsUsingSwatchesTest" extends="AdminCreateVisualSwatchTest">
12+
<annotations>
13+
<features value="Swatches"/>
14+
<stories value="Swatches"/>
15+
<title value="Customer can change product options using swatches"/>
16+
<description value="Customer can change product options using swatches"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-3085"/>
19+
<group value="swatches"/>
20+
</annotations>
21+
<before>
22+
<createData entity="Simple_US_Customer" after="createCategory" stepKey="createCustomer"/>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="createCustomer" before="goToProductAttributes" stepKey="deleteCustomer"/>
26+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" after="deleteCustomer" stepKey="logoutFromCustomer"/>
27+
</after>
28+
29+
<!-- Remove steps that are not used for this test -->
30+
<remove keyForRemoval="assertSwatch4"/>
31+
<remove keyForRemoval="assertSwatch5"/>
32+
<remove keyForRemoval="assertSwatch6"/>
33+
34+
<!-- Login to storefront from customer -->
35+
<actionGroup ref="LoginToStorefrontActionGroup" before="amOnProductPage" stepKey="loginCustomer">
36+
<argument name="Customer" value="$$createCustomer$$"/>
37+
</actionGroup>
38+
39+
<!-- Add configurable product with swatch attribute to the cart -->
40+
<actionGroup ref="StorefrontAddProductWithSwatchesToTheCartActionGroup" stepKey="addConfigurableProductToTheCart">
41+
<argument name="productQty" value="1"/>
42+
<argument name="product" value="_defaultProduct"/>
43+
<argument name="productOption" value="3498db"/>
44+
</actionGroup>
45+
46+
<!-- Go to shopping cart and update option of configurable product -->
47+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="openShoppingCartPage"/>
48+
<actionGroup ref="StorefrontUpdateCartConfigurableProductWithSwatches" stepKey="updateConfigurableProductInTheCart">
49+
<argument name="product" value="_defaultProduct"/>
50+
<argument name="productOption" value="e74d3c"/>
51+
</actionGroup>
52+
</test>
53+
</tests>

0 commit comments

Comments
 (0)