Skip to content

Adding the company and VAT Number values at OPC address. #31425

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

Closed
Closed
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
Expand Up @@ -46,5 +46,6 @@
<element name="textFieldAttrRequireMessage" type="text" selector="//input[@name='custom_attributes[{{attribute}}]']/ancestor::div[contains(@class, 'control')]/div/span" parameterized="true" timeout="30"/>
<element name="textFieldAttribute" type="input" selector="[name*='custom_attributes[{{attribute}}]']" parameterized="true" timeout="30"/>
<element name="shippingAddressRequiredField" type="text" selector="//div[@id='shipping-new-address-form']//div[contains(@class, 'field _required') and contains(@name, 'shippingAddress.{{fieldName}}')]" parameterized="true" timeout="30"/>
<element name="selectedShippingAddressData" type="text" selector=".shipping-address-item.selected-item"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
<text args="currentBillingAddress().prefix"></text> <text args="currentBillingAddress().firstname"></text>
<text args="currentBillingAddress().middlename"></text>
<text args="currentBillingAddress().lastname"></text> <text args="currentBillingAddress().suffix"></text><br/>
<if args="currentBillingAddress().company">
<text args="currentBillingAddress().company"/><br/>
</if>
<text args="currentBillingAddress().street.join(', ')"></text><br/>
<text args="currentBillingAddress().city "></text>, <span text="currentBillingAddress().region"></span>
<text args="currentBillingAddress().postcode"></text><br/>
<if args="currentBillingAddress().vatId">
<text args="currentBillingAddress().vatId"/><br/>
</if>
<text args="getCountryName(currentBillingAddress().countryId)"></text><br/>
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone" text="currentBillingAddress().telephone"></a><br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<div class="shipping-address-item" css="'selected-item' : isSelected() , 'not-selected-item':!isSelected()">
<text args="address().prefix"></text> <text args="address().firstname"></text> <text args="address().middlename"></text>
<text args="address().lastname"></text> <text args="address().suffix"></text><br/>
<if args="address().company">
<text args="address().company"/><br/>
</if>
<text args="_.values(address().street).join(', ')"></text><br/>
<text args="address().city "></text>, <span text="address().region"></span> <text args="address().postcode"></text><br/>
<if args="address().vatId">
<text args="address().vatId"/><br/>
</if>
<text args="getCountryName(address().countryId)"></text><br/>
<a if="address().telephone" attr="'href': 'tel:' + address().telephone" text="address().telephone"></a><br/>

<each args="data: address().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"></text>
<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
<if args="visible()">
<text args="address().prefix"></text> <text args="address().firstname"></text> <text args="address().middlename"></text>
<text args="address().lastname"></text> <text args="address().suffix"></text><br/>
<if args="address().company">
<text args="address().company"/><br/>
</if>
<text args="_.values(address().street).join(', ')"></text><br/>
<text args="address().city "></text>, <span text="address().region"></span> <text args="address().postcode"></text><br/>
<if args="address().vatId">
<text args="address().vatId"/><br/>
</if>
<text args="getCountryName(address().countryId)"></text><br/>
<a if="address().telephone" attr="'href': 'tel:' + address().telephone" text="address().telephone"></a><br/>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?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="StorefrontCompanyAndVatIdDataAtCheckoutTest">
<annotations>
<features value="Customer"/>
<stories value="Check if Company name and VAT Id visible at the checkout"/>
<title value="Check if Company name and VAT Id visible at the checkout"/>
<description value="Company name and VAT Id should be visible at the checkout step in address if it switched on at configuration"/>
<severity value="MAJOR"/>
<testCaseId value="MC-40437"/>
<group value="customer"/>
<group value="create"/>
</annotations>
<before>
<magentoCLI command="config:set customer/address/taxvat_show opt" stepKey="setShowTaxNumber"/>
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
<createData entity="SimpleSubCategory" stepKey="createCategory" />
<createData entity="SimpleProduct" stepKey="createProduct" >
<requiredEntity createDataKey="createCategory"/>
</createData>
</before>
<after>
<magentoCLI command="config:set customer/address/taxvat_show 0" stepKey="setShowTaxNumberBack"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<deleteData stepKey="deleteCategory" createDataKey="createCategory"/>
<deleteData stepKey="deleteProduct" createDataKey="createProduct"/>
</after>
<!--Login customer on storefront-->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
<argument name="Customer" value="$$createCustomer$$" />
</actionGroup>
<!-- Add product to the cart -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToProductPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart">
<argument name="productName" value="$$createProduct.name$$"/>
</actionGroup>
<!--Go to Checkout-->
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingCheckoutPageWithShippingMethod"/>
<!--Check Company and Vat Id data at checkout shipping-->
<executeJS function="return document.querySelectorAll('{{CheckoutShippingSection.selectedShippingAddressData}}')[0].innerText;" stepKey="grabShipping"/>
<assertStringContainsString stepKey="checkCompanyAtShipping">
<expectedResult type="string">{{CustomerAddressSimple.company}}</expectedResult>
<actualResult type="variable">grabShipping</actualResult>
</assertStringContainsString>
<assertStringContainsString stepKey="checkVatIdAtShipping">
<expectedResult type="string">{{CustomerAddressSimple.vat_id}}</expectedResult>
<actualResult type="variable">grabShipping</actualResult>
</assertStringContainsString>
<!--Move to 'Review & Payments'-->
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
<!--Check Company and Vat Id data at checkout 'Review & Payments'-->
<executeJS function="return document.querySelectorAll('{{CheckoutPaymentWithDisplayBillingAddressOnPaymentPageSection.billingAddressDetails}}')[0].innerText;" stepKey="grabPaymentMethodInfo"/>
<assertStringContainsString stepKey="checkCompanyAtPaymentMethodInfo">
<expectedResult type="string">{{CustomerAddressSimple.company}}</expectedResult>
<actualResult type="variable">grabPaymentMethodInfo</actualResult>
</assertStringContainsString>
<assertStringContainsString stepKey="checkVatIdAtPaymentMethodInfo">
<expectedResult type="string">{{CustomerAddressSimple.vat_id}}</expectedResult>
<actualResult type="variable">grabPaymentMethodInfo</actualResult>
</assertStringContainsString>
<executeJS function="return document.querySelectorAll('{{CheckoutPaymentSection.shippingInformationSection}}')[0].innerText;" stepKey="grabPaymentShippingTo"/>
<assertStringContainsString stepKey="checkCompanyAtShippingTo">
<expectedResult type="string">{{CustomerAddressSimple.company}}</expectedResult>
<actualResult type="variable">grabPaymentShippingTo</actualResult>
</assertStringContainsString>
<assertStringContainsString stepKey="checkVatIdAtShippingTo">
<expectedResult type="string">{{CustomerAddressSimple.vat_id}}</expectedResult>
<actualResult type="variable">grabPaymentShippingTo</actualResult>
</assertStringContainsString>
</test>
</tests>