Skip to content

Commit 7069f07

Browse files
MFTF tests updates.
1 parent af4f6ec commit 7069f07

8 files changed

+393
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroup name="AdminAssertLoginAsCustomerConfigVisibleActionGroup">
12+
<annotations>
13+
<description>Verify Login as Customer config section available.</description>
14+
</annotations>
15+
16+
<seeElement selector="{{AdminCustomerConfigSection.loginAsCustomerSettingsHead}}" stepKey="seeLoginAsCustomerSettingsHead"/>
17+
<seeElement selector="{{AdminCustomerConfigSection.enableExtensionLabel}}" stepKey="seeEnableExtensionLabel"/>
18+
<seeElement selector="{{AdminCustomerConfigSection.disablePageCacheLabel}}" stepKey="seeDisablePageCacheLabel"/>
19+
<seeElement selector="{{AdminCustomerConfigSection.storeViewToLoginToLabel}}" stepKey="seeStoreViewToLoginToLabel"/>
20+
</actionGroup>
21+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroup name="AdminAssertLoginAsCustomerSectionLinkNotAvailableActionGroup">
12+
<annotations>
13+
<description>Verify Login as Customer config section isn't available.</description>
14+
</annotations>
15+
16+
<conditionalClick selector="{{CaptchaFormsDisplayingSection.customer}}" dependentSelector="{{AdminCustomerConfigSection.loginAsCustomerSettingsSectionLink}}" visible="false" stepKey="expandCustomerGroup"/>
17+
<dontSeeElement selector="{{AdminCustomerConfigSection.loginAsCustomerSettingsSectionLink}}" stepKey="dontSeeLoginAsCustomerSettingsLink"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/LoginAsCustomer/Test/Mftf/Page/AdminCustomerConfigPage.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
-->
88
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
9-
<page name="AdminLoginAsCustomerConfigPage" url="admin/system_config/edit/section/mfloginascustomer" area="admin" module="Magento_LoginAsCustomer">
9+
<page name="AdminLoginAsCustomerConfigPage" url="admin/system_config/edit/section/login_as_customer" area="admin" module="Magento_LoginAsCustomer">
10+
<section name="AdminCustomerConfigSection"/>
1011
</page>
1112
</pages>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminCustomerConfigSection">
12+
<element name="loginAsCustomerSettingsSectionLink" type="text" selector="//a/span[contains(text(),'Login as Customer')]" timeout="30"/>
13+
<element name="loginAsCustomerSettingsHead" type="text" selector="#login_as_customer_general-head" timeout="30"/>
14+
<element name="enableExtensionLabel" type="text" selector="//span[contains(text(),'Enable Extension') and contains(@data-config-scope,'[GLOBAL]')]" timeout="30"/>
15+
<element name="disablePageCacheLabel" type="text" selector="//span[contains(text(),'Disable Page Cache For Admin User') and contains(@data-config-scope,'[GLOBAL]')]" timeout="30"/>
16+
<element name="storeViewToLoginToLabel" type="text" selector="//span[contains(text(),'Store View To Login To') and contains(@data-config-scope,'[GLOBAL]')]" timeout="30"/>
17+
</section>
18+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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="AdminLoginAsCustomerSettingsAvailableForGlobalLevelTest">
12+
<annotations>
13+
<features value="Login as Customer"/>
14+
<stories value="'Login as Customer' settings are available only for global level"/>
15+
<title value="Verify all 'Login as Customer' settings are available for global level"/>
16+
<description value="'Login as Customer' settings are available for global level"/>
17+
<severity value="MAJOR"/>
18+
<group value="login_as_customer"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
25+
</after>
26+
27+
<amOnPage url="{{AdminLoginAsCustomerConfigPage.url}}" stepKey="navigateToLoginAsCustomerConfigSection"/>
28+
<actionGroup ref="AdminAssertLoginAsCustomerConfigVisibleActionGroup" stepKey="seeLoginAsCustomerConfig"/>
29+
30+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchToDefaultStoreView">
31+
<argument name="storeViewName" value="'Default Store View'"/>
32+
</actionGroup>
33+
<actionGroup ref="AdminAssertLoginAsCustomerSectionLinkNotAvailableActionGroup" stepKey="dontSeeLoginAsCustomerSectionLinkOnStoreView"/>
34+
35+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchToDefaultWebsite">
36+
<argument name="storeViewName" value="'Main Website'"/>
37+
</actionGroup>
38+
<actionGroup ref="AdminAssertLoginAsCustomerSectionLinkNotAvailableActionGroup" stepKey="dontSeeLoginAsCustomerSectionLink"/>
39+
</test>
40+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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="StorefrontLoginAsCustomerBannerPresentOnAllPagesInSessionTest">
12+
<annotations>
13+
<features value="Login as Customer"/>
14+
<stories value="Notification banner appears on all pages in session"/>
15+
<title value="Verify banner is persistent and appears during all page views in session"/>
16+
<description value="Banner is persistent and appears on all pages in session"/>
17+
<severity value="CRITICAL"/>
18+
<group value="login_as_customer"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1"
22+
stepKey="enableLoginAsCustomer"/>
23+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushConfigCache">
24+
<argument name="tags" value="config"/>
25+
</actionGroup>
26+
<createData entity="_defaultCategory" stepKey="createCategory"/>
27+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
31+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
32+
</before>
33+
<after>
34+
<closeTab stepKey="closeLoginAsCustomerTab"/>
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
36+
37+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
38+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
39+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
40+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0"
41+
stepKey="disableLoginAsCustomer"/>
42+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushConfigCache">
43+
<argument name="tags" value="config"/>
44+
</actionGroup>
45+
</after>
46+
47+
<!-- Admin Login as Customer from Customer page and assert notification banner -->
48+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup" stepKey="loginAsCustomerFromCustomerPage">
49+
<argument name="customerId" value="$$createCustomer.id$$"/>
50+
</actionGroup>
51+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBanner">
52+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
53+
</actionGroup>
54+
55+
<!-- Go to Wishlist and assert notification banner -->
56+
<amOnPage url="{{StorefrontCustomerWishlistPage.url}}" stepKey="amOnWishListPage"/>
57+
<waitForPageLoad stepKey="waitForWishlistPageLoad"/>
58+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerOnWishList">
59+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
60+
</actionGroup>
61+
62+
<!-- Go to category page and assert notification banner -->
63+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage"/>
64+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerOnCategoryPage">
65+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
66+
</actionGroup>
67+
68+
<!-- Go to product page and assert notification banner -->
69+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
70+
<argument name="productUrlKey" value="$$createSimpleProduct.custom_attributes[url_key]$$"/>
71+
</actionGroup>
72+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerOnProductPage">
73+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
74+
</actionGroup>
75+
76+
<!-- Add product to cart and assert notification banner -->
77+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
78+
<argument name="product" value="$$createSimpleProduct$$"/>
79+
<argument name="productCount" value="1"/>
80+
</actionGroup>
81+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCartPage"/>
82+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerOnCartPage">
83+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
84+
</actionGroup>
85+
86+
<!-- Proceed to checkout and assert notification banner -->
87+
<click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/>
88+
<waitForPageLoad stepKey="waitForProceedToCheckout"/>
89+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerOnCheckoutPage">
90+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
91+
</actionGroup>
92+
93+
<!-- Assert notification banner before place order -->
94+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
95+
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
96+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
97+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
98+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerBeforePlaceOrder">
99+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
100+
</actionGroup>
101+
102+
<!-- Assert notification banner after place order -->
103+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
104+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="customerPlaceOrder">
105+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
106+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
107+
</actionGroup>
108+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBannerAfterPlaceOrder">
109+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
110+
</actionGroup>
111+
</test>
112+
</tests>
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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="StorefrontLoginAsCustomerSeeSpecialPriceOnCategoryTest">
12+
<annotations>
13+
<features value="Login as Customer"/>
14+
<stories value="'Login as Customer' should see special prices on a category page"/>
15+
<title value="Special prices shown on category when Admin user Login as customer account"/>
16+
<description value="Login as customer sees special prices on category"/>
17+
<severity value="CRITICAL"/>
18+
<group value="login_as_customer"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1"
22+
stepKey="enableLoginAsCustomer"/>
23+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushConfigCache">
24+
<argument name="tags" value="config"/>
25+
</actionGroup>
26+
<createData entity="_defaultCategory" stepKey="createCategory"/>
27+
<createData entity="SimpleProduct" stepKey="createProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
<field key="price">10</field>
30+
</createData>
31+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
32+
<field key="group_id">3</field>
33+
</createData>
34+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
35+
</before>
36+
<after>
37+
<amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/>
38+
<actionGroup stepKey="deletePriceRule" ref="deleteEntitySecondaryGrid">
39+
<argument name="name" value="{{_defaultCatalogRule.name}}"/>
40+
<argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/>
41+
</actionGroup>
42+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
43+
44+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
45+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
46+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
47+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0"
48+
stepKey="disableLoginAsCustomer"/>
49+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushConfigCache">
50+
<argument name="tags" value="config"/>
51+
</actionGroup>
52+
</after>
53+
54+
<!-- Creating a new catalog price rule with 50 percent discount for Retailer customer group -->
55+
<actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory">
56+
<argument name="categoryId" value="$createCategory.id$"/>
57+
</actionGroup>
58+
<actionGroup ref="SelectRetailerCustomerGroupActionGroup" stepKey="selectRetailerCustomerGroup"/>
59+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
60+
<argument name="apply" value="{{CatalogRuleToPercent.simple_action}}"/>
61+
<argument name="discountAmount" value="50"/>
62+
</actionGroup>
63+
64+
<!-- Save and apply the new catalog price rule -->
65+
<actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
66+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
67+
<argument name="indices" value=""/>
68+
</actionGroup>
69+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
70+
<argument name="tags" value=""/>
71+
</actionGroup>
72+
73+
<!-- Admin Login as Customer -->
74+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup" stepKey="loginAsCustomerFromCustomerPage">
75+
<argument name="customerId" value="$$createCustomer.id$$"/>
76+
</actionGroup>
77+
<actionGroup ref="StorefrontAssertLoginAsCustomerNotificationBannerActionGroup" stepKey="assertNotificationBanner">
78+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
79+
</actionGroup>
80+
81+
<!-- Check simple product prices on store front category page -->
82+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage"/>
83+
<actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="storefrontProduct1Price">
84+
<argument name="productInfo" value="$5.00"/>
85+
<argument name="productNumber" value="1"/>
86+
</actionGroup>
87+
<actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="storefrontProduct1RegularPrice">
88+
<argument name="productInfo" value="$10.00"/>
89+
<argument name="productNumber" value="1"/>
90+
</actionGroup>
91+
92+
<!-- Place order -->
93+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
94+
<argument name="productUrl" value="$$createProduct.sku$$"/>
95+
</actionGroup>
96+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
97+
<argument name="product" value="$$createProduct$$"/>
98+
<argument name="productCount" value="1"/>
99+
</actionGroup>
100+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openCart"/>
101+
<actionGroup ref="PlaceOrderWithLoggedUserActionGroup" stepKey="placeOrder"/>
102+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderId"/>
103+
<closeTab stepKey="closeLoginAsCustomerTab"/>
104+
105+
<!-- Open order in admin -->
106+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="addFilterToGridAndOpenOrder">
107+
<argument name="orderId" value="{$grabOrderId}"/>
108+
</actionGroup>
109+
110+
<!-- Assert order subtotal -->
111+
<scrollTo selector="{{AdminOrderTotalSection.subTotal}}" stepKey="scrollToOrderTotalSection"/>
112+
<see selector="{{AdminOrderTotalSection.subTotal}}" userInput="$5.00" stepKey="checkOrderTotalInBackend"/>
113+
</test>
114+
</tests>

0 commit comments

Comments
 (0)