Skip to content

Commit 76461b4

Browse files
committed
MC-35289: Billing Address does not change
1 parent 4c6636d commit 76461b4

14 files changed

+274
-6
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontSaveCustomerAddressActionGroup">
11+
<annotations>
12+
<description>Clicks on the Save Address button. Validates that the Success Message is present.</description>
13+
</annotations>
14+
15+
<click selector="{{StorefrontCustomerAddressFormSection.saveAddress}}" stepKey="clickSaveAddress"/>
16+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
17+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You saved the address." stepKey="assertSuccessMessage"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerAddressFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
<element name="useAsDefaultBillingAddressCheckBox" type="input" selector="//form[@class='form-address-edit']//input[@name='default_billing']"/>
2222
<element name="useAsDefaultShippingAddressCheckBox" type="input" selector="//form[@class='form-address-edit']//input[@name='default_shipping']"/>
2323
<element name="saveAddress" type="button" selector="//button[@title='Save Address']" timeout="30"/>
24+
<element name="formTitle" type="text" selector="//h1[@class='page-title']/span[text() = 'Edit Address']" timeout="30"/>
2425
</section>
2526
</sections>

app/code/Magento/Multishipping/Controller/Checkout/Address/EditAddress.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,34 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
8+
79
namespace Magento\Multishipping\Controller\Checkout\Address;
810

9-
class EditAddress extends \Magento\Multishipping\Controller\Checkout\Address
11+
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
12+
use Magento\Multishipping\Controller\Checkout\Address;
13+
14+
/**
15+
* Controller for editing the specified Address.
16+
*/
17+
class EditAddress extends Address implements HttpGetActionInterface
1018
{
1119
/**
20+
* Execute edit Billing Address action.
21+
*
1222
* @return void
1323
*/
1424
public function execute()
1525
{
1626
$this->_view->loadLayout();
1727
if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) {
28+
$id = $this->getRequest()->getParam('id');
1829
$addressForm->setTitle(
1930
__('Edit Address')
2031
)->setSuccessUrl(
21-
$this->_url->getUrl('*/*/selectBilling')
32+
$this->_url->getUrl('*/*/saveBillingFromList', ['id' => $id])
2233
)->setErrorUrl(
23-
$this->_url->getUrl('*/*/*', ['id' => $this->getRequest()->getParam('id')])
34+
$this->_url->getUrl('*/*/*', ['id' => $id])
2435
)->setBackUrl(
2536
$this->_url->getUrl('*/*/selectBilling')
2637
);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Multishipping\Controller\Checkout\Address;
9+
10+
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
11+
use Magento\Multishipping\Controller\Checkout\Address;
12+
13+
/**
14+
* Controller for Billing Address that was successfully saved.
15+
*/
16+
class SaveBillingFromList extends Address implements HttpGetActionInterface
17+
{
18+
/**
19+
* Reimport saved Address to Quote if it has same ID as current Billing Address.
20+
*
21+
* @return void
22+
*/
23+
public function execute(): void
24+
{
25+
if ($addressId = (int)$this->getRequest()->getParam('id')) {
26+
$checkout = $this->_getCheckout();
27+
if ((int)$checkout->getQuote()->getBillingAddress()->getCustomerAddressId() === $addressId) {
28+
$checkout->setQuoteCustomerBillingAddress($addressId);
29+
}
30+
}
31+
$this->_redirect('*/*/selectBilling');
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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="StorefrontAssertBillingAddressInBillingInfoStepActionGroup">
12+
<annotations>
13+
<description>Assert that Billing Address block contains provided Address data.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="address" type="entity" defaultValue="US_Address_CA"/>
17+
</arguments>
18+
19+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.firstname}}" stepKey="seeFirstname"/>
20+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.lastname}}" stepKey="seeLastname"/>
21+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.company}}" stepKey="seeCompany"/>
22+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.street[0]}}" stepKey="seeStreet"/>
23+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.city}}" stepKey="seeCity"/>
24+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.state}}" stepKey="seeState"/>
25+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.postcode}}" stepKey="seePostcode"/>
26+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.country}}" stepKey="seeCountry"/>
27+
<see selector="{{PaymentMethodSection.billingAddressBlock}}" userInput="{{address.telephone}}" stepKey="seeTelephone"/>
28+
</actionGroup>
29+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="StorefrontGoToBillingInfoStepFromAddressListActionGroup">
12+
<annotations>
13+
<description>Navigates to Billing Information step from Billing Address list.</description>
14+
</annotations>
15+
16+
<click selector="{{StorefrontBillingAddressesSection.backToBillingInformation}}" stepKey="navigateToBillingInformation"/>
17+
<waitForElementVisible selector="{{PaymentMethodSection.goToReviewOrder}}" stepKey="waitForGoToReviewButton"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="StorefrontOpenOrderByPositionAfterMultishippingCheckoutActionGroup">
12+
<annotations>
13+
<description>Clicks on 'order view' link by provided position from Multishipping Checkout success page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="position" type="string" defaultValue="{{CONST.one}}"/>
17+
</arguments>
18+
19+
<click selector="{{StorefrontMultipleShippingMethodSection.orderByPosition(position)}}" stepKey="openOrderDetailsPage"/>
20+
<waitForElementVisible selector="{{StorefrontCustomerOrderViewSection.orderTitle}}" stepKey="waitForOrderPageLoad"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="StorefrontStartEditBillingAddressFromListActionGroup">
12+
<annotations>
13+
<description>Navigates to Billing Address list. Starts editing specified Billing Address.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="position" type="string" defaultValue="{{CONST.one}}"/>
17+
</arguments>
18+
19+
<click selector="{{PaymentMethodSection.changeBillingAddress}}" stepKey="goToBillingAddressesList"/>
20+
<click selector="{{StorefrontBillingAddressesSection.editAddressByPosition(position)}}" stepKey="editBillingAddressByPosition"/>
21+
<waitForElementVisible selector="{{StorefrontCustomerAddressFormSection.formTitle}}" stepKey="waitForAddressEditPage"/>
22+
</actionGroup>
23+
</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+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="MultishippingCheckoutSelectBillingPage" url="/multishipping/checkout_address/selectBilling" module="Magento_Multishipping" area="storefront">
12+
<section name="StorefrontBillingAddressesSection"/>
13+
</page>
14+
</pages>

app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection/StorefrontMultipleShippingMethodSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1010
<section name="StorefrontMultipleShippingMethodSection">
1111
<element name="orderId" type="text" selector=".shipping-list:nth-child({{rowNum}}) .order-id" parameterized="true"/>
12+
<element name="orderByPosition" type="button" selector=".shipping-list:nth-child({{position}}) > .order-id > a" timeout="30" parameterized="true"/>
1213
<element name="goToReviewYourOrderButton" type="button" selector="#payment-continue"/>
1314
<element name="continueToBillingInformationButton" type="button" selector=".action.primary.continue"/>
1415
<element name="successMessage" type="text" selector=".multicheckout.success"/>

0 commit comments

Comments
 (0)