Skip to content

Commit 91e599c

Browse files
author
Alexander Akimov
authored
Merge pull request #3147 from magento-tsg/2.2-develop-pr43
[TSG] Backporting for 2.2 (pr43) (2.2.7)
2 parents 7474def + f251807 commit 91e599c

File tree

44 files changed

+708
-766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+708
-766
lines changed

app/code/Magento/Captcha/Observer/CheckGuestCheckoutObserver.php

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

app/code/Magento/Captcha/Observer/CheckRegisterCheckoutObserver.php

Lines changed: 0 additions & 82 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CaptchaFormsDisplayingActionGroup">
12+
<click selector="{{AdminCaptchaFormsDisplayingSection.store}}" stepKey="clickToGoStores"/>
13+
<waitForPageLoad stepKey="waitForStoresLoaded"/>
14+
<click selector="{{AdminCaptchaFormsDisplayingSection.config}}" stepKey="clickToGoConfiguration"/>
15+
<waitForPageLoad stepKey="waitForConfigurationsLoaded"/>
16+
<scrollTo selector="{{AdminCaptchaFormsDisplayingSection.customer}}" x="0" y="-100" stepKey="scrollToCustomers"/>
17+
<click selector="{{AdminCaptchaFormsDisplayingSection.customer}}" stepKey="clickToCustomers"/>
18+
<waitForPageLoad stepKey="waitForCustomerConfigurationsLoaded"/>
19+
<click selector="{{AdminCaptchaFormsDisplayingSection.customerConfig}}" stepKey="clickToGoCustomerConfiguration"/>
20+
<scrollTo selector="{{AdminCaptchaFormsDisplayingSection.captcha}}" stepKey="scrollToCaptcha"/>
21+
<conditionalClick selector="{{AdminCaptchaFormsDisplayingSection.captcha}}" dependentSelector="{{AdminCaptchaFormsDisplayingSection.dependent}}" visible="false" stepKey="clickToOpenCaptcha"/>
22+
</actionGroup>
23+
</actionGroups>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="CaptchaData" type="captcha">
12+
<data key="createUser">Create user</data>
13+
<data key="login">Login</data>
14+
<data key="passwd">Forgot password</data>
15+
<data key="contactUs">Contact Us</data>
16+
<data key="changePasswd">Change password</data>
17+
<data key="register">Register during Checkout</data>
18+
<data key="checkoutAsGuest">Check Out as Guest</data>
19+
</entity>
20+
</entities>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminCaptchaFormsDisplayingSection">
12+
<element name="store" type="button" selector="#menu-magento-backend-stores"/>
13+
<element name="config" type="button" selector="li[data-ui-id=menu-magento-config-system-config] span"/>
14+
<element name="customer" type="button" selector="//div[@class='admin__page-nav-title title _collapsible']//strong[text()='Customers']"/>
15+
<element name="customerConfig" type="text" selector="//span[text()='Customer Configuration']"/>
16+
<element name="captcha" type="button" selector="#customer_captcha-head"/>
17+
<element name="dependent" type="button" selector="#customer_captcha-head.open"/>
18+
<element name="forms" type="multiselect" selector="#customer_captcha_forms"/>
19+
<element name="createUser" type="multiselect" selector="select#customer_captcha_forms option[value='user_create']"/>
20+
<element name="forgotpassword" type="multiselect" selector="select#customer_captcha_forms option[value='user_forgotpassword']"/>
21+
<element name="userLogin" type="multiselect" selector="select#customer_captcha_forms option[value='user_login']"/>
22+
<element name="guestCheckout" type="multiselect" selector="select#customer_captcha_forms option[value='guest_checkout']"/>
23+
<element name="register" type="multiselect" selector="select#customer_captcha_forms option[value='register_during_checkout']"/>
24+
<element name="userEdit" type="multiselect" selector="select#customer_captcha_forms option[value='user_edit']"/>
25+
<element name="contactUs" type="multiselect" selector="select#customer_captcha_forms option[value='contact_us']"/>
26+
</section>
27+
</sections>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminCaptchaFormsDisplayingTest">
12+
<annotations>
13+
<features value="Captcha"/>
14+
<stories value="MAGETWO-86274 - [github] CAPTCHA doesn't show when check out as guest"/>
15+
<title value="Captcha forms displaying"/>
16+
<description value="Captcha forms displaying"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-94364"/>
19+
<group value="captcha"/>
20+
</annotations>
21+
22+
<!--Login as admin-->
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<!--Go to Captcha-->
25+
<actionGroup ref="CaptchaFormsDisplayingActionGroup" stepKey="captchaFormsDisplayingActionGroup"/>
26+
<waitForPageLoad time="30" stepKey="waitForPageLoaded"/>
27+
<!--Verify fields removed-->
28+
<grabTextFrom selector="{{AdminCaptchaFormsDisplayingSection.forms}}" stepKey="formItems"/>
29+
<assertNotContains stepKey="checkoutAsGuest">
30+
<expectedResult type="string">{{CaptchaData.checkoutAsGuest}}</expectedResult>
31+
<actualResult type="variable">$formItems</actualResult>
32+
</assertNotContains>
33+
<assertNotContains stepKey="register">
34+
<expectedResult type="string">{{CaptchaData.register}}</expectedResult>
35+
<actualResult type="variable">$formItems</actualResult>
36+
</assertNotContains>
37+
<!--Verify fields existence-->
38+
<grabTextFrom selector="{{AdminCaptchaFormsDisplayingSection.createUser}}" stepKey="createUser"/>
39+
<assertEquals stepKey="createUserFieldIsPresent">
40+
<expectedResult type="string">{{CaptchaData.createUser}}</expectedResult>
41+
<actualResult type="variable">$createUser</actualResult>
42+
</assertEquals>
43+
<grabTextFrom selector="{{AdminCaptchaFormsDisplayingSection.userLogin}}" stepKey="login"/>
44+
<assertEquals stepKey="loginFieldIsPresent">
45+
<expectedResult type="string">{{CaptchaData.login}}</expectedResult>
46+
<actualResult type="variable">login</actualResult>
47+
</assertEquals>
48+
<grabTextFrom selector="{{AdminCaptchaFormsDisplayingSection.forgotpassword}}" stepKey="forgotpassword"/>
49+
<assertEquals stepKey="passwordFieldIsPresent">
50+
<expectedResult type="string">{{CaptchaData.passwd}}</expectedResult>
51+
<actualResult type="variable">$forgotpassword</actualResult>
52+
</assertEquals>
53+
<grabTextFrom selector="{{AdminCaptchaFormsDisplayingSection.contactUs}}" stepKey="contactUs"/>
54+
<assertEquals stepKey="contactUsFieldIsPresent">
55+
<expectedResult type="string">{{CaptchaData.contactUs}}</expectedResult>
56+
<actualResult type="variable">$contactUs</actualResult>
57+
</assertEquals>
58+
<grabTextFrom selector="{{AdminCaptchaFormsDisplayingSection.userEdit}}" stepKey="userEdit"/>
59+
<assertEquals stepKey="userEditFieldIsPresent">
60+
<expectedResult type="string">{{CaptchaData.changePasswd}}</expectedResult>
61+
<actualResult type="variable">$userEdit</actualResult>
62+
</assertEquals>
63+
64+
<!--Roll back configuration-->
65+
<scrollToTopOfPage stepKey="scrollToTop"/>
66+
<click selector="{{AdminCaptchaFormsDisplayingSection.captcha}}" stepKey="clickToCloseCaptcha"/>
67+
</test>
68+
</tests>

app/code/Magento/Captcha/Test/Unit/Model/DefaultTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DefaultTest extends \PHPUnit\Framework\TestCase
2424
'enable' => '1',
2525
'font' => 'linlibertine',
2626
'mode' => 'after_fail',
27-
'forms' => 'user_forgotpassword,user_create,guest_checkout,register_during_checkout',
27+
'forms' => 'user_forgotpassword,user_create',
2828
'failed_attempts_login' => '3',
2929
'failed_attempts_ip' => '1000',
3030
'timeout' => '7',
@@ -35,8 +35,6 @@ class DefaultTest extends \PHPUnit\Framework\TestCase
3535
'always_for' => [
3636
'user_create',
3737
'user_forgotpassword',
38-
'guest_checkout',
39-
'register_during_checkout',
4038
'contact_us',
4139
],
4240
];
@@ -363,7 +361,6 @@ public function isShownToLoggedInUserDataProvider()
363361
[true, 'contact_us'],
364362
[false, 'user_create'],
365363
[false, 'user_forgotpassword'],
366-
[false, 'guest_checkout']
367364
];
368365
}
369366
}

0 commit comments

Comments
 (0)