Skip to content

Commit a554d54

Browse files
committed
ACQE-8328:Cart sidebar synchronization with Customer Data Lifetime and product changes
- Created test file
1 parent e347a9f commit a554d54

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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="StorefrontCartSidebarSynchronizationWithCustomerDataLifetimeTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Cart Sidebar Synchronization"/>
15+
<title value="Cart sidebar synchronization with Customer Data Lifetime and product changes"/>
16+
<description value="Verify cart sidebar shows cached values until Customer Data Lifetime expires or cart is updated, with multi-tab admin product changes"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4753"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create Simple product with price $10 -->
23+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct">
24+
<field key="name">Apple</field>
25+
<field key="price">10</field>
26+
</createData>
27+
<!-- Create customer account -->
28+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
29+
<!-- Admin login -->
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
31+
<!-- Set Customer Data Lifetime to 5 minutes -->
32+
<actionGroup ref="SetCustomerDataLifetimeActionGroup" stepKey="setCustomerDataLifetimeToFiveMinutes">
33+
<argument name="minutes" value="2"/>
34+
</actionGroup>
35+
<!-- Flush cache to ensure configuration takes effect -->
36+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushConfigCache">
37+
<argument name="tags" value="config"/>
38+
</actionGroup>
39+
</before>
40+
<after>
41+
<!-- Reset Customer Data Lifetime to default -->
42+
<actionGroup ref="SetCustomerDataLifetimeActionGroup" stepKey="resetCustomerDataLifetime"/>
43+
<!-- Logout customer -->
44+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
45+
<!-- Delete test data -->
46+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
47+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
48+
<!-- Admin logout -->
49+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
50+
</after>
51+
<!-- Step 1: Open browser tab A - Login to storefront, open simple product page and add to cart -->
52+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontTabA">
53+
<argument name="Customer" value="$createCustomer$"/>
54+
</actionGroup>
55+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPage">
56+
<argument name="product" value="$createSimpleProduct$"/>
57+
</actionGroup>
58+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addSimpleProductToCart">
59+
<argument name="productName" value="$createSimpleProduct.name$"/>
60+
</actionGroup>
61+
<!-- Step 2: Reload product page several times to validate caching -->
62+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageFirst"/>
63+
<waitForPageLoad stepKey="waitForFirstReload"/>
64+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageSecond"/>
65+
<waitForPageLoad stepKey="waitForSecondReload"/>
66+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageThird"/>
67+
<waitForPageLoad stepKey="waitForThirdReload"/>
68+
<!-- Step 3: Open Cart Sidebar (minicart) and verify initial values -->
69+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openCartSidebarInitial"/>
70+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName($createSimpleProduct.name$)}}" stepKey="waitForAppleProductInMiniCart"/>
71+
<waitForText userInput="$10.00" selector="{{StorefrontMinicartSection.productPriceByName($createSimpleProduct.name$)}}" stepKey="verifyInitialProductPrice"/>
72+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeCartSidebarInitial"/>
73+
<!-- Step 4: Open additional browser tab B - Admin product changes -->
74+
<openNewTab stepKey="openAdminTabB"/>
75+
<!-- Navigate to admin product edit page -->
76+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAppleProductForFirstEdit">
77+
<argument name="productId" value="$createSimpleProduct.id$"/>
78+
</actionGroup>
79+
<!-- Change product name to Apple-X and price to $20 -->
80+
<fillField userInput="Apple-X" selector="{{AdminProductFormSection.productName}}" stepKey="changeProductNameToAppleX"/>
81+
<fillField userInput="20" selector="{{AdminProductFormSection.productPrice}}" stepKey="changeProductPriceTo20"/>
82+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductWithFirstChanges"/>
83+
<!-- Step 5: Return to browser tab A - Storefront -->
84+
<switchToPreviousTab stepKey="switchBackToStorefrontTabA"/>
85+
<!-- Reload product page and open Cart Sidebar -->
86+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageAfterFirstAdminChange">
87+
<argument name="product" value="$createSimpleProduct$"/>
88+
</actionGroup>
89+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageAfterFirstAdminChange"/>
90+
<waitForPageLoad stepKey="waitForReloadAfterFirstChange"/>
91+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openCartSidebarAfterFirstChange"/>
92+
<!-- Verify Cart Sidebar still shows OLD values (cached) -->
93+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple')}}" stepKey="verifyProductNameStillApple"/>
94+
<waitForText userInput="$10.00" selector="{{StorefrontMinicartSection.productPriceByName('Apple')}}" stepKey="verifyProductPriceStill10"/>
95+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeCartSidebarAfterFirstChange"/>
96+
<!-- Step 6: Open Shopping Cart and update quantity to 3 -->
97+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
98+
<waitForElementVisible selector="{{CheckoutCartProductSection.ProductQuantityByName('Apple-X')}}" stepKey="waitForQuantityField"/>
99+
<clearField selector="{{CheckoutCartProductSection.ProductQuantityByName('Apple-X')}}" stepKey="clearQuantityField"/>
100+
<fillField userInput="3" selector="{{CheckoutCartProductSection.ProductQuantityByName('Apple-X')}}" stepKey="updateQuantityToThree"/>
101+
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="clickUpdateShoppingCart"/>
102+
<waitForPageLoad stepKey="waitForCartUpdate"/>
103+
<!-- Step 7: Open Cart Sidebar and verify it shows UPDATED values -->
104+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openCartSidebarAfterQuantityUpdate"/>
105+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple-X')}}" stepKey="verifyProductNameUpdatedToAppleX"/>
106+
<waitForText userInput="$20.00" selector="{{StorefrontMinicartSection.productPriceByName('Apple-X')}}" stepKey="verifyProductPriceUpdatedTo20"/>
107+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeCartSidebarAfterQuantityUpdate"/>
108+
<!-- Step 8: Reload page several times to validate caching again -->
109+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadCartPageFirst"/>
110+
<waitForPageLoad stepKey="waitForFirstCartReload"/>
111+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadCartPageSecond"/>
112+
<waitForPageLoad stepKey="waitForSecondCartReload"/>
113+
<!-- Step 9: Open browser tab B - Second admin product change -->
114+
<openNewTab stepKey="openAdminTabBSecond"/>
115+
<!-- Navigate to admin product edit page again -->
116+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAppleProductForSecondEdit">
117+
<argument name="productId" value="$createSimpleProduct.id$"/>
118+
</actionGroup>
119+
<!-- Change product name to Apple-X-Y and price to $30 -->
120+
<fillField userInput="Apple-X-Y" selector="{{AdminProductFormSection.productName}}" stepKey="changeProductNameToAppleXY"/>
121+
<fillField userInput="30" selector="{{AdminProductFormSection.productPrice}}" stepKey="changeProductPriceTo30"/>
122+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductWithSecondChanges"/>
123+
<!-- Step 10: Return to browser tab A - Storefront -->
124+
<switchToPreviousTab stepKey="switchBackToStorefrontTabASecond"/>
125+
<!-- Reload product page and open Cart Sidebar -->
126+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageAfterSecondAdminChange">
127+
<argument name="product" value="$createSimpleProduct$"/>
128+
</actionGroup>
129+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageAfterSecondAdminChange"/>
130+
<waitForPageLoad stepKey="waitForReloadAfterSecondChange"/>
131+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openCartSidebarAfterSecondChange"/>
132+
<!-- Verify Cart Sidebar still shows PREVIOUS values (Apple-X, $20) - cached -->
133+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple-X')}}" stepKey="verifyProductNameStillAppleX"/>
134+
<waitForText userInput="$20.00" selector="{{StorefrontMinicartSection.productPriceByName('Apple-X')}}" stepKey="verifyProductPriceStill20"/>
135+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeCartSidebarAfterSecondChange"/>
136+
<!-- Step 11: Wait 2 minutes for Customer Data Lifetime -->
137+
<wait time="120" stepKey="waitTwoMinutesForDataLifetimeExpiration"/>
138+
<!-- Step 12: Reload page and verify Cart Sidebar shows UPDATED values -->
139+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPageAfterDataLifetimeExpiration"/>
140+
<waitForPageLoad stepKey="waitForReloadAfterExpiration"/>
141+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openCartSidebarAfterExpiration"/>
142+
<!-- Verify Cart Sidebar now shows LATEST values (Apple-X-Y, $30) -->
143+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple-X-Y')}}" stepKey="verifyProductNameUpdatedToAppleXY"/>
144+
<waitForText userInput="$30.00" selector="{{StorefrontMinicartSection.productPriceByName('Apple-X-Y')}}" stepKey="verifyProductPriceUpdatedTo30"/>
145+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeCartSidebarFinal"/>
146+
</test>
147+
</tests>

0 commit comments

Comments
 (0)