Skip to content

Commit d27139a

Browse files
magento2-login-as-customer/issues/41: "Verify that 'Login as customer Log' record information about using 'Login as Customer' functionality properly" test added.
1 parent db39be7 commit d27139a

9 files changed

+236
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<!-- Assert Login As Customer Log record is correct -->
12+
<actionGroup name="AdminAssertLoginAsCustomerLogRecordActionGroup">
13+
<arguments>
14+
<argument name="rowNumber" type="string"/>
15+
<argument name="adminId" type="string"/>
16+
<argument name="customerId" type="string"/>
17+
</arguments>
18+
<seeInCurrentUrl url="{{AdminLoginAsCustomerLogPage.url}}" stepKey="checkUrl"/>
19+
<see selector="{{AdminLoginAsCustomerLogGridSection.adminIdInRow(rowNumber)}}" userInput="{{adminId}}" stepKey="seeCorrectAdminId"/>
20+
<see selector="{{AdminLoginAsCustomerLogGridSection.customerIdInRow(rowNumber)}}" userInput="{{customerId}}" stepKey="seeCorrectCustomerId"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<!-- Filter Login As Customer Log records -->
12+
<actionGroup name="AdminFilterLoginAsCustomerLogActionGroup">
13+
<arguments>
14+
<argument name="adminId" type="string"/>
15+
<argument name="customerId" type="string"/>
16+
</arguments>
17+
<seeInCurrentUrl url="{{AdminLoginAsCustomerLogPage.url}}" stepKey="checkUrl"/>
18+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.resetFilter}}" stepKey="resetFilters"/>
19+
<waitForLoadingMaskToDisappear stepKey="waitForResetFilter"/>
20+
<fillField selector="{{AdminLoginAsCustomerLogFiltersSection.adminId}}" userInput="{{adminId}}" stepKey="fillAdminId"/>
21+
<fillField selector="{{AdminLoginAsCustomerLogFiltersSection.customerId}}" userInput="{{customerId}}" stepKey="fillCustomerId"/>
22+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.search}}" stepKey="applyFilters"/>
23+
<waitForLoadingMaskToDisappear stepKey="waitForApplyFilter"/>
24+
</actionGroup>
25+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<!-- Navigate to Login As Customer Log page -->
12+
<actionGroup name="AdminOpenLoginAsCustomerLogActionGroup">
13+
<amOnPage url="{{AdminLoginAsCustomerLogPage.url}}" stepKey="gotoLoginAsCustomerLogPage"/>
14+
<waitForPageLoad stepKey="waitForPageLoad"/>
15+
<see userInput="Login As Customer Log" stepKey="titleIsVisible"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/LoginAsCustomer/Test/Mftf/ActionGroup/StorefrontSignOutAndCloseTabActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<!-- Customer sing out and close tab -->
11+
<!-- Customer sign out and close tab -->
1212
<actionGroup name="StorefrontSignOutAndCloseTabActionGroup">
1313
<click selector="{{StoreFrontSignOutSection.customerAccount}}" stepKey="clickCustomerButton"/>
1414
<click selector="{{StoreFrontSignOutSection.signOut}}" stepKey="clickToSignOut"/>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:/Page/etc/PageObject.xsd">
11-
<page name="AdminLoginAsCustomerLogPage" url="admin/loginascustomer/login/" area="admin" module="Magento_LoginAsCustomer"/>
11+
<page name="AdminLoginAsCustomerLogPage" url="loginascustomer/login/" area="admin" module="Magento_LoginAsCustomer">
12+
<section name="AdminLoginAsCustomerLogToolbarSection"/>
13+
<section name="AdminLoginAsCustomerLogFiltersSection"/>
14+
<section name="AdminLoginAsCustomerLogGridSection"/>
15+
</page>
1216
</pages>
Lines changed: 21 additions & 0 deletions
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminLoginAsCustomerLogFiltersSection">
12+
<element name="loginId" type="input" selector="//input[@id='subscriberGrid_filter_login_id']"/>
13+
<element name="customerId" type="input" selector="//input[@id='subscriberGrid_filter_customer_id']"/>
14+
<element name="customerEmail" type="input" selector="//input[@id='subscriberGrid_filter_email']"/>
15+
<element name="adminId" type="input" selector="//input[@id='subscriberGrid_filter_admin_id']"/>
16+
<element name="adminName" type="input" selector="//input[@id='subscriberGrid_filter_username']"/>
17+
<element name="from" type="input" selector="//input[@name='created_at[from]']"/>
18+
<element name="to" type="input" selector="//input[@name='created_at[to]']"/>
19+
</section>
20+
</sections>
21+
Lines changed: 20 additions & 0 deletions
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminLoginAsCustomerLogGridSection">
12+
<element name="loginIdInRow" type="text" selector="//table[@class='data-grid']/tbody/tr[{{row}}]/td[@data-column='login_id']" parameterized="true"/>
13+
<element name="customerIdInRow" type="text" selector="//table[@class='data-grid']/tbody/tr[{{row}}]/td[@data-column='customer_id']" parameterized="true"/>
14+
<element name="customerEmailInRow" type="text" selector="//table[@class='data-grid']/tbody/tr[{{row}}]/td[@data-column='email']" parameterized="true"/>
15+
<element name="adminIdInRow" type="text" selector="//table[@class='data-grid']/tbody/tr[{{row}}]/td[@data-column='admin_id']" parameterized="true"/>
16+
<element name="adminNameInRow" type="text" selector="//table[@class='data-grid']/tbody/tr[{{row}}]/td[@data-column='username']" parameterized="true"/>
17+
<element name="createdAtInRow" type="text" selector="//table[@class='data-grid']/tbody/tr[{{row}}]/td[@data-column='created_at']" parameterized="true"/>
18+
</section>
19+
</sections>
20+
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminLoginAsCustomerLogToolbarSection">
12+
<element name="search" type="button" selector="button[data-action='grid-filter-apply']"/>
13+
<element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']"/>
14+
</section>
15+
</sections>
16+
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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="AdminLoginAsCustomerLoggingTest">
12+
<annotations>
13+
<features value="Login As Customer"/>
14+
<!-- TODO: change "stories" value -->
15+
<stories value="Place order and reorder"/>
16+
<title value="Using 'Login As Customer' is logged properly"/>
17+
<description
18+
value="Verify that 'Login as customer Log' record information about using 'Login as Customer' functionality properly"/>
19+
<severity value="MAJOR"/>
20+
<group value="login_as_customer"/>
21+
</annotations>
22+
<before>
23+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1"
24+
stepKey="enableLoginAsCustomer"/>
25+
<magentoCLI command="cache:flush config" stepKey="flushCacheBeforeTestRun"/>
26+
<createData entity="NewAdminUser" stepKey="createNewAdmin"/>
27+
<createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/>
28+
<createData entity="Simple_US_CA_Customer" stepKey="createSecondCustomer"/>
29+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsDefaultUser"/>
30+
</before>
31+
<after>
32+
<deleteData createDataKey="createFirstCustomer" stepKey="deleteFirstCustomer"/>
33+
<deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/>
34+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToDeleteNewAdmin"/>
35+
<actionGroup ref="AdminDeleteUserViaCurlActionGroup" stepKey="deleteNewAdmin">
36+
<argument name="user" value="NewAdminUser"/>
37+
</actionGroup>
38+
<actionGroup ref="logout" stepKey="logoutAfter"/>
39+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0"
40+
stepKey="disableLoginAsCustomer"/>
41+
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestRun"/>
42+
</after>
43+
44+
<!-- Login into First Customer account -->
45+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerGirdPageActionGroup"
46+
stepKey="loginAsFirstCustomerByDefaultAdmin">
47+
<argument name="customerEmail" value="$$createFirstCustomer.email$$"/>
48+
</actionGroup>
49+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutFirstCustomerDefaultAdmin"/>
50+
51+
<!-- Login into Second Customer account -->
52+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerGirdPageActionGroup"
53+
stepKey="loginAsSecondCustomerByDefaultAdmin">
54+
<argument name="customerEmail" value="$$createSecondCustomer.email$$"/>
55+
</actionGroup>
56+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutSecondCustomerDefaultAdmin"/>
57+
58+
<!-- Log out as Default Admin User -->
59+
<actionGroup ref="logout" stepKey="logoutAsDefaultAdmin"/>
60+
61+
<!-- Login as New Admin User -->
62+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsNewUser">
63+
<argument name="username" value="$$createNewAdmin.username$$"/>
64+
<argument name="password" value="$$createNewAdmin.password$$"/>
65+
</actionGroup>
66+
67+
<!-- Login into First Customer account -->
68+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerGirdPageActionGroup"
69+
stepKey="loginAsFirstCustomerByNewAdmin">
70+
<argument name="customerEmail" value="$$createFirstCustomer.email$$"/>
71+
</actionGroup>
72+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutFirstCustomerNewAdmin"/>
73+
74+
<!-- Login into Second Customer account -->
75+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerGirdPageActionGroup"
76+
stepKey="loginAsSecondCustomerByNewAdmin">
77+
<argument name="customerEmail" value="$$createSecondCustomer.email$$"/>
78+
</actionGroup>
79+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutSecondCustomerNewAdmin"/>
80+
81+
<!-- Navigate to Login As Customer Log page -->
82+
<actionGroup ref="AdminOpenLoginAsCustomerLogActionGroup" stepKey="gotoLoginAsCustomerLog"/>
83+
84+
<!-- Perform assertions -->
85+
<actionGroup ref="AdminAssertLoginAsCustomerLogRecordActionGroup" stepKey="verifyDefaultAdminFirstCustomerLogRecord">
86+
<argument name="rowNumber" value="4"/>
87+
<argument name="adminId" value="1"/>
88+
<argument name="customerId" value="$$createFirstCustomer.id$$"/>
89+
</actionGroup>
90+
<actionGroup ref="AdminAssertLoginAsCustomerLogRecordActionGroup" stepKey="verifyDefaultAdminSecondCustomerLogRecord">
91+
<argument name="rowNumber" value="3"/>
92+
<argument name="adminId" value="1"/>
93+
<argument name="customerId" value="$$createSecondCustomer.id$$"/>
94+
</actionGroup>
95+
<actionGroup ref="AdminAssertLoginAsCustomerLogRecordActionGroup" stepKey="verifyNewAdminFirstCustomerLogRecord">
96+
<argument name="rowNumber" value="2"/>
97+
<argument name="adminId" value="$$createNewAdmin.id$$"/>
98+
<argument name="customerId" value="$$createFirstCustomer.id$$"/>
99+
</actionGroup>
100+
<actionGroup ref="AdminAssertLoginAsCustomerLogRecordActionGroup" stepKey="verifyNewAdminSecondCustomerLogRecord">
101+
<argument name="rowNumber" value="1"/>
102+
<argument name="adminId" value="$$createNewAdmin.id$$"/>
103+
<argument name="customerId" value="$$createSecondCustomer.id$$"/>
104+
</actionGroup>
105+
106+
<!-- Log out as New Admin User -->
107+
<actionGroup ref="logout" stepKey="logoutAsNewAdmin"/>
108+
</test>
109+
</tests>

0 commit comments

Comments
 (0)