Skip to content

Commit a8ed99a

Browse files
magento2-login-as-customer/issues/38: "Admin user directly login into customer account on frontend to Default store view when Store View To Login In = Auto detection" test added.
1 parent 9946235 commit a8ed99a

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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="AdminLoginAsCustomerAutoDetectionTest">
12+
<annotations>
13+
<features value="Login As Customer"/>
14+
<stories value="Select Store View based on 'Store View To Login In' setting"/>
15+
<title
16+
value="Admin user directly login into customer account with store View To Login In = Auto detection"/>
17+
<description
18+
value="Verify admin user can directly login into customer account to Default store view when Store View To Login In = Auto detection"/>
19+
<severity value="BLOCKER"/>
20+
<group value="login_as_customer"/>
21+
</annotations>
22+
<before>
23+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
24+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1"
25+
stepKey="enableLoginAsCustomer"/>
26+
<magentoCLI command="config:set {{LoginAsCustomerStoreViewLogin.path}} 0"
27+
stepKey="enableLoginAsCustomerAutoDetection"/>
28+
<magentoCLI
29+
command="config:set {{StorefrontEnableAddStoreCodeToUrls.path}} {{StorefrontEnableAddStoreCodeToUrls.value}}"
30+
stepKey="enableAddStoreCodeToUrls"/>
31+
<magentoCLI command="cache:flush config" stepKey="flushCacheBeforeTestRun"/>
32+
<actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/>
33+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView"/>
34+
</before>
35+
<after>
36+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
37+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteCustomStoreView">
38+
<argument name="customStore" value="customStore"/>
39+
</actionGroup>
40+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
41+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0"
42+
stepKey="disableLoginAsCustomer"/>
43+
<magentoCLI
44+
command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}"
45+
stepKey="disableAddStoreCodeToUrls"/>
46+
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestRun"/>
47+
</after>
48+
49+
<!-- Login As Customer from Customer page -->
50+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup"
51+
stepKey="loginAsCustomerFromCustomerPage">
52+
<argument name="customerId" value="$$createCustomer.id$$"/>
53+
</actionGroup>
54+
55+
<!-- Assert Customer logged on on default store view -->
56+
<actionGroup ref="StorefrontAssertLoginAsCustomerLoggedInActionGroup" stepKey="assertLoggedInFromCustomerGird">
57+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
58+
<argument name="customerEmail" value="$$createCustomer.email$$"/>
59+
</actionGroup>
60+
<actionGroup ref="StorefrontClickOnHeaderLogoActionGroup" stepKey="clickOnStorefrontHeaderLogo"/>
61+
<actionGroup ref="AssertStorefrontStoreCodeInUrlActionGroup" stepKey="seeDefaultStoreCodeInUrl"/>
62+
63+
<!-- Log out Customer and close tab -->
64+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutAndCloseTab"/>
65+
</test>
66+
</tests>

0 commit comments

Comments
 (0)