Skip to content

Commit b4f5784

Browse files
committed
MFTF has been added
1 parent eeb47dd commit b4f5784

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

app/code/Magento/LoginAsCustomer/Test/Mftf/Section/AdminLoginAsCustomerLogToolbarSection.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminLoginAsCustomerLogToolbarSection">
1212
<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']"/>
13+
<element name="filters" type="button" selector="button[data-action='grid-filter-expand']"/>
14+
<element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="15"/>
15+
<element name="DatePickerFrom" type="button" selector="[name='time[from]'] + button" timeout="15"/>
16+
<element name="DatePickerTo" type="button" selector="[name='time[to]'] + button" timeout="15"/>
17+
<element name="todayDate" type="button" selector=".ui-datepicker-today"/>
1418
</section>
1519
</sections>
1620

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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="AdminLoginAsCustomerLoggingFilterTest">
12+
<annotations>
13+
<features value="Login as Customer logs"/>
14+
<stories value="Filter by date login as customer logs"/>
15+
<title value="Filter by date login as customer logs"/>
16+
<description value="Filter by date should be from/to"/>
17+
<severity value="MAJOR"/>
18+
<group value="login_as_customer"/>
19+
<testCaseId value="MC-"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1"
23+
stepKey="enableLoginAsCustomer"/>
24+
<magentoCLI command="config:set {{LoginAsCustomerStoreViewLogin.path}} 0"
25+
stepKey="enableLoginAsCustomerAutoDetection"/>
26+
<magentoCLI command="cache:flush config" stepKey="flushCacheBeforeTestRun"/>
27+
<createData entity="Simple_US_Customer_Assistance_Allowed" stepKey="createFirstCustomer"/>
28+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsDefaultUser"/>
29+
</before>
30+
<after>
31+
<!--Clean filters -->
32+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.resetFilter}}" stepKey="CleanFiltersAfter"/>
33+
<!-- Log out as Default Admin User -->
34+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsDefaultAdmin"/>
35+
<!-- Remove created data-->
36+
<deleteData createDataKey="createFirstCustomer" stepKey="deleteFirstCustomer"/>
37+
<!-- Set config back-->
38+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0"
39+
stepKey="disableLoginAsCustomer"/>
40+
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestRun"/>
41+
</after>
42+
<!-- Login into First Customer account -->
43+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup"
44+
stepKey="loginAsFirstCustomerByDefaultAdmin">
45+
<argument name="customerId" value="$$createFirstCustomer.id$$"/>
46+
</actionGroup>
47+
<actionGroup ref="StorefrontSignOutAndCloseTabActionGroup" stepKey="signOutFirstCustomerDefaultAdmin"/>
48+
<!-- Navigate to Login as Customer Log page -->
49+
<actionGroup ref="AdminOpenLoginAsCustomerLogActionGroup" stepKey="gotoLoginAsCustomerLog"/>
50+
<!-- Setup date filters -->
51+
<conditionalClick selector="{{AdminLoginAsCustomerLogToolbarSection.resetFilter}}"
52+
dependentSelector="{{AdminLoginAsCustomerLogToolbarSection.resetFilter}}"
53+
visible="true" stepKey="CleanFiltersBefore"/>
54+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.filters}}" stepKey="clickFilters"/>
55+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.DatePickerFrom}}" stepKey="clickFromDate"/>
56+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.todayDate}}" stepKey="clickToToday"/>
57+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.DatePickerTo}}" stepKey="clickToDate"/>
58+
<click selector="{{AdminLoginAsCustomerLogToolbarSection.todayDate}}" stepKey="clickTodayDateAgain"/>
59+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
60+
<!-- Perform assertions -->
61+
<actionGroup ref="AdminAssertLoginAsCustomerLogRecordActionGroup" stepKey="verifyDefaultAdminFirstCustomerLogRecord">
62+
<argument name="rowNumber" value="1"/>
63+
<argument name="adminId" value="1"/>
64+
<argument name="customerId" value="$$createFirstCustomer.id$$"/>
65+
</actionGroup>
66+
</test>
67+
</tests>

0 commit comments

Comments
 (0)