Skip to content

Commit 5b1889c

Browse files
committed
ACP2E-182: Error while validating Store VAT Number
1 parent d11c938 commit 5b1889c

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

app/code/Magento/Config/Test/Mftf/Test/CheckingVATNumberValidationButtonForEUCountryTest.xml renamed to app/code/Magento/Config/Test/Mftf/Test/AdminCheckVATNumberValidationButtonForEUCountryTest.xml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="CheckingVATNumberValidationButtonForEUCountryTest">
11+
<test name="AdminCheckVATNumberValidationButtonForEUCountryTest">
1212
<annotations>
1313
<title value="Validate VAT Number button for United Kingdom should work same as for non-EU countries after Brexit 2021"/>
1414
<description value="Validate VAT Number button for United Kingdom (GB) should work same as for non-EU countries after Brexit 2021"/>
@@ -32,11 +32,8 @@
3232
<!-- Expand the store information tab -->
3333
<conditionalClick selector="{{StoreConfigSection.StoreInformation}}" dependentSelector="{{StoreConfigSection.CheckIfTabExpand}}" visible="true" stepKey="checkIfTabOpen"/>
3434

35-
<!-- Verify that `Validate VAT Number` button is available and visible on the current page. -->
36-
<seeElement selector="{{StoreConfigSection.validateVATNumber}}" stepKey="seeVATNumberButton"/>
37-
38-
<!-- Verify that the `Validate VAT Number` button contains class `disabled` for non-EU Country or none-->
39-
<seeElement selector="{{StoreConfigSection.validateVATNumber}}" selectorArray="['class' => 'disabled']" stepKey="validateVatNumberButtonShouldBeDisabledInitially"/>
35+
<!-- Verify that `Validate VAT Number` button is not visible when no Country selected-->
36+
<dontSeeElement selector="{{StoreConfigSection.validateVATNumber}}" stepKey="dontSeeVATNumberButton"/>
4037

4138
<!--Open country options section and select an EU Country (`Germany`) -->
4239
<selectOption userInput="{{DE_Address_Berlin_Not_Default_Address.country}}" selector="{{StoreConfigSection.Country}}" stepKey="selectEUStoreCountry"/>
@@ -45,8 +42,8 @@
4542
<!--Fill valid VAT Number for the selected EU Country (Germany)-->
4643
<fillField selector="{{StoreConfigSection.fillVATNumber}}" userInput="{{DE_Address_Berlin_Not_Default_Address.vatNumber}}" stepKey="fillValidVatNumberForEuCountry"/>
4744

48-
<!-- Verify that the `Validate VAT Number` button should not contain class `disabled` for EU Country-->
49-
<dontSeeElement selector="{{StoreConfigSection.validateVATNumber}}" parameterArray="['class' => 'disabled']" stepKey="validateVatNumberButtonEnabledForEuCountry"/>
45+
<!-- Verify that the `Validate VAT Number` button is visible for EU Country-->
46+
<seeElement selector="{{StoreConfigSection.validateVATNumber}}" stepKey="validateVatNumberButtonEnabledForEuCountry"/>
5047

5148
<!-- Click the `Validate VAT Number` button. -->
5249
<click selector="{{StoreConfigSection.validateVATNumber}}" stepKey="clickValidateVatNumberButton"/>
@@ -59,7 +56,7 @@
5956
<waitForAjaxLoad stepKey="waitForAjaxToLoadRegionForNonEuCountry"/>
6057
<fillField selector="{{StoreConfigSection.fillVATNumber}}" userInput="{{UK_With_State_Default_Billing.vatNumber}}" stepKey="fillVATNumberForNonEU"/>
6158

62-
<!-- Verify that the `Validate VAT Number` button contains class `disabled` for non-EU Country-->
63-
<seeElement selector="{{StoreConfigSection.validateVATNumber}}" selectorArray="['class' => 'disabled']" stepKey="validateVatNumberButtonDisabledAgain"/>
59+
<!-- Verify that the `Validate VAT Number` button disappears for selection of non-EU Country-->
60+
<dontSeeElement selector="{{StoreConfigSection.validateVATNumber}}" stepKey="validateVatNumberButtonDisabledAgain"/>
6461
</test>
6562
</tests>

app/code/Magento/Config/view/adminhtml/templates/system/config/js.phtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ $scriptString .= <<<script
111111
{
112112
var countryElement = element;
113113
if (countryElement && countryElement.id) {
114-
this.refreshVatNumberField(countryElement);
115114
this.refreshValidateVatNumberButton(countryElement);
116115
}
117116
},
@@ -139,7 +138,7 @@ $scriptString .= <<<script
139138
{
140139
var resultElement = document.getElementById("validation_result");
141140
if (this.euCountryList.includes(countryCode)) {
142-
this.btnVatNumberElement.classList.remove('disabled');
141+
this.btnVatNumberElement.style.display = "block";
143142
if (resultElement) {
144143
resultElement.style.display = "block";
145144
resultElement.innerHTML = '';
@@ -148,7 +147,7 @@ $scriptString .= <<<script
148147
}
149148
}
150149
} else {
151-
this.btnVatNumberElement.classList.add('disabled');
150+
this.btnVatNumberElement.style.display = "none";
152151
if (resultElement) {
153152
resultElement.style.display = "none";
154153
}

app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ script;
6060

6161
<div class="actions actions-validate-vat">
6262
<p class="admin__field-error hidden" id="validation_result"></p>
63-
<button class="action-validate-vat disabled" type="button" id="<?= /* @noEscape */ $block->getHtmlId() ?>">
63+
<button class="action-validate-vat" type="button" id="<?= /* @noEscape */ $block->getHtmlId() ?>" style="display:none">
6464
<span><?= $block->escapeHtml($block->getButtonLabel()) ?></span>
6565
</button>
6666
</div>

0 commit comments

Comments
 (0)