Skip to content

Commit 296c346

Browse files
ENGCOM-6556: [GoogleAdWords] Conversion ID client validation #26305
- Merge Pull Request #26305 from eduard13/magento2:google-adwords-validation - Merged commits: 1. 62d8ba9 2. 941e511 3. 362b4de
2 parents 01ab2cd + 362b4de commit 296c346

10 files changed

+160
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCheckUseSystemValueActionGroup">
12+
<arguments>
13+
<argument name="rowId" type="string"/>
14+
</arguments>
15+
16+
<checkOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="checkUseSystemValue"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminToggleEnabledActionGroup">
12+
<arguments>
13+
<argument name="element" type="string"/>
14+
<argument name="state" type="string" defaultValue="Yes"/>
15+
</arguments>
16+
<selectOption selector="{{element}}" userInput="{{state}}" stepKey="switchActiveState"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminUncheckUseSystemValueActionGroup">
12+
<arguments>
13+
<argument name="rowId" type="string"/>
14+
</arguments>
15+
16+
<uncheckOption selector="{{AdminConfigSection.useSystemValue(rowId)}}" stepKey="uncheckUseSystemValue"/>
17+
</actionGroup>
18+
</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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminValidationErrorActionGroup">
12+
<arguments>
13+
<argument name="inputId" type="string"/>
14+
<argument name="errorMessage" type="string" defaultValue="This is a required field."/>
15+
</arguments>
16+
17+
<see selector="{{AdminConfigSection.errorElement(inputId)}}" userInput="{{errorMessage}}"
18+
stepKey="seeElementValidationError"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Config/Test/Mftf/Section/AdminConfigSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<element name="useSystemValue" type="checkbox" selector="#{{configRowId}} > .use-default > input" parameterized="true"/>
2323
<element name="collapsibleSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config'][contains(.,'{{sectionTitle}}')]" parameterized="true" />
2424
<element name="expandedSectionByTitle" type="text" selector="//form[@id='config-edit-form']//div[@class='section-config active'][contains(.,'{{sectionTitle}}')]" parameterized="true" />
25+
<element name="errorElement" type="text" selector="#{{inputId}}-error" parameterized="true" />
2526
</section>
2627
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminNavigateToGoogleAdwordsConfigurationActionGroup">
12+
<amOnPage url="{{AdminGoogleAdwordsConfigPage.url}}" stepKey="navigateToConfigurationPage"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
</actionGroup>
15+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
10+
<page name="AdminGoogleAdwordsConfigPage" url="admin/system_config/edit/section/google/" area="admin"
11+
module="Magento_Config">
12+
<section name="AdminGoogleAdwordsConfigSection"/>
13+
</page>
14+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="AdminGoogleAdwordsConfigSection">
11+
<element name="active" type="text" selector="#google_adwords_active"/>
12+
<element name="conversionId" type="text" selector="#google_adwords_conversion_id"/>
13+
</section>
14+
</sections>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminValidateConversionIdConfigTest">
12+
<annotations>
13+
<stories value="Admin validates the conversion ID when configuring the Google Adwords"/>
14+
<title value="Admin validates the conversion ID when configuring the Google Adwords"/>
15+
<description value="Testing for a required Conversion ID when configuring the Google Adwords"/>
16+
<severity value="MINOR"/>
17+
</annotations>
18+
<before>
19+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
20+
</before>
21+
<after>
22+
<actionGroup ref="logout" stepKey="logout"/>
23+
</after>
24+
<actionGroup ref="AdminNavigateToGoogleAdwordsConfigurationActionGroup" stepKey="goToConfigPage"/>
25+
<actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandingGoogleAdwordsSection">
26+
<argument name="sectionName" value="Google AdWords"/>
27+
</actionGroup>
28+
<actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValue">
29+
<argument name="rowId" value="row_google_adwords_active"/>
30+
</actionGroup>
31+
<actionGroup ref="AdminToggleEnabledActionGroup" stepKey="enableGoogleAdwordsConfig">
32+
<argument name="element" value="{{AdminGoogleAdwordsConfigSection.active}}"/>
33+
</actionGroup>
34+
<actionGroup ref="AdminClickFormActionButtonActionGroup" stepKey="clickSaveCustomVariable">
35+
<argument name="buttonSelector" value="{{AdminMainActionsSection.save}}"/>
36+
</actionGroup>
37+
<actionGroup ref="AssertAdminValidationErrorActionGroup" stepKey="seeRequiredValidationErrorForConversionId">
38+
<argument name="inputId" value="google_adwords_conversion_id"/>
39+
</actionGroup>
40+
</test>
41+
</tests>

app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<field id="conversion_id" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="1">
1818
<label>Conversion ID</label>
1919
<backend_model>Magento\GoogleAdwords\Model\Config\Backend\ConversionId</backend_model>
20+
<validate>required-entry validate-number</validate>
2021
<depends>
2122
<field id="*/*/active">1</field>
2223
</depends>

0 commit comments

Comments
 (0)