Skip to content

Commit 72183b7

Browse files
committed
MAGETWO-67450: The rate in order is duplicated
- Fix bug - Add mftf test
1 parent c6cf182 commit 72183b7

10 files changed

+259
-1
lines changed
Lines changed: 22 additions & 0 deletions
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="AdminSetCurrencyRatesActionGroup">
12+
<arguments>
13+
<argument name="firstCurrency" type="string" defaultValue="USD"/>
14+
<argument name="secondCurrency" type="string" defaultValue="EUR"/>
15+
<argument name="rate" type="string" defaultValue="0.5"/>
16+
</arguments>
17+
<fillField selector="{{AdminCurrencyRatesSection.currencyRate(firstCurrency, secondCurrency)}}" userInput="{{rate}}" stepKey="setCurrencyRate"/>
18+
<click selector="{{AdminCurrencyRatesSection.saveCurrencyRates}}" stepKey="clickSaveCurrencyRates"/>
19+
<waitForPageLoad stepKey="waitForSave"/>
20+
<see selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencyRatesMessageData.success}}" stepKey="seeSuccessMessage"/>
21+
</actionGroup>
22+
</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="StorefrontSwitchCurrency">
12+
<arguments>
13+
<argument name="currency" type="string" defaultValue="EUR"/>
14+
</arguments>
15+
<click selector="{{StorefrontSwitchCurrencyRatesSection.currencyTrigger}}" stepKey="openTrigger"/>
16+
<waitForElementVisible selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="waitForCurrency"/>
17+
<click selector="{{StorefrontSwitchCurrencyRatesSection.currency(currency)}}" stepKey="chooseCurrency"/>
18+
<see selector="{{StorefrontSwitchCurrencyRatesSection.selectedCurrency}}" userInput="{{currency}}" stepKey="seeSelectedCurrency"/>
19+
</actionGroup>
20+
</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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="AdminSaveCurrencyRatesMessageData">
12+
<data key="success">All valid rates have been saved.</data>
13+
</entity>
14+
</entities>
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="AdminCurrencyRatesPage" url="admin/system_currency/" area="admin" module="Currency">
12+
<section name="AdminCurrencyRatesSection"/>
13+
</page>
14+
</pages>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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:Page/etc/SectionObject.xsd">
11+
<section name="AdminCurrencyRatesSection">
12+
<element name="import" type="button" selector="//button[@title='Import']"/>
13+
<element name="saveCurrencyRates" type="button" selector="//button[@title='Save Currency Rates']"/>
14+
<element name="oldRate" type="text" selector="//div[contains(@class, 'admin__field-note') and contains(text(), 'Old rate:')]/strong"/>
15+
<element name="currencyRate" type="input" selector="input[name='rate[{{fistCurrency}}][{{secondCurrency}}]']" parameterized="true"/>
16+
</section>
17+
</sections>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontSwitchCurrencyRatesSection">
12+
<element name="currencyTrigger" type="select" selector="#switcher-currency-trigger" timeout="30"/>
13+
<element name="currency" type="button" selector="//div[@id='switcher-currency-trigger']/following-sibling::ul//a[contains(text(), '{{currency}}')]" parameterized="true" timeout="10"/>
14+
<element name="selectedCurrency" type="text" selector="#switcher-currency-trigger span"/>
15+
</section>
16+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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="AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest" extends="AdminOrderRateDisplayedInOneLineTest">
12+
<annotations>
13+
<features value="CurrencySymbol"/>
14+
<stories value="Currency rates order page"/>
15+
<title value="Order rate converting currency for 'Base Currency' and 'Default Display Currency' displayed correct"/>
16+
<description value="Order rate converting currency for 'Base Currency' and 'Default Display Currency' displayed correct"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-17255" />
19+
<useCaseId value="MAGETWO-67450"/>
20+
<group value="currency"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<!--Create product-->
25+
<createData entity="SimpleProduct2" stepKey="createNewProduct"/>
26+
<!--Set Currency options for Website-->
27+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/base USD" stepKey="setCurrencyBaseUSDWebsites"/>
28+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/allow EUR,USD,RUB" stepKey="setAllowedCurrencyWebsites"/>
29+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/default EUR" stepKey="setCurrencyDefaultUSDWebsites"/>
30+
</before>
31+
<after>
32+
<!--Delete created product-->
33+
<comment userInput="Delete created product" stepKey="commentDeleteCreatedProduct"/>
34+
<deleteData createDataKey="createNewProduct" stepKey="deleteNewProduct"/>
35+
<actionGroup ref="logout" stepKey="logout"/>
36+
</after>
37+
<!--Set currency rates-->
38+
<amOnPage url="{{AdminCurrencyRatesPage.url}}" stepKey="gotToCurrencyRatesPageSecondTime"/>
39+
<waitForPageLoad stepKey="waitForLoadRatesPageSecondTime"/>
40+
<actionGroup ref="AdminSetCurrencyRatesActionGroup" stepKey="setCurrencyRates">
41+
<argument name="firstCurrency" value="USD"/>
42+
<argument name="secondCurrency" value="RUB"/>
43+
<argument name="rate" value="0.8"/>
44+
</actionGroup>
45+
<!--Open created product on Storefront and place for order-->
46+
<amOnPage url="{{StorefrontProductPage.url($$createNewProduct.custom_attributes[url_key]$$)}}" stepKey="goToNewProductPage"/>
47+
<waitForPageLoad stepKey="waitForNewProductPagePageLoad"/>
48+
<actionGroup ref="StorefrontSwitchCurrency" stepKey="switchCurrency">
49+
<argument name="currency" value="RUB"/>
50+
</actionGroup>
51+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontNewProductPage">
52+
<argument name="productName" value="$$createNewProduct.name$$"/>
53+
</actionGroup>
54+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutNewProductFromMinicart" />
55+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutNewFillingShippingSection">
56+
</actionGroup>
57+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="guestSelectNewCheckMoneyOrderPayment" />
58+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="guestPlaceNewOrder">
59+
<argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage" />
60+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" />
61+
</actionGroup>
62+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabNewOrderNumber"/>
63+
<!--Open order and check rates display in one line-->
64+
<actionGroup ref="OpenOrderById" stepKey="openNewOrderById">
65+
<argument name="orderId" value="$grabNewOrderNumber"/>
66+
</actionGroup>
67+
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="EUR / USD rate" stepKey="seeUSDandEURRate"/>
68+
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="RUB / USD rate:" stepKey="seeRUBandEURRate"/>
69+
<grabMultiple selector="{{AdminOrderDetailsInformationSection.rate}}" stepKey="grabRates" />
70+
<assertEquals stepKey="assertRates">
71+
<actualResult type="variable">grabRates</actualResult>
72+
<expectedResult type="array">['EUR / USD rate:', 'RUB / USD rate:']</expectedResult>
73+
</assertEquals>
74+
</test>
75+
</tests>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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="AdminOrderRateDisplayedInOneLineTest">
12+
<annotations>
13+
<features value="CurrencySymbol"/>
14+
<stories value="Currency rates order page"/>
15+
<title value="Order rate converting currency for 'Base Currency' and 'Default Display Currency' displayed correct once"/>
16+
<description value="Order rate converting currency for 'Base Currency' and 'Default Display Currency' displayed correct once"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-17255" />
19+
<useCaseId value="MAGETWO-67450"/>
20+
<group value="currency"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<!--Create product-->
25+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
26+
<!--Set price scope website-->
27+
<magentoCLI command="config:set catalog/price/scope 1" stepKey="setCatalogPriceScopeWebsite"/>
28+
<!--Set Currency options for Default Config-->
29+
<magentoCLI command="config:set currency/options/base EUR" stepKey="setCurrencyBaseEUR"/>
30+
<magentoCLI command="config:set currency/options/allow EUR,USD" stepKey="setAllowedCurrencyEUR"/>
31+
<magentoCLI command="config:set currency/options/default EUR" stepKey="setCurrencyDefaultEUR"/>
32+
<!--Set Currency options for Website-->
33+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/base USD" stepKey="setCurrencyBaseEURWebsites"/>
34+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/allow EUR,USD" stepKey="setAllowedCurrencyEURWebsites"/>
35+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/default EUR" stepKey="setCurrencyDefaultEURWebsites"/>
36+
</before>
37+
<after>
38+
<!--Delete created product-->
39+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
40+
<!--Reset configurations-->
41+
<magentoCLI command="config:set catalog/price/scope 0" stepKey="setCatalogPriceScopeGlobal"/>
42+
<magentoCLI command="config:set currency/options/base USD" stepKey="setCurrencyBaseUSD"/>
43+
<magentoCLI command="config:set currency/options/default USD" stepKey="setCurrencyDefaultUSD"/>
44+
<magentoCLI command="config:set currency/options/allow USD" stepKey="setAllowedCurrencyUSD"/>
45+
<!--Set Currency options for Website-->
46+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/base USD" stepKey="setCurrencyBaseUSDWebsites"/>
47+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/default USD" stepKey="setCurrencyDefaultUSDWebsites"/>
48+
<magentoCLI command="config:set --scope=websites --scope-code=base currency/options/allow USD" stepKey="setAllowedCurrencyUSDWebsites"/>
49+
<actionGroup ref="logout" stepKey="logout"/>
50+
</after>
51+
<!--Open created product on Storefront and place for order-->
52+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/>
53+
<waitForPageLoad stepKey="waitForProductPagePageLoad"/>
54+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
55+
<argument name="productName" value="$$createProduct.name$$"/>
56+
</actionGroup>
57+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutFromMinicart" />
58+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection">
59+
</actionGroup>
60+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="guestSelectCheckMoneyOrderPayment" />
61+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="guestPlaceOrder">
62+
<argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage" />
63+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" />
64+
</actionGroup>
65+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
66+
<!--Open order and check rates display in one line-->
67+
<actionGroup ref="OpenOrderById" stepKey="openOrderById">
68+
<argument name="orderId" value="$grabOrderNumber"/>
69+
</actionGroup>
70+
<see selector="{{AdminOrderDetailsInformationSection.orderInformationTable}}" userInput="EUR / USD rate" stepKey="seeEURandUSDRate"/>
71+
<grabMultiple selector="{{AdminOrderDetailsInformationSection.rate}}" stepKey="grabRate" />
72+
<assertEquals stepKey="assertSelectedCategories">
73+
<actualResult type="variable">grabRate</actualResult>
74+
<expectedResult type="array">[EUR / USD rate:]</expectedResult>
75+
</assertEquals>
76+
</test>
77+
</tests>

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderDetailsInformationSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<element name="orderStatus" type="text" selector=".order-information table.order-information-table #order_status"/>
1414
<element name="purchasedFrom" type="text" selector=".order-information table.order-information-table tr:last-of-type > td"/>
1515
<element name="accountInformation" type="text" selector=".order-account-information-table"/>
16+
<element name="orderInformationTable" type="block" selector=".order-information-table"/>
17+
<element name="rate" type="text" selector="//table[contains(@class, 'order-information-table')]//th[contains(text(), 'rate:')]"/>
1618
<element name="customerName" type="text" selector=".order-account-information table tr:first-of-type > td span"/>
1719
<element name="customerEmail" type="text" selector=".order-account-information table tr:nth-of-type(2) > td a"/>
1820
<element name="customerGroup" type="text" selector=".order-account-information table tr:nth-of-type(3) > td"/>

app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ $orderStoreDate = $block->formatDate(
2323
);
2424

2525
$customerUrl = $block->getCustomerViewUrl();
26+
2627
$allowedAddressHtmlTags = ['b', 'br', 'em', 'i', 'li', 'ol', 'p', 'strong', 'sub', 'sup', 'ul'];
2728
?>
2829

@@ -99,7 +100,7 @@ $allowedAddressHtmlTags = ['b', 'br', 'em', 'i', 'li', 'ol', 'p', 'strong', 'sub
99100
<td><?= $block->escapeHtml($order->getBaseToGlobalRate()) ?></td>
100101
</tr>
101102
<?php endif; ?>
102-
<?php if ($order->getBaseCurrencyCode() != $order->getOrderCurrencyCode()) : ?>
103+
<?php if ($order->getBaseCurrencyCode() != $order->getOrderCurrencyCode() && $order->getGlobalCurrencyCode() != $order->getOrderCurrencyCode()) : ?>
103104
<tr>
104105
<th><?= $block->escapeHtml(__('%1 / %2 rate:', $order->getOrderCurrencyCode(), $order->getBaseCurrencyCode())) ?></th>
105106
<td><?= $block->escapeHtml($order->getBaseToOrderRate()) ?></td>

0 commit comments

Comments
 (0)