Skip to content

Commit c0a4ac2

Browse files
magento2-login-as-customer/issues/38: "Admin user prompted to select Store View when 'Store View To Login In' = Manual Choose" test added.
1 parent a8ed99a commit c0a4ac2

File tree

5 files changed

+139
-0
lines changed

5 files changed

+139
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<!-- Manually choose store view for LoginAsCustomer functionality -->
12+
<actionGroup name="AdminLoginAsCustomerChooseStoreViewActionGroup">
13+
<arguments>
14+
<argument name="storeViewName" type="string"/>
15+
</arguments>
16+
<selectOption selector="{{AdminLoginAsCustomerLoginManualContentSection.storeView}}" userInput="{{storeViewName}}" stepKey="selectStoreView"/>
17+
<click selector="{{AdminLoginAsCustomerLoginManualActionsSection.loginAsCustomer}}" stepKey="clickLoginAsCustomer"/>
18+
<waitForElementVisible selector="{{StorefrontHeaderSection.logoLink}}" stepKey="waitForPageLoad"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:/Page/etc/PageObject.xsd">
11+
<page name="AdminLoginAsCustomerLoginManualPage" url="loginascustomer/login/manual/entity_id/{{id}}/"
12+
area="storefront" module="Magento_LoginAsCustomer" parameterized="true">
13+
<section name="AdminLoginAsCustomerLoginManualActionsSection"/>
14+
<section name="AdminLoginAsCustomerLoginManualContentSection"/>
15+
</page>
16+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="AdminLoginAsCustomerLoginManualActionsSection">
12+
<element name="loginAsCustomer" type="button" selector="#save" timeout="30"/>
13+
</section>
14+
</sections>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="AdminLoginAsCustomerLoginManualContentSection">
12+
<element name="storeView" type="select" selector="//select[@name='store_id']" timeout="30"/>
13+
</section>
14+
</sections>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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="AdminLoginAsCustomerManualChooseTest">
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 = Manual Choose"/>
17+
<description
18+
value="Verify admin user can directly login into customer account to Custom store view when Store View To Login In = Manual Choose"/>
19+
<severity value="CRITICAL"/>
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}} 1"
27+
stepKey="enableLoginAsCustomerManualChoose"/>
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 command="config:set {{LoginAsCustomerStoreViewLogin.path}} 0"
44+
stepKey="enableLoginAsCustomerAutoDetection"/>
45+
<magentoCLI
46+
command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}"
47+
stepKey="disableAddStoreCodeToUrls"/>
48+
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestRun"/>
49+
</after>
50+
51+
<!-- Login As Customer from Customer page -->
52+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup"
53+
stepKey="loginAsCustomerFromCustomerPage">
54+
<argument name="customerId" value="$$createCustomer.id$$"/>
55+
</actionGroup>
56+
57+
<!-- Choose custom store view -->
58+
<actionGroup ref="AdminLoginAsCustomerChooseStoreViewActionGroup" stepKey="chooseCustomStoreView">
59+
<argument name="storeViewName" value="{{customStore.name}}"/>
60+
</actionGroup>
61+
62+
<!-- Assert Customer logged on on custom store view -->
63+
<actionGroup ref="StorefrontAssertLoginAsCustomerLoggedInActionGroup" stepKey="assertLoggedInFromCustomerGird">
64+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
65+
<argument name="customerEmail" value="$$createCustomer.email$$"/>
66+
</actionGroup>
67+
<actionGroup ref="StorefrontClickOnHeaderLogoActionGroup" stepKey="clickOnStorefrontHeaderLogo"/>
68+
<actionGroup ref="AssertStorefrontStoreCodeInUrlActionGroup" stepKey="seeCustomStoreCodeInUrl">
69+
<argument name="storeCode" value="{{customStore.code}}"/>
70+
</actionGroup>
71+
72+
<!-- Log out Customer and close tab -->
73+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutAndCloseTab"/>
74+
</test>
75+
</tests>

0 commit comments

Comments
 (0)