Skip to content

System configuration Validation for Customer/Admin Token life time #29486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminConfigServicesOauthPage" url="admin/system_config/edit/section/oauth/" area="admin" module="Magento_Integration">
<section name="AdminConfigAccessTokenExpirationSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminConfigAccessTokenExpirationSection">
<element name="tabAccessTokenLifetime" type="select" selector="#oauth_access_token_lifetime-head"/>
<element name="CheckIfTabExpand" type="button" selector="#oauth_access_token_lifetime-head:not(.open)"/>
<element name="valueForTokenLifetime" type="input" selector="#oauth_access_token_lifetime_customer"/>
<element name="systemValueForTokenLifetime" type="checkbox" selector="#oauth_access_token_lifetime_customer_inherit"/>
<element name="valueForTokenLifetimeAdmin" type="input" selector="#oauth_access_token_lifetime_admin"/>
<element name="systemValueForTokenLifetimeAdmin" type="checkbox" selector="#oauth_access_token_lifetime_admin_inherit"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminConfigSaveEmptySettingsTest">
<annotations>
<features value="Configuration"/>
<stories value="Save settings 'Access Token Expiration'."/>
<title value="Save settings 'Access Token Expiration' with empty values."/>
<description value="Save settings 'Customer Token Lifetime' and 'Admin Token Lifetime' with empty values without validations."/>
<severity value="AVERAGE"/>
<testCaseId value="MC-37382"/>
<group value="configuration"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<amOnPage url="{{AdminConfigServicesOauthPage.url}}" stepKey="navigateToConfigurationPage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<conditionalClick selector="{{AdminConfigAccessTokenExpirationSection.tabAccessTokenLifetime}}" dependentSelector="{{AdminConfigAccessTokenExpirationSection.CheckIfTabExpand}}" visible="true" stepKey="expandTab"/>
<waitForAjaxLoad stepKey="waitForAjax"/>
<uncheckOption selector="{{AdminConfigAccessTokenExpirationSection.systemValueForTokenLifetime}}" stepKey="uncheckUseSystemValue"/>
<fillField selector="{{AdminConfigAccessTokenExpirationSection.valueForTokenLifetime}}" userInput="" stepKey="valueForTokenLifetime"/>
<uncheckOption selector="{{AdminConfigAccessTokenExpirationSection.systemValueForTokenLifetimeAdmin}}" stepKey="uncheckUseSystemValueAdmin"/>
<fillField selector="{{AdminConfigAccessTokenExpirationSection.valueForTokenLifetimeAdmin}}" userInput="" stepKey="valueForTokenLifetimeAdmin"/>
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
</test>
</tests>
4 changes: 2 additions & 2 deletions app/code/Magento/Integration/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<field id="customer" translate="label comment" type="text" sortOrder="30" showInDefault="1" canRestore="1">
<label>Customer Token Lifetime (hours)</label>
<comment>We will disable this feature if the value is empty.</comment>
<validate>required-entry validate-zero-or-greater validate-number</validate>
<validate>validate-zero-or-greater validate-number</validate>
</field>
<field id="admin" translate="label comment" type="text" sortOrder="60" showInDefault="1" canRestore="1">
<label>Admin Token Lifetime (hours)</label>
<comment>We will disable this feature if the value is empty.</comment>
<validate>required-entry validate-zero-or-greater validate-number</validate>
<validate>validate-zero-or-greater validate-number</validate>
</field>
</group>
<group id="cleanup" translate="label" type="text" sortOrder="300" showInDefault="1">
Expand Down