Skip to content

Commit

Permalink
MAGETWO-91552: [github] CAPTCHA doesn't show when check out as guest
Browse files Browse the repository at this point in the history
- Add automated test
  • Loading branch information
lusinehak committed Aug 10, 2018
1 parent efdc2e3 commit 6ce4235
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="CaptchaFormsDisplayingActionGroup">
<click selector="{{CaptchaFormsDisplayingSection.store}}" stepKey="ClickToGoStores"/>
<waitForPageLoad stepKey="waitForStoresLoaded"/>
<click selector="{{CaptchaFormsDisplayingSection.config}}" stepKey="ClickToGoConfiguration"/>
<waitForPageLoad stepKey="waitForConfigurationsLoaded"/>
<scrollTo selector="{{CaptchaFormsDisplayingSection.customer}}" stepKey="ScrollToCustomers"/>
<click selector="{{CaptchaFormsDisplayingSection.customer}}" stepKey="ClickToCustomers"/>
<waitForPageLoad stepKey="waitForCustomerConfigurationsLoaded"/>
<click selector="{{CaptchaFormsDisplayingSection.customerConfig}}" stepKey="ClickToGoCustomerConfiguration"/>
<scrollTo selector="{{CaptchaFormsDisplayingSection.captcha}}" stepKey="scrollToCaptcha"/>
<conditionalClick selector="{{CaptchaFormsDisplayingSection.captcha}}" dependentSelector="{{CaptchaFormsDisplayingSection.dependent}}" visible="false" stepKey="ClickToOpenCaptcha"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
<entity name="CaptchaData">
<data key="createUser">Create user</data>
<data key="login">Login</data>
<data key="passwd">Forgot password</data>
<data key="contactUs">Contact Us</data>
<data key="changePasswd">Change password</data>
<data key="register">Register during Checkout</data>
<data key="checkoutAsGuest">Check Out as Guest</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="CaptchaFormsDisplayingSection">
<element name="store" type="button" selector="#menu-magento-backend-stores"/>
<element name="config" type="button" selector="//li[@data-ui-id='menu-magento-config-system-config']//span"/>
<element name="customer" type="button" selector="//div[@class='admin__page-nav-title title _collapsible']//strong[text()='Customers']"/>
<element name="customerConfig" type="text" selector="//span[text()='Customer Configuration']"/>
<element name="captcha" type="button" selector="#customer_captcha-head"/>
<element name="dependent" type="button" selector="//a[@id='customer_captcha-head' and @class='open']"/>
<element name="forms" type="multiselect" selector="#customer_captcha_forms"/>
<element name="createUser" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_create']"/>
<element name="forgotpassword" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_forgotpassword']"/>
<element name="userLogin" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_login']"/>
<element name="guestCheckout" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='guest_checkout']"/>
<element name="register" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='register_during_checkout']"/>
<element name="userEdit" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_edit']"/>
<element name="contactUs" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='contact_us']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<test name="CaptchaFormsDisplayingTest">
<annotations>
<features value="Captcha"/>
<stories value="MAGETWO-91552 - [github] CAPTCHA doesn't show when check out as guest"/>
<title value="Captcha forms displaying"/>
<description value="Captcha forms displaying"/>
<severity value="MAJOR"/>
<testCaseId value="MAGETWO-93941"/>
<group value="captcha"/>
</annotations>

<!--Login as admin-->
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<!--Go to Captcha-->
<actionGroup ref="CaptchaFormsDisplayingActionGroup" stepKey="CaptchaFormsDisplayingActionGroup"/>
<waitForPageLoad stepKey="WaitForPageLoaded"/>
<!--Verify fields removed-->
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.forms}}" stepKey="formItems"/>
<assertNotContains stepKey="checkoutAsGuest">
<expectedResult type="string">{{CaptchaData.checkoutAsGuest}}</expectedResult>
<actualResult type="variable">$formItems</actualResult>
</assertNotContains>
<assertNotContains stepKey="register">
<expectedResult type="string">{{CaptchaData.register}}</expectedResult>
<actualResult type="variable">$formItems</actualResult>
</assertNotContains>
<!--Verify fields existence-->
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.createUser}}" stepKey="createUser"/>
<assertEquals stepKey="CreateUserFieldIsPresent">
<expectedResult type="string">{{CaptchaData.createUser}}</expectedResult>
<actualResult type="variable">$createUser</actualResult>
</assertEquals>
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.userLogin}}" stepKey="login"/>
<assertEquals stepKey="LoginFieldIsPresent">
<expectedResult type="string">{{CaptchaData.login}}</expectedResult>
<actualResult type="variable">login</actualResult>
</assertEquals>
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.forgotpassword}}" stepKey="forgotpassword"/>
<assertEquals stepKey="PasswordFieldIsPresent">
<expectedResult type="string">{{CaptchaData.passwd}}</expectedResult>
<actualResult type="variable">$forgotpassword</actualResult>
</assertEquals>
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.contactUs}}" stepKey="contactUs"/>
<assertEquals stepKey="contactUsFieldIsPresent">
<expectedResult type="string">{{CaptchaData.contactUs}}</expectedResult>
<actualResult type="variable">$contactUs</actualResult>
</assertEquals>
<grabTextFrom selector="{{CaptchaFormsDisplayingSection.userEdit}}" stepKey="userEdit"/>
<assertEquals stepKey="userEditFieldIsPresent">
<expectedResult type="string">{{CaptchaData.changePasswd}}</expectedResult>
<actualResult type="variable">$userEdit</actualResult>
</assertEquals>

<!--Roll back configuration-->
<scrollToTopOfPage stepKey="ScrollToTop"/>
<click selector="{{CaptchaFormsDisplayingSection.captcha}}" stepKey="ClickToCloseCaptcha"/>

</test>
</tests>

0 comments on commit 6ce4235

Please sign in to comment.