Skip to content

Commit f721e2f

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into 2.2-develop-pr47
2 parents cf850d6 + 111681d commit f721e2f

File tree

58 files changed

+1144
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1144
-126
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="NavigateToConfigurationGeneralPage">
11+
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/>
12+
<waitForPageLoad stepKey="waitForConfigPageLoad"/>
13+
</actionGroup>
14+
15+
<actionGroup name="SelectTopDestinationsCountry">
16+
<arguments>
17+
<argument name="countries"/>
18+
</arguments>
19+
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
20+
<selectOption selector="{{AdminConfigurationGeneralSectionCountryOptionsGroupSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="selectTopDestinationsCountry"/>
21+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfiguration"/>
22+
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
23+
</actionGroup>
24+
25+
<actionGroup name="UnSelectTopDestinationsCountry">
26+
<arguments>
27+
<argument name="countries"/>
28+
</arguments>
29+
<amOnPage url="{{AdminConfigurationGeneralSectionPage.url('#general_country-link')}}" stepKey="goToConfigurationSectionPage"/>
30+
<unselectOption selector="{{AdminConfigurationGeneralSectionCountryOptionsGroupSection.topDestinations}}" parameterArray="[{{countries.country}}]" stepKey="unSelectTopDestinationsCountry"/>
31+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfiguration"/>
32+
<see userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
33+
</actionGroup>
34+
</actionGroups>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<pages xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8+
<page name="AdminConfigurationGeneralSectionPage" url="admin/system_config/edit/section/general/{{group_anchor}}" parameterized="true" area="admin" module="Magento_Config">
9+
<section name="AdminConfigurationGeneralSectionCountryOptionsGroupSection"/>
10+
</page>
11+
</pages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<sections xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8+
<section name="AdminConfigurationGeneralSectionCountryOptionsGroupSection">
9+
<element name="topDestinations" type="multiselect" selector="#general_country_destinations"/>
10+
</section>
11+
</sections>

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
<field id="destinations" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
219219
<label>Top destinations</label>
220220
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
221+
<can_be_empty>1</can_be_empty>
221222
</field>
222223
</group>
223224
<group id="locale" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@
9090
<!-- Go to the shopping cart page and edit the first product -->
9191
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
9292
<waitForPageLoad stepKey="waitForCartPageLoad"/>
93-
<waitForElementVisible selector="{{CheckoutCartSummarySection.total}}" stepKey="waitForInfoDropdown"/>
93+
<waitForElementVisible selector="{{StorefrontCheckoutCartSummarySection.total}}" stepKey="waitForInfoDropdown"/>
9494
<waitForPageLoad stepKey="waitForCartPageLoad3"/>
95-
<grabTextFrom selector="{{CheckoutCartSummarySection.total}}" stepKey="grabTotalBefore"/>
95+
<grabTextFrom selector="{{StorefrontCheckoutCartSummarySection.total}}" stepKey="grabTotalBefore"/>
9696
<click selector="{{CheckoutCartProductSection.editItemParametersButton('1')}}" stepKey="clickEdit"/>
9797
<waitForPageLoad stepKey="waitForStorefront2"/>
9898

@@ -113,9 +113,9 @@
113113
<!-- Assert that the options are both there and the proce no longer matches -->
114114
<see selector="{{CheckoutCartProductSection.itemOptionsBlock('2')}}" userInput="$$simpleProduct1.sku$$" stepKey="assertBothOptions"/>
115115
<see selector="{{CheckoutCartProductSection.itemOptionsBlock('2')}}" userInput="$$simpleProduct2.sku$$" stepKey="assertBothOptions2"/>
116-
<waitForElementVisible selector="{{CheckoutCartSummarySection.total}}" stepKey="waitForInfoDropdown2"/>
116+
<waitForElementVisible selector="{{StorefrontCheckoutCartSummarySection.total}}" stepKey="waitForInfoDropdown2"/>
117117
<waitForPageLoad stepKey="waitForCartPageLoad4"/>
118-
<grabTextFrom selector="{{CheckoutCartSummarySection.total}}" stepKey="grabTotalAfter"/>
118+
<grabTextFrom selector="{{StorefrontCheckoutCartSummarySection.total}}" stepKey="grabTotalAfter"/>
119119
<assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/>
120120

121121
<!-- Delete the bundled product -->

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/Setup/UpgradeWebsiteAttributes.php

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ private function processAttributeValues(ModuleDataSetupInterface $setup, array $
148148
*/
149149
private function fetchAttributeValues(ModuleDataSetupInterface $setup, $tableName)
150150
{
151+
$multipleStoresInWebsite = array_values(
152+
array_reduce(
153+
array_filter($this->getGroupedStoreViews($setup), function ($storeViews) {
154+
return is_array($storeViews) && count($storeViews) > 1;
155+
}),
156+
'array_merge',
157+
[]
158+
)
159+
);
160+
161+
if (count($multipleStoresInWebsite) < 1) {
162+
return [];
163+
}
164+
151165
$connection = $setup->getConnection();
152166
$batchSelectIterator = $this->batchQueryGenerator->generate(
153167
'value_id',
@@ -158,27 +172,18 @@ private function fetchAttributeValues(ModuleDataSetupInterface $setup, $tableNam
158172
'*'
159173
)
160174
->join(
161-
[
162-
'cea' => $setup->getTable('catalog_eav_attribute'),
163-
],
175+
['cea' => $setup->getTable('catalog_eav_attribute')],
164176
'cpei.attribute_id = cea.attribute_id',
165177
''
166178
)
167179
->join(
168-
[
169-
'st' => $setup->getTable('store'),
170-
],
180+
['st' => $setup->getTable('store')],
171181
'st.store_id = cpei.store_id',
172182
'st.website_id'
173183
)
174-
->where(
175-
'cea.is_global = ?',
176-
self::ATTRIBUTE_WEBSITE
177-
)
178-
->where(
179-
'cpei.store_id <> ?',
180-
self::GLOBAL_STORE_VIEW_ID
181-
)
184+
->where('cea.is_global = ?', self::ATTRIBUTE_WEBSITE)
185+
->where('cpei.store_id IN (?)', $multipleStoresInWebsite),
186+
1000
182187
);
183188

184189
foreach ($batchSelectIterator as $select) {
@@ -201,17 +206,15 @@ private function getGroupedStoreViews(ModuleDataSetupInterface $setup)
201206
->select()
202207
->from(
203208
$setup->getTable('store'),
204-
'*'
205-
);
209+
['store_id', 'website_id']
210+
)->where('store_id <> ?', self::GLOBAL_STORE_VIEW_ID);
206211

207-
$storeViews = $connection->fetchAll($query);
212+
$storeViews = $connection->fetchPairs($query);
208213

209214
$this->groupedStoreViews = [];
210215

211-
foreach ($storeViews as $storeView) {
212-
if ($storeView['store_id'] != 0) {
213-
$this->groupedStoreViews[$storeView['website_id']][] = $storeView['store_id'];
214-
}
216+
foreach ($storeViews as $storeId => $websiteId) {
217+
$this->groupedStoreViews[$websiteId][] = $storeId;
215218
}
216219

217220
return $this->groupedStoreViews;

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,32 @@
3434
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
3535
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
3636
</entity>
37+
<entity name="ApiSimpleOne" type="product2">
38+
<data key="sku" unique="suffix">api-simple-product</data>
39+
<data key="type_id">simple</data>
40+
<data key="attribute_set_id">4</data>
41+
<data key="visibility">4</data>
42+
<data key="name" unique="suffix">Api Simple Product</data>
43+
<data key="price">123.00</data>
44+
<data key="urlKey" unique="suffix">api-simple-product</data>
45+
<data key="status">1</data>
46+
<data key="quantity">100</data>
47+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
48+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
49+
</entity>
50+
<entity name="ApiSimpleTwo" type="product2">
51+
<data key="sku" unique="suffix">api-simple-product-two</data>
52+
<data key="type_id">simple</data>
53+
<data key="attribute_set_id">4</data>
54+
<data key="visibility">4</data>
55+
<data key="name" unique="suffix">Api Simple Product Two</data>
56+
<data key="price">234.00</data>
57+
<data key="urlKey" unique="suffix">api-simple-product-two</data>
58+
<data key="status">1</data>
59+
<data key="quantity">100</data>
60+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
61+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
62+
</entity>
3763
<entity name="ApiSimpleProductUpdateDescription" type="product2">
3864
<requiredEntity type="custom_attribute">ApiProductDescription</requiredEntity>
3965
<requiredEntity type="custom_attribute">ApiProductShortDescription</requiredEntity>

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/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
<expectedResult type="string">$1,500.00</expectedResult>
180180
<actualResult type="variable">grabTextFromSubtotalField4</actualResult>
181181
</assertEquals>
182-
<grabTextFrom selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="grabTextFromCheckoutCartSummarySectionSubtotal1"/>
182+
<grabTextFrom selector="{{StorefrontCheckoutCartSummarySection.subtotal}}" stepKey="grabTextFromCheckoutCartSummarySectionSubtotal1"/>
183183
<assertEquals message="Shopping cart summary section should contain subtotal $1,500" stepKey="assertSubtotalFieldFromCheckoutCartSummarySection1">
184184
<expectedResult type="string">$1,500.00</expectedResult>
185185
<actualResult type="variable">grabTextFromCheckoutCartSummarySectionSubtotal1</actualResult>
@@ -256,7 +256,7 @@
256256
<expectedResult type="string">$4,000.00</expectedResult>
257257
<actualResult type="variable">grabTextFromSubtotalField7</actualResult>
258258
</assertEquals>
259-
<grabTextFrom selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="grabTextFromCheckoutCartSummarySectionSubtotal2"/>
259+
<grabTextFrom selector="{{StorefrontCheckoutCartSummarySection.subtotal}}" stepKey="grabTextFromCheckoutCartSummarySectionSubtotal2"/>
260260
<assertEquals message="Shopping cart summary section should contain subtotal $4,000" stepKey="assertSubtotalFieldFromCheckoutCartSummarySection2">
261261
<expectedResult type="string">$4,000.00</expectedResult>
262262
<actualResult type="variable">grabTextFromCheckoutCartSummarySectionSubtotal2</actualResult>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,15 @@
4949
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
5050
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
5151
</actionGroup>
52+
53+
<!--Verify country options in checkout top destination section-->
54+
<actionGroup name="VerifyTopDestinationsCountry">
55+
<arguments>
56+
<argument name="country" type="string"/>
57+
<argument name="placeNumber"/>
58+
</arguments>
59+
<waitForElement selector="{{StorefrontCheckoutCartSummarySection.blockSummary}}" stepKey="waitBlockSummaryLoaded"/>
60+
<conditionalClick selector="{{StorefrontCheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{StorefrontCheckoutCartSummarySection.country}}" visible="false" stepKey="openShippingDetails"/>
61+
<see selector="{{StorefrontCheckoutCartSummarySection.countryParameterized('placeNumber')}}" userInput="{{country}}" stepKey="seeCountry"/>
62+
</actionGroup>
5263
</actionGroups>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="TopDestinationCountries" type="countryArray">
12+
<array key="country">
13+
<item>Bahamas</item>
14+
</array>
15+
</entity>
16+
</entities>

app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1111
<page name="CheckoutCartPage" url="/checkout/cart" area="storefront" module="Magento_Checkout">
1212
<section name="CheckoutCartProductSection"/>
13-
<section name="CheckoutCartSummarySection"/>
13+
<section name="StorefrontCheckoutCartSummarySection"/>
1414
</page>
1515
</pages>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml renamed to app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutCartSummarySection.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
98
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11-
<section name="CheckoutCartSummarySection">
10+
<section name="StorefrontCheckoutCartSummarySection">
1211
<element name="subtotal" type="text" selector="#cart-totals tr.totals.sub span.price"/>
1312
<element name="proceedToCheckout" type="button" selector=".action.primary.checkout span" timeout="30"/>
1413
<element name="total" type="text" selector=".amount[data-th='Order Total'] span"/>
@@ -17,5 +16,9 @@
1716
<element name="postcode" type="text" selector="#block-summary input[name='postcode']" timeout="30"/>
1817
<element name="estimateShippingAndTax" type="text" selector="#block-shipping-heading" timeout="5"/>
1918
<element name="flatRateShippingMethod" type="radio" selector="#s_method_flatrate_flatrate" timeout="30"/>
19+
<element name="countryParameterized" type="select" selector="select[name='country_id'] > option:nth-child({{var}})" timeout="10" parameterized="true"/>
20+
<element name="shippingHeading" type="button" selector="#block-shipping-heading"/>
21+
<element name="blockSummary" type="button" selector="#block-summary"/>
22+
<element name="discountAmount" type="text" selector="td[data-th='Discount']"/>
2023
</section>
2124
</sections>

0 commit comments

Comments
 (0)