Skip to content

Commit a7dfddb

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into 2.2-develop-pr3
2 parents 06d604e + 111681d commit a7dfddb

22 files changed

+378
-11
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,22 @@ protected function _saveValuePrices(AbstractModel $object)
160160
&& isset($objectPrice)
161161
&& $object->getStoreId() != Store::DEFAULT_STORE_ID
162162
) {
163-
$baseCurrency = $this->_config->getValue(
163+
$website = $this->_storeManager->getStore($object->getStoreId())->getWebsite();
164+
165+
$websiteBaseCurrency = $this->_config->getValue(
164166
Currency::XML_PATH_CURRENCY_BASE,
165-
'default'
167+
ScopeInterface::SCOPE_WEBSITE,
168+
$website
166169
);
167170

168-
$storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds();
171+
$storeIds = $website->getStoreIds();
169172
if (is_array($storeIds)) {
170173
foreach ($storeIds as $storeId) {
171174
if ($priceType == 'fixed') {
172175
$storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode();
173176
/** @var $currencyModel Currency */
174177
$currencyModel = $this->_currencyFactory->create();
175-
$currencyModel->load($baseCurrency);
178+
$currencyModel->load($websiteBaseCurrency);
176179
$rate = $currencyModel->getRate($storeCurrency);
177180
if (!$rate) {
178181
$rate = 1;

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="StorefrontMessagesSection">
1212
<element name="test" type="input" selector=".test"/>
1313
<element name="success" type="text" selector="div.message-success.success.message"/>
14+
<element name="error" type="text" selector="div.message-error.error.message"/>
1415
</section>
1516
</sections>

app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutCartSummarySection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="countryParameterized" type="select" selector="select[name='country_id'] > option:nth-child({{var}})" timeout="10" parameterized="true"/>
2020
<element name="shippingHeading" type="button" selector="#block-shipping-heading"/>
2121
<element name="blockSummary" type="button" selector="#block-summary"/>
22+
<element name="discountAmount" type="text" selector="td[data-th='Discount']"/>
2223
</section>
2324
</sections>

app/code/Magento/Config/Test/Mftf/Section/GeneralSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<element name="EnableWYSIWYG" type="button" selector="#cms_wysiwyg_enabled"/>
1616
<element name="SwitcherSystemValue" type="button" selector="#cms_wysiwyg_editor_inherit"/>
1717
<element name="Switcher" type="button" selector="#cms_wysiwyg_editor" />
18-
<element name="Save" type="button" selector="#save"/>
18+
<element name="Save" type="button" selector="#save" timeout="30"/>
1919
</section>
2020
<section name="WebSection">
2121
<element name="DefaultLayoutsTab" type="button" selector="#web_default_layouts-head"/>

app/code/Magento/Customer/Test/Mftf/Page/StorefrontCustomerDashboardPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1111
<page name="StorefrontCustomerDashboardPage" url="/customer/account/" area="storefront" module="Magento_Customer">
1212
<section name="StorefrontCustomerDashboardAccountInformationSection" />
13+
<section name="StorefrontCustomerSidebarSection"/>
1314
</page>
1415
</pages>
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontCustomerSidebarSection">
12+
<element name="sidebarTab" type="text" selector="//div[@id='block-collapsible-nav']//a[text()='{{var1}}']" parameterized="true"/>
13+
</section>
14+
</sections>

app/code/Magento/Developer/etc/di.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,10 @@
237237
</argument>
238238
</arguments>
239239
</type>
240+
241+
<type name="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints">
242+
<arguments>
243+
<argument name="debugHintsPath" xsi:type="string">dev/debug/template_hints_storefront</argument>
244+
</arguments>
245+
</type>
240246
</config>

app/code/Magento/Developer/etc/frontend/di.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,4 @@
99
<type name="Magento\Framework\View\TemplateEngineFactory">
1010
<plugin name="debug_hints" type="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints" sortOrder="10"/>
1111
</type>
12-
<type name="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints">
13-
<arguments>
14-
<argument name="debugHintsPath" xsi:type="string">dev/debug/template_hints_storefront</argument>
15-
</arguments>
16-
</type>
1712
</config>

app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@
3131
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/>
3232
</actionGroup>
3333

34+
<!--Navigate to create order page (New Order -> Select Customer)-->
35+
<actionGroup name="navigateToNewOrderPageExistingCustomer">
36+
<arguments>
37+
<argument name="customer"/>
38+
</arguments>
39+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/>
40+
<waitForPageLoad stepKey="waitForIndexPageLoad"/>
41+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/>
42+
<click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewOrder"/>
43+
<fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailFilter}}" stepKey="filterEmail"/>
44+
<click selector="{{AdminOrderCustomersGridSection.searchButton}}" stepKey="applyFilter"/>
45+
<waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/>
46+
<click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/>
47+
<waitForPageLoad stepKey="waitForCreateOrderPageLoad" />
48+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/>
49+
</actionGroup>
50+
3451
<!--Check the required fields are actually required-->
3552
<actionGroup name="checkRequiredFieldsNewOrderForm">
3653
<seeElement selector="{{AdminOrderFormAccountSection.requiredGroup}}" stepKey="seeCustomerGroupRequired"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<element name="getShippingMethods" type="text" selector="#order-shipping_method a.action-default" timeout="30"/>
1414
<element name="flatRateOption" type="radio" selector="#s_method_flatrate_flatrate" timeout="30"/>
1515
<element name="shippingError" type="text" selector="#order[has_shipping]-error"/>
16+
<element name="freeShippingOption" type="radio" selector="#s_method_freeshipping_freeshipping" timeout="30"/>
1617
</section>
1718
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest">
11+
<annotations>
12+
<features value="Sales"/>
13+
<stories value="Admin create order"/>
14+
<title value="Free Shipping is not available in Admin if Minimum Order Amount does not match Order total"/>
15+
<description value="Admin should not be able place order with Free Shipping method if Minimum Order Amount does not match Order total"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MAGETWO-77572"/>
18+
<group value="sales"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
22+
<createData entity="SimpleProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
<field key="price">100</field>
25+
</createData>
26+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
27+
<createData entity="DisableFlatRateShippingMethodConfig" stepKey="disableFlatRate"/>
28+
<createData entity="FreeShippinMethodConfig" stepKey="enableFreeShippingMethod"/>
29+
<createData entity="setFreeShippingSubtotal" stepKey="setFreeShippingSubtotal"/>
30+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
31+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
32+
</before>
33+
<after>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
36+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
37+
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
38+
<createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/>
39+
<createData entity="setFreeShippingSubtotalToDefault" stepKey="setFreeShippingSubtotalToDefault"/>
40+
<actionGroup ref="logout" stepKey="logout"/>
41+
<magentoCLI command="cache:flush" stepKey="flushCache2"/>
42+
</after>
43+
<!--Create new order with existing customer-->
44+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage">
45+
<argument name="customer" value="$$createCustomer$$"/>
46+
</actionGroup>
47+
<!--Add product to order-->
48+
<actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder">
49+
<argument name="product" value="$$createProduct$$"/>
50+
</actionGroup>
51+
52+
<click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/>
53+
<waitForPageLoad stepKey="waitForJavascriptToFinish"/>
54+
<!--Click *Get shipping methods and rates* and see that Free Shipping is absent-->
55+
<click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickGetShippingMehods"/>
56+
<dontSeeElement selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="seeAbsentFreeShipping"/>
57+
<!--Submit Order and verify that Order isn't placed-->
58+
<click selector="{{AdminOrderFormActionSection.submitOrder}}" stepKey="clickSubmitOrder"/>
59+
60+
<dontSeeElement selector="{{AdminMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
61+
<seeElement selector="{{AdminMessagesSection.errorMessage}}" stepKey="seeErrorMessage"/>
62+
</test>
63+
</tests>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="ApplyCartRuleOnStorefrontActionGroup">
11+
<arguments>
12+
<argument name="product"/>
13+
<argument name="couponCode" type="string"/>
14+
</arguments>
15+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
16+
<waitForText userInput="You added {{product.name}} to your shopping cart." stepKey="waitForProductAddToShoppingCart"/>
17+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCheckoutPage"/>
18+
<waitForPageLoad stepKey="waitForCheckoutPageIsOpened"/>
19+
<click selector="{{AdminCartPriceRuleDiscountSection.discountTab}}" stepKey="clickToDiscountTab"/>
20+
<fillField selector="{{AdminCartPriceRuleDiscountSection.couponInput}}" userInput="{{couponCode}}"
21+
stepKey="fillCouponCode"/>
22+
<click selector="{{AdminCartPriceRuleDiscountSection.applyCodeBtn}}" stepKey="applyCode"/>
23+
<waitForPageLoad stepKey="waitForApplyCode"/>
24+
</actionGroup>
25+
</actionGroups>

app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,32 @@
4545
<data key="apply">Percent of product price discount</data>
4646
<data key="discountAmount">50</data>
4747
</entity>
48+
<entity name="SalesRuleSpecificCoupon" type="SalesRule">
49+
<data key="name" unique="suffix">SimpleSalesRule</data>
50+
<data key="description">Sales Rule Descritpion</data>
51+
<array key="website_ids">
52+
<item>1</item>
53+
</array>
54+
<array key="customer_group_ids">
55+
<item>0</item>
56+
<item>1</item>
57+
<item>3</item>
58+
</array>
59+
<data key="uses_per_customer">1</data>
60+
<data key="is_active">true</data>
61+
<data key="stop_rules_processing">false</data>
62+
<data key="is_advanced">true</data>
63+
<data key="sort_order">2</data>
64+
<data key="simple_action">by_percent</data>
65+
<data key="discount_amount">10</data>
66+
<data key="discount_qty">1</data>
67+
<data key="discount_step">0</data>
68+
<data key="apply_to_shipping">false</data>
69+
<data key="times_used">1</data>
70+
<data key="is_rss">false</data>
71+
<data key="coupon_type">SPECIFIC_COUPON</data>
72+
<data key="use_auto_generation">true</data>
73+
<data key="uses_per_coupon">2</data>
74+
<data key="simple_free_shipping">1</data>
75+
</entity>
4876
</entities>

app/code/Magento/SalesRule/Test/Mftf/Metadata/sales_rule-meta.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,7 @@
7272
</object>
7373
</object>
7474
</operation>
75+
<operation name="DeleteSalesRule" dataType="SalesRule" type="delete" auth="adminOauth" url="/V1/salesRules/{rule_id}" method="DELETE">
76+
<contentType>application/json</contentType>
77+
</operation>
7578
</operations>

app/code/Magento/SalesRule/Test/Mftf/Page/AdminCartPriceRulesPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
<page name="AdminCartPriceRulesPage" url="sales_rule/promo_quote/" area="admin" module="Magento_SalesRule">
1111
<section name="AdminCartPriceRulesSection"/>
1212
<section name="AdminCartPriceRulesFormSection"/>
13+
<section name="AdminCartPriceRuleDiscountSection"/>
1314
</page>
1415
</pages>
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="AdminCartPriceRuleDiscountSection">
11+
<element name="discountTab" type="button" selector="//strong[text()='Apply Discount Code']"/>
12+
<element name="couponInput" type="input" selector="#coupon_code"/>
13+
<element name="applyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/>
14+
</section>
15+
</sections>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,12 @@
2323
<element name="applyDiscountToShipping" type="checkbox" selector="input[name='apply_to_shipping']"/>
2424
<element name="applyDiscountToShippingLabel" type="checkbox" selector="input[name='apply_to_shipping']+label"/>
2525
<element name="discountAmount" type="input" selector="input[name='discount_amount']"/>
26+
27+
<!-- Manage Coupon Codes sub-form -->
28+
<element name="manageCouponCodesHeader" type="button" selector="div[data-index='manage_coupon_codes']" timeout="30"/>
29+
<element name="successMessage" type="text" selector="div.message.message-success.success"/>
30+
<element name="couponQty" type="input" selector="#coupons_qty"/>
31+
<element name="generateCouponsButton" type="button" selector="#coupons_generate_button" timeout="30"/>
32+
<element name="generatedCouponByIndex" type="text" selector="#couponCodesGrid_table > tbody > tr:nth-child({{var}}) > td.col-code" parameterized="true"/>
2633
</section>
2734
</sections>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
<element name="filterByNameInput" type="input" selector="input[name='name']"/>
1414
<element name="searchButton" type="button" selector="#promo_quote_grid button[title='Search']" timeout="30"/>
1515
<element name="rowByIndex" type="text" selector="tr[data-role='row']:nth-of-type({{var1}})" parameterized="true" timeout="30"/>
16+
<element name="nameColumns" type="text" selector="td[data-column='name']"/>
17+
<element name="rowContainingText" type="text" selector="//*[@id='promo_quote_grid_table']/tbody/tr[td//text()[contains(., '{{var1}}')]]" parameterized="true" timeout="30"/>
1618
</section>
1719
</sections>

0 commit comments

Comments
 (0)