Skip to content
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

[GoogleAdWords] Conversion ID client validation #26305

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,18 @@
<?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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCheckUseSystemValueActionGroup">
<arguments>
<argument name="rowId" type="string"/>
</arguments>

<checkOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="checkUseSystemValue"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,18 @@
<?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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminToggleEnabledActionGroup">
<arguments>
<argument name="element" type="string"/>
<argument name="state" type="string" defaultValue="Yes"/>
</arguments>
<selectOption selector="{{element}}" userInput="{{state}}" stepKey="switchActiveState"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,18 @@
<?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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminUncheckUseSystemValueActionGroup">
<arguments>
<argument name="rowId" type="string"/>
</arguments>

<uncheckOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="uncheckUseSystemValue"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,20 @@
<?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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminValidationErrorActionGroup">
<arguments>
<argument name="inputId" type="string"/>
<argument name="errorMessage" type="string" defaultValue="This is a required field."/>
</arguments>

<see selector="{{AdminConfigSection.errorElement(inputId)}}" userInput="{{errorMessage}}"
stepKey="seeElementValidationError"/>
</actionGroup>
</actionGroups>
Expand Up @@ -22,5 +22,6 @@
<element name="useSystemValue" type="checkbox" selector="#{{configRowId}} > .use-default > input" parameterized="true"/>
<element name="collapsibleSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config'][contains(.,'{{sectionTitle}}')]" parameterized="true" />
<element name="expandedSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config active'][contains(.,'{{sectionTitle}}')]" parameterized="true" />
<element name="errorElement" type="text" selector="#{{inputId}}-error" parameterized="true" />
</section>
</sections>
@@ -0,0 +1,15 @@
<?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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminNavigateToGoogleAdwordsConfigurationActionGroup">
<amOnPage url="{{AdminGoogleAdwordsConfigPage.url}}" stepKey="navigateToConfigurationPage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,14 @@
<?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="AdminGoogleAdwordsConfigPage" url="admin/system_config/edit/section/google/" area="admin"
module="Magento_Config">
<section name="AdminGoogleAdwordsConfigSection"/>
</page>
</pages>
@@ -0,0 +1,14 @@
<?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="AdminGoogleAdwordsConfigSection">
<element name="active" type="text" selector="#google_adwords_active"/>
<element name="conversionId" type="text" selector="#google_adwords_conversion_id"/>
</section>
</sections>
@@ -0,0 +1,41 @@
<?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="AdminValidateConversionIdConfigTest">
<annotations>
<stories value="Admin validates the conversion ID when configuring the Google Adwords"/>
<title value="Admin validates the conversion ID when configuring the Google Adwords"/>
<description value="Testing for a required Conversion ID when configuring the Google Adwords"/>
<severity value="MINOR"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logout"/>
</after>
<actionGroup ref="AdminNavigateToGoogleAdwordsConfigurationActionGroup" stepKey="goToConfigPage"/>
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandingGoogleAdwordsSection">
<argument name="sectionName" value="Google AdWords"/>
</actionGroup>
<actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValue">
<argument name="rowId" value="row_google_adwords_active"/>
</actionGroup>
<actionGroup ref="AdminToggleEnabledActionGroup" stepKey="enableGoogleAdwordsConfig">
<argument name="element" value="{{AdminGoogleAdwordsConfigSection.active}}"/>
</actionGroup>
<actionGroup ref="AdminClickFormActionButtonActionGroup" stepKey="clickSaveCustomVariable">
<argument name="buttonSelector" value="{{AdminMainActionsSection.save}}"/>
</actionGroup>
<actionGroup ref="AssertAdminValidationErrorActionGroup" stepKey="seeRequiredValidationErrorForConversionId">
<argument name="inputId" value="google_adwords_conversion_id"/>
</actionGroup>
</test>
</tests>
1 change: 1 addition & 0 deletions app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml
Expand Up @@ -17,6 +17,7 @@
<field id="conversion_id" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Conversion ID</label>
<backend_model>Magento\GoogleAdwords\Model\Config\Backend\ConversionId</backend_model>
<validate>required-entry validate-number</validate>
<depends>
<field id="*/*/active">1</field>
</depends>
Expand Down