Skip to content

Commit 232eec2

Browse files
authored
Merge pull request #3085 from magento-epam/EPAM-PR-2
[epam] MAGETWO-66666: Adding a product to cart from category page with an expired session does not allow product to be added
2 parents 9d6399e + ec7d845 commit 232eec2

File tree

26 files changed

+436
-673
lines changed

26 files changed

+436
-673
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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="CaptchaFormsDisplayingActionGroup">
12+
<click selector="{{CaptchaFormsDisplayingSection.store}}" stepKey="ClickToGoStores"/>
13+
<waitForPageLoad stepKey="waitForStoresLoaded"/>
14+
<click selector="{{CaptchaFormsDisplayingSection.config}}" stepKey="ClickToGoConfiguration"/>
15+
<waitForPageLoad stepKey="waitForConfigurationsLoaded"/>
16+
<scrollTo selector="{{CaptchaFormsDisplayingSection.customer}}" stepKey="ScrollToCustomers"/>
17+
<click selector="{{CaptchaFormsDisplayingSection.customer}}" stepKey="ClickToCustomers"/>
18+
<waitForPageLoad stepKey="waitForCustomerConfigurationsLoaded"/>
19+
<click selector="{{CaptchaFormsDisplayingSection.customerConfig}}" stepKey="ClickToGoCustomerConfiguration"/>
20+
<scrollTo selector="{{CaptchaFormsDisplayingSection.captcha}}" stepKey="scrollToCaptcha"/>
21+
<conditionalClick selector="{{CaptchaFormsDisplayingSection.captcha}}" dependentSelector="{{CaptchaFormsDisplayingSection.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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="CaptchaData">
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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="CaptchaFormsDisplayingSection">
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="//a[@id='customer_captcha-head' and @class='open']"/>
18+
<element name="forms" type="multiselect" selector="#customer_captcha_forms"/>
19+
<element name="createUser" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_create']"/>
20+
<element name="forgotpassword" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_forgotpassword']"/>
21+
<element name="userLogin" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_login']"/>
22+
<element name="guestCheckout" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='guest_checkout']"/>
23+
<element name="register" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='register_during_checkout']"/>
24+
<element name="userEdit" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_edit']"/>
25+
<element name="contactUs" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='contact_us']"/>
26+
</section>
27+
</sections>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="CaptchaFormsDisplayingTest">
12+
<annotations>
13+
<features value="Captcha"/>
14+
<stories value="MAGETWO-91552 - [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-93941"/>
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 stepKey="WaitForPageLoaded"/>
27+
<!--Verify fields removed-->
28+
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.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="{{CaptchaFormsDisplayingSection.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="{{CaptchaFormsDisplayingSection.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="{{CaptchaFormsDisplayingSection.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="{{CaptchaFormsDisplayingSection.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="{{CaptchaFormsDisplayingSection.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="{{CaptchaFormsDisplayingSection.captcha}}" stepKey="ClickToCloseCaptcha"/>
67+
68+
</test>
69+
</tests>

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

Lines changed: 2 additions & 5 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
];
@@ -362,8 +360,7 @@ public function isShownToLoggedInUserDataProvider()
362360
return [
363361
[true, 'contact_us'],
364362
[false, 'user_create'],
365-
[false, 'user_forgotpassword'],
366-
[false, 'guest_checkout']
363+
[false, 'user_forgotpassword']
367364
];
368365
}
369366
}

0 commit comments

Comments
 (0)