Skip to content

Commit c05dcab

Browse files
committed
Merge remote-tracking branch 'magento-mpi/MC-19303' into Chaika-PR-2019-10-03
# Conflicts: # app/code/Magento/Multishipping/Test/Mftf/ActionGroup/CheckingWithMultipleAddressesActionGroup.xml # app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectShippingInfoActionGroup.xml
2 parents 5f1a803 + 0557101 commit c05dcab

13 files changed

+199
-14
lines changed

app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,19 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
691691
$this->quoteAddressToOrder->convert($address)
692692
);
693693

694+
$shippingMethodCode = $address->getShippingMethod();
695+
if (isset($shippingMethodCode) && !empty($shippingMethodCode)) {
696+
$rate = $address->getShippingRateByCode($shippingMethodCode);
697+
$shippingPrice = $rate->getPrice();
698+
} else {
699+
$shippingPrice = $order->getShippingAmount();
700+
}
701+
$store = $order->getStore();
702+
$amountPrice = $store->getBaseCurrency()
703+
->convert($shippingPrice, $store->getCurrentCurrencyCode());
704+
$order->setBaseShippingAmount($shippingPrice);
705+
$order->setShippingAmount($amountPrice);
706+
694707
$order->setQuote($quote);
695708
$order->setBillingAddress($this->quoteAddressToOrderAddress->convert($quote->getBillingAddress()));
696709

Lines changed: 29 additions & 0 deletions
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<actionGroup name="AdminSalesOrderActionGroup">
11+
<waitForPageLoad stepKey="waitForAdminSalesPageToLoad"/>
12+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRowLink"/>
13+
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
14+
<waitForPageLoad stepKey="waitForCheckTotalActionGroup"/>
15+
<scrollTo selector="{{AdminOrderTotalSection.subTotal}}" stepKey="scrollToOrderTotalSection"/>
16+
<grabTextFrom selector="{{AdminOrderTotalSection.subTotal}}" stepKey="grabvalueForSubtotal"/>
17+
<grabTextFrom selector="{{AdminOrderTotalSection.shippingAndHandling}}" stepKey="grabvalueForShippingHandling"/>
18+
<grabTextFrom selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="grabvalueForGrandTotal"/>
19+
<executeJS stepKey="sum_TotalValue" function="
20+
var subtotal = '{$grabvalueForSubtotal}'.substr(1);
21+
var handling = '{$grabvalueForShippingHandling}'.substr(1);
22+
var subtotal_handling = (parseFloat(subtotal) + parseFloat(handling)).toFixed(2);
23+
return ('$' + subtotal_handling);"/>
24+
<assertEquals stepKey="assertSubTotalPrice">
25+
<expectedResult type="string">$sum_TotalValue</expectedResult>
26+
<actualResult type="string">$grabvalueForGrandTotal</actualResult>
27+
</assertEquals>
28+
</actionGroup>
29+
</actionGroups>

app/code/Magento/Multishipping/Test/Mftf/ActionGroup/PlaceOrderActionGroup.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/>
1717

1818
</actionGroup>
19-
</actionGroups>
20-
19+
</actionGroups>

app/code/Magento/Multishipping/Test/Mftf/ActionGroup/ReviewOrderActionGroup.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@
3535
</assertEquals>
3636

3737
</actionGroup>
38-
</actionGroups>
39-
38+
</actionGroups>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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/testSchema.xsd">
11+
<actionGroup name="SalesOrderForMultiShipmentActionGroup">
12+
<arguments>
13+
<argument name="shippingPrice" defaultValue="$5.00" type="string" />
14+
<argument name="subtotalPrice" defaultValue="$123.00" type="string" />
15+
<argument name="totalPrice" defaultValue="$128.00" type="string" />
16+
</arguments>
17+
<waitForPageLoad stepKey="waitForSalesOrderHistoryPageToLoad" />
18+
<!--Click on View Order Link-->
19+
<click stepKey="viewOrderAction" selector="{{SalesOrderSection.viewOrderLink}}"/>
20+
<waitForPageLoad stepKey="waitForViewOrderPageToLoad" />
21+
<!--Check Shipping Method, Subtotal and Total Price-->
22+
<grabTextFrom selector="{{SalesOrderSection.salesOrderPrice('subtotal')}}" stepKey="salesOrderSubtotalPrice"/>
23+
<grabTextFrom selector="{{SalesOrderSection.salesOrderPrice('shipping')}}" stepKey="salesOrderShippingPrice"/>
24+
<grabTextFrom selector="{{SalesOrderSection.salesOrderPrice('grand_total')}}" stepKey="salesOrderGrandTotalPrice"/>
25+
<assertEquals stepKey="assertSubtotalPrice">
26+
<expectedResult type="string">{{subtotalPrice}}</expectedResult>
27+
<actualResult type="string">$salesOrderSubtotalPrice</actualResult>
28+
</assertEquals>
29+
<assertEquals stepKey="assertShippingMethodPrice">
30+
<expectedResult type="string">{{shippingPrice}}</expectedResult>
31+
<actualResult type="string">$salesOrderShippingPrice</actualResult>
32+
</assertEquals>
33+
<assertEquals stepKey="assertTotalPrice">
34+
<expectedResult type="string">{{totalPrice}}</expectedResult>
35+
<actualResult type="string">$salesOrderGrandTotalPrice</actualResult>
36+
</assertEquals>
37+
</actionGroup>
38+
</actionGroups>

app/code/Magento/Multishipping/Test/Mftf/ActionGroup/SelectBillingInfoActionGroup.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
<waitForPageLoad stepKey="waitForBillingInfoPageLoad"/>
1313
<click stepKey="goToReviewOrder" selector="{{PaymentMethodSection.goToReviewOrder}}"/>
1414
</actionGroup>
15-
</actionGroups>
16-
15+
</actionGroups>

app/code/Magento/Multishipping/Test/Mftf/Page/MultishippingCheckoutPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
<section name="PaymentMethodSection"/>
1616
<section name="ReviewOrderSection"/>
1717
</page>
18-
</pages>
18+
</pages>

app/code/Magento/Multishipping/Test/Mftf/Section/PaymentMethodSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
<section name="PaymentMethodSection">
1212
<element name="goToReviewOrder" type="button" selector="//span[text()='Go to Review Your Order']"/>
1313
</section>
14-
</sections>
14+
</sections>

app/code/Magento/Multishipping/Test/Mftf/Section/ReviewOrderSection.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@
2323
<element name="secondOrderTotalPrice" type="text" selector="//div[@class='block-content'][position()=2]//table[position()=1]//tr[@class='grand totals'][position()=1]//td//span[@class='price']"/>
2424
<element name="grandTotalPrice" type="text" selector="//div[@class='checkout-review']//div[@class='grand totals']//span[@class='price']"/>
2525
</section>
26-
</sections>
27-
26+
</sections>
Lines changed: 15 additions & 0 deletions
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<section name="SalesOrderSection">
12+
<element name="viewOrderLink" type="text" selector="//span[text()='View Order']"/>
13+
<element name="salesOrderPrice" type="text" selector="//div[@class='order-details-items ordered']//tr[@class='{{price_type}}']//td[@class='amount']//span[@class='price']" parameterized="true"/>
14+
</section>
15+
</sections>

0 commit comments

Comments
 (0)