Skip to content

Commit 031ce1b

Browse files
Refactoring
1 parent c181cac commit 031ce1b

File tree

8 files changed

+114
-105
lines changed

8 files changed

+114
-105
lines changed
Lines changed: 19 additions & 0 deletions
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="AssertAdminNotSuccessLoginActionGroup">
12+
<arguments>
13+
<argument name="message" type="string" defaultValue="The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later"/>
14+
</arguments>
15+
<waitForPageLoad stepKey="waitForPageReload"/>
16+
<see selector="{{AdminLoginFormSection.error}}" userInput="{{message}}"
17+
stepKey="seeLoginAdminError"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Page/AdminNewRolePage.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/code/Magento/Security/Test/Mftf/ActionGroup/AdminNewRoleInvalidCurrentUserPasswordActionGroup.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/code/Magento/Security/Test/Mftf/Data/AdminRoleData.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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="AdminLockAdminUserWhenCreatingNewRoleTest">
12+
<annotations>
13+
<features value="Security"/>
14+
<stories value="Runs Lock admin user when creating new admin role test."/>
15+
<title value="Lock admin user when creating new admin role"/>
16+
<description value="Runs Lock admin user when creating new admin role test."/>
17+
<severity value="MAJOR"/>
18+
<group value="security"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
<before>
22+
<!-- Log in to Admin Panel -->
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<!-- Unlock Admin user -->
27+
<magentoCLI command="admin:user:unlock {{_ENV.MAGENTO_ADMIN_USERNAME}}" stepKey="unlockAdminUser"/>
28+
</after>
29+
<!-- Perform add new role 6 specified number of times. -->
30+
<actionGroup ref="AdminCreateRoleRequiredFieldsActionGroup" stepKey="failedSaveRoleFirstAttempt">
31+
<argument name="currentAdminPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}INVALID" />
32+
<argument name="messageSelector" value="{{AdminMessagesSection.error}}" />
33+
<argument name="message" value="The password entered for the current user is invalid. Verify the password and try again." />
34+
</actionGroup>
35+
<actionGroup ref="AdminCreateRoleRequiredFieldsActionGroup" stepKey="failedSaveRoleSecondAttempt">
36+
<argument name="currentAdminPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}INVALID" />
37+
<argument name="messageSelector" value="{{AdminMessagesSection.error}}" />
38+
<argument name="message" value="The password entered for the current user is invalid. Verify the password and try again." />
39+
</actionGroup>
40+
<actionGroup ref="AdminCreateRoleRequiredFieldsActionGroup" stepKey="failedSaveRoleThirdAttempt">
41+
<argument name="currentAdminPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}INVALID" />
42+
<argument name="messageSelector" value="{{AdminMessagesSection.error}}" />
43+
<argument name="message" value="The password entered for the current user is invalid. Verify the password and try again." />
44+
</actionGroup>
45+
<actionGroup ref="AdminCreateRoleRequiredFieldsActionGroup" stepKey="failedSaveRoleFourthAttempt">
46+
<argument name="currentAdminPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}INVALID" />
47+
<argument name="messageSelector" value="{{AdminMessagesSection.error}}" />
48+
<argument name="message" value="The password entered for the current user is invalid. Verify the password and try again." />
49+
</actionGroup>
50+
<actionGroup ref="AdminCreateRoleRequiredFieldsActionGroup" stepKey="failedSaveRoleFifthAttempt">
51+
<argument name="currentAdminPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}INVALID" />
52+
<argument name="messageSelector" value="{{AdminMessagesSection.error}}" />
53+
<argument name="message" value="The password entered for the current user is invalid. Verify the password and try again." />
54+
</actionGroup>
55+
<actionGroup ref="AdminCreateRoleRequiredFieldsActionGroup" stepKey="failedSaveRoleSixthAttempt">
56+
<argument name="currentAdminPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}INVALID" />
57+
<argument name="messageSelector" value="{{AdminLoginFormSection.error}}" />
58+
<argument name="message" value="Your account is temporarily disabled. Please try again later." />
59+
</actionGroup>
60+
<!-- Try to login as admin and check error -->
61+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsLockedAdmin"/>
62+
<actionGroup ref="AssertAdminNotSuccessLoginActionGroup" stepKey="checkLoginError"/>
63+
</test>
64+
</tests>

app/code/Magento/Security/Test/Mftf/Test/LockAdminUserWhenCreatingNewRoleTest.xml

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCreateRoleRequiredFieldsActionGroup">
11+
<arguments>
12+
<argument name="roleName" type="string" defaultValue="{{adminRole.name}}"/>
13+
<argument name="currentAdminPassword" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/>
14+
<argument name="message" type="string" defaultValue="You saved the role." />
15+
<argument name="messageSelector" type="string" defaultValue="{{AdminMessagesSection.success}}" />
16+
</arguments>
17+
18+
<!-- Open Admin New Role Page -->
19+
<amOnPage url="{{AdminEditRolePage.url}}" stepKey="amOnNewAdminRolePage"/>
20+
<waitForPageLoad stepKey="waitForNewAdminRolePageLoad"/>
21+
22+
<!-- Fill required fields -->
23+
<fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{roleName}}" stepKey="fillRoleName"/>
24+
<fillField selector="{{AdminCreateRoleSection.password}}" userInput="{{currentAdminPassword}}" stepKey="fillCurrentUserPassword"/>
25+
<click selector="{{AdminCreateRoleSection.save}}" stepKey="saveNewRole"/>
26+
<waitForPageLoad stepKey="waitForSaveResultLoad"/>
27+
28+
<see userInput="{{message}}" selector="{{messageSelector}}" stepKey="verifyMessage" />
29+
</actionGroup>
30+
</actionGroups>

dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Security\Test\TestCase\LockAdminUserWhenCreatingNewRoleTest" summary="Lock admin user after entering incorrect password while creating new role">
1010
<variation name="LockAdminUserWhenCreatingNewRoleTestVariation1">
11-
<data name="tag" xsi:type="string">severity:S2</data>
11+
<data name="tag" xsi:type="string">severity:S2, mftf_migrated:yes</data>
1212
<data name="configData" xsi:type="string">user_lockout_failures</data>
1313
<data name="customAdmin/dataset" xsi:type="string">custom_admin_with_default_role</data>
1414
<data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data>

0 commit comments

Comments
 (0)