Skip to content

Commit 16f064a

Browse files
committed
ACQE-8327: Cart Sidebar synchronization with Customer Data Lifetime through customer login/logout
- Created test file
1 parent b9f5d6f commit 16f064a

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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="StorefrontCartSidebarSynchronizationWithCustomerLoginTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Cart Sidebar Synchronization"/>
15+
<title value="Cart Sidebar synchronization with Customer Data Lifetime through customer login/logout"/>
16+
<description value="Verify that cart sidebar data is synchronized after customer logout/login when Customer Data Lifetime expires and product data changes in admin"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4849"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Precondition 1: Create simple product -->
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
<field key="name">Apple</field>
27+
<field key="price">10</field>
28+
</createData>
29+
<!-- Precondition 2: Create customer -->
30+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
31+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
32+
<!-- Precondition 3: Set Customer Data Lifetime to 5 minutes -->
33+
<actionGroup ref="SetCustomerDataLifetimeActionGroup" stepKey="setCustomerDataLifetime">
34+
<argument name="minutes" value="2"/>
35+
</actionGroup>
36+
</before>
37+
<after>
38+
<!-- Logout customer -->
39+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerInCleanup"/>
40+
<!-- Reset Customer Data Lifetime configuration to default -->
41+
<actionGroup ref="SetCustomerDataLifetimeActionGroup" stepKey="resetCustomerDataLifetime"/>
42+
<!-- Delete test data and Logout from Admin -->
43+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
44+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
45+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
46+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminInCleanup"/>
47+
</after>
48+
<!-- Step 1: Login to storefront and add product to cart -->
49+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefront">
50+
<argument name="Customer" value="$createCustomer$"/>
51+
</actionGroup>
52+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPage">
53+
<argument name="product" value="$createSimpleProduct$"/>
54+
</actionGroup>
55+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addSimpleProductToCart">
56+
<argument name="productName" value="$createSimpleProduct.name$"/>
57+
</actionGroup>
58+
<!-- Step 2: Reload product page several times to ensure caching -->
59+
<reloadPage stepKey="reloadPage1"/>
60+
<waitForPageLoad stepKey="waitForPageReload1"/>
61+
<reloadPage stepKey="reloadPage2"/>
62+
<waitForPageLoad stepKey="waitForPageReload2"/>
63+
<reloadPage stepKey="reloadPage3"/>
64+
<waitForPageLoad stepKey="waitForPageReload3"/>
65+
<!-- Step 3: Open Cart Sidebar and verify initial values -->
66+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openMiniCart"/>
67+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName($createSimpleProduct.name$)}}" stepKey="verifyAppleProductInMiniCart"/>
68+
<waitForText userInput="$10.00" selector="{{StorefrontMinicartSection.productPriceByName($createSimpleProduct.name$)}}" stepKey="verifyInitialProductPrice"/>
69+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeMiniCart"/>
70+
<!-- Step 4: Open new tab for Admin and change product details -->
71+
<openNewTab stepKey="openAdminTab"/>
72+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
73+
<argument name="productId" value="$createSimpleProduct.id$"/>
74+
</actionGroup>
75+
<!-- Change product name and price -->
76+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="Apple-X" stepKey="changeProductName"/>
77+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="20" stepKey="changeProductPrice"/>
78+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
79+
<!-- Step 5: Return to storefront, reload page and verify cached values -->
80+
<switchToPreviousTab stepKey="switchToStorefrontTab"/>
81+
<!-- Reload product page and open Cart Sidebar -->
82+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageAfterFirstAdminChange">
83+
<argument name="product" value="$createSimpleProduct$"/>
84+
</actionGroup>
85+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageAfterFirstAdminChange"/>
86+
<waitForPageLoad stepKey="waitForReloadAfterFirstChange"/>
87+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openMiniCartAfterProductChange"/>
88+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName($createSimpleProduct.name$)}}" stepKey="verifyAppleProductInMiniCartAfterChange"/>
89+
<waitForText userInput="$10.00" selector="{{StorefrontMinicartSection.productPriceByName($createSimpleProduct.name$)}}" stepKey="verifyCachedProductPrice"/>
90+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeMiniCartAfterProductChange"/>
91+
<!-- Step 6: Logout and login again to invalidate cache -->
92+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
93+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginBackToStorefront">
94+
<argument name="Customer" value="$createCustomer$"/>
95+
</actionGroup>
96+
<!-- Step 7: Verify cart shows updated values after login -->
97+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openMiniCartAfterLogin"/>
98+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple-X')}}" stepKey="verifyAppleProductInMiniCartAfterLogin"/>
99+
<waitForText userInput="$20.00" selector="{{StorefrontMinicartSection.productPriceByName($createSimpleProduct.name$)}}" stepKey="verifyUpdatedProductPriceAfterLogin"/>
100+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeMiniCartAfterLogin"/>
101+
<!-- Step 8: Reload page several times to ensure caching -->
102+
<reloadPage stepKey="reloadPageAfterLogin1"/>
103+
<waitForPageLoad stepKey="waitForPageReloadAfterLogin1"/>
104+
<reloadPage stepKey="reloadPageAfterLogin2"/>
105+
<waitForPageLoad stepKey="waitForPageReloadAfterLogin2"/>
106+
<!-- Step 9: Change product details again in admin -->
107+
<switchToNextTab stepKey="switchToAdminTab"/>
108+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPageAgain">
109+
<argument name="productId" value="$createSimpleProduct.id$"/>
110+
</actionGroup>
111+
<!-- Change product name and price again -->
112+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="Apple-X-Y" stepKey="changeProductNameAgain"/>
113+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="30" stepKey="changeProductPriceAgain"/>
114+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAgain"/>
115+
<!-- Step 10: Return to storefront and verify cached values -->
116+
<switchToPreviousTab stepKey="switchToStorefrontTabAgain"/>
117+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageAfterSecondAdminChange">
118+
<argument name="product" value="$createSimpleProduct$"/>
119+
</actionGroup>
120+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadProductPageAfterSecondAdminChange"/>
121+
<waitForPageLoad stepKey="waitForReloadAfterSecondChange"/>
122+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openMiniCartAfterSecondChange"/>
123+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple-X')}}" stepKey="verifyAppleProductInMiniCartAfterSecondChange"/>
124+
<waitForText userInput="$20.00" selector="{{StorefrontMinicartSection.productPriceByName('Apple-X')}}" stepKey="verifyCachedProductPriceAfterSecondChange"/>
125+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeMiniCartAfterSecondChange"/>
126+
<!-- Step 11: Wait for Customer Data Lifetime to expire (6 minutes) -->
127+
<wait time="120" stepKey="waitForCustomerDataLifetimeExpiration"/>
128+
<!-- Step 12: Reload page and verify updated values -->
129+
<reloadPage stepKey="reloadPageAfterWait"/>
130+
<waitForPageLoad stepKey="waitForPageReloadAfterWait"/>
131+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openMiniCartAfterWait"/>
132+
<waitForElementVisible selector="{{StorefrontMinicartSection.productLinkByName('Apple-X-Y')}}" stepKey="verifyAppleProductInMiniCartAfterWait"/>
133+
<waitForText userInput="$30.00" selector="{{StorefrontMinicartSection.productPriceByName('Apple-X-Y')}}" stepKey="verifyUpdatedProductPriceAfterWait"/>
134+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="closeCartSidebarFinal"/>
135+
</test>
136+
</tests>

0 commit comments

Comments
 (0)