Skip to content

Commit 08a5ab0

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents b7bdd20 + fd25d85 commit 08a5ab0

File tree

65 files changed

+2632
-304
lines changed

Some content is hidden

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

65 files changed

+2632
-304
lines changed

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Aggregation/DataProvider.php

+20-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
use Magento\Framework\DB\Select;
1717
use Magento\Framework\Search\Adapter\Mysql\Aggregation\DataProviderInterface;
1818
use Magento\Framework\Search\Request\BucketInterface;
19+
use Magento\Framework\Event\Manager;
1920

2021
/**
22+
* Data Provider for catalog search.
23+
*
2124
* @deprecated
2225
* @see \Magento\ElasticSearch
2326
*/
@@ -43,12 +46,18 @@ class DataProvider implements DataProviderInterface
4346
*/
4447
private $selectBuilderForAttribute;
4548

49+
/**
50+
* @var Manager
51+
*/
52+
private $eventManager;
53+
4654
/**
4755
* @param Config $eavConfig
4856
* @param ResourceConnection $resource
4957
* @param ScopeResolverInterface $scopeResolver
5058
* @param null $customerSession @deprecated
5159
* @param SelectBuilderForAttribute|null $selectBuilderForAttribute
60+
* @param Manager|null $eventManager
5261
*
5362
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5463
*/
@@ -57,17 +66,19 @@ public function __construct(
5766
ResourceConnection $resource,
5867
ScopeResolverInterface $scopeResolver,
5968
$customerSession,
60-
SelectBuilderForAttribute $selectBuilderForAttribute = null
69+
SelectBuilderForAttribute $selectBuilderForAttribute = null,
70+
Manager $eventManager = null
6171
) {
6272
$this->eavConfig = $eavConfig;
6373
$this->connection = $resource->getConnection();
6474
$this->scopeResolver = $scopeResolver;
6575
$this->selectBuilderForAttribute = $selectBuilderForAttribute
6676
?: ObjectManager::getInstance()->get(SelectBuilderForAttribute::class);
77+
$this->eventManager = $eventManager ?: ObjectManager::getInstance()->get(Manager::class);
6778
}
6879

6980
/**
70-
* {@inheritdoc}
81+
* @inheritdoc
7182
*/
7283
public function getDataSet(
7384
BucketInterface $bucket,
@@ -83,20 +94,26 @@ public function getDataSet(
8394
'main_table.entity_id = entities.entity_id',
8495
[]
8596
);
97+
$this->eventManager->dispatch(
98+
'catalogsearch_query_add_filter_after',
99+
['bucket' => $bucket, 'select' => $select]
100+
);
86101
$select = $this->selectBuilderForAttribute->build($select, $attribute, $currentScope);
87102

88103
return $select;
89104
}
90105

91106
/**
92-
* {@inheritdoc}
107+
* @inheritdoc
93108
*/
94109
public function execute(Select $select)
95110
{
96111
return $this->connection->fetchAssoc($select);
97112
}
98113

99114
/**
115+
* Get select.
116+
*
100117
* @return Select
101118
*/
102119
private function getSelect()

app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php

+8
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,12 @@ private function getOptionCount($value, $optionsFacetedData)
153153
? (int)$optionsFacetedData[$value]['count']
154154
: 0;
155155
}
156+
157+
/**
158+
* @inheritdoc
159+
*/
160+
protected function isOptionReducesResults($optionCount, $totalSize)
161+
{
162+
return $optionCount <= $totalSize;
163+
}
156164
}

app/code/Magento/CatalogSearch/Test/Unit/Model/Adapter/Mysql/Aggregation/DataProviderTest.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Eav\Model\Entity\Attribute;
2121
use Magento\Catalog\Model\Product;
2222
use Magento\Framework\DB\Ddl\Table;
23+
use Magento\Framework\Event\Manager;
2324

2425
/**
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -64,6 +65,11 @@ class DataProviderTest extends \PHPUnit\Framework\TestCase
6465
*/
6566
private $selectBuilderForAttribute;
6667

68+
/**
69+
* @var Manager|\PHPUnit_Framework_MockObject_MockObject
70+
*/
71+
private $eventManager;
72+
6773
protected function setUp()
6874
{
6975
$this->eavConfigMock = $this->createMock(Config::class);
@@ -73,12 +79,14 @@ protected function setUp()
7379
$this->adapterMock = $this->createMock(AdapterInterface::class);
7480
$this->resourceConnectionMock->expects($this->once())->method('getConnection')->willReturn($this->adapterMock);
7581
$this->selectBuilderForAttribute = $this->createMock(SelectBuilderForAttribute::class);
82+
$this->eventManager = $this->createMock(Manager::class);
7683
$this->model = new DataProvider(
7784
$this->eavConfigMock,
7885
$this->resourceConnectionMock,
7986
$this->scopeResolverMock,
8087
$this->sessionMock,
81-
$this->selectBuilderForAttribute
88+
$this->selectBuilderForAttribute,
89+
$this->eventManager
8290
);
8391
}
8492

@@ -102,6 +110,7 @@ public function testGetDataSetUsesFrontendPriceIndexerTableIfAttributeIsPrice()
102110

103111
$selectMock = $this->createMock(Select::class);
104112
$this->adapterMock->expects($this->atLeastOnce())->method('select')->willReturn($selectMock);
113+
$this->eventManager->expects($this->once())->method('dispatch')->willReturn($selectMock);
105114
$tableMock = $this->createMock(Table::class);
106115

107116
$this->model->getDataSet($bucketMock, ['scope' => $dimensionMock], $tableMock);
@@ -129,6 +138,7 @@ public function testGetDataSetUsesFrontendPriceIndexerTableForDecimalAttributes(
129138
$selectMock = $this->createMock(Select::class);
130139
$this->selectBuilderForAttribute->expects($this->once())->method('build')->willReturn($selectMock);
131140
$this->adapterMock->expects($this->atLeastOnce())->method('select')->willReturn($selectMock);
141+
$this->eventManager->expects($this->once())->method('dispatch')->willReturn($selectMock);
132142
$tableMock = $this->createMock(Table::class);
133143
$this->model->getDataSet($bucketMock, ['scope' => $dimensionMock], $tableMock);
134144
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="registerMessage" type="text" selector="#registration p:nth-child(1)"/>
1313
<element name="customerEmail" type="text" selector="#registration p:nth-child(2)"/>
1414
<element name="createAccountButton" type="button" selector="#registration form input[type='submit']" timeout="30"/>
15+
<element name="orderNumber" type="text" selector="//p[text()='Your order # is: ']//span"/>
1516
</section>
1617
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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="StoreFrontCheckCustomerInfoCreatedByGuestTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Check customer information created by guest"/>
15+
<title value="Check Customer Information Created By Guest"/>
16+
<description value="Check customer information after placing the order as the guest who created an account"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-95932"/>
19+
<useCaseId value="MAGETWO-95820"/>
20+
<group value="checkout"/>
21+
</annotations>
22+
23+
<before>
24+
<createData entity="_defaultCategory" stepKey="category"/>
25+
<createData entity="_defaultProduct" stepKey="product">
26+
<requiredEntity createDataKey="category"/>
27+
</createData>
28+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
29+
</before>
30+
31+
<after>
32+
<deleteData createDataKey="product" stepKey="deleteProduct" />
33+
<deleteData createDataKey="category" stepKey="deleteCategory" />
34+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
35+
</after>
36+
37+
<amOnPage url="$$product.name$$.html" stepKey="navigateToProductPage"/>
38+
<waitForPageLoad stepKey="waitForProductPage"/>
39+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
40+
<argument name="productName" value="$$product.name$$"/>
41+
</actionGroup>
42+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
43+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection">
44+
<argument name="customerVar" value="CustomerEntityOne"/>
45+
<argument name="customerAddressVar" value="CustomerAddressSimple"/>
46+
</actionGroup>
47+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="placeOrder">
48+
<argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage"/>
49+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" />
50+
</actionGroup>
51+
<grabTextFrom selector="{{CheckoutSuccessRegisterSection.orderNumber}}" stepKey="grabOrderNumber"/>
52+
<click selector="{{CheckoutSuccessRegisterSection.createAccountButton}}" stepKey="clickCreateAccountButton"/>
53+
<fillField selector="{{StorefrontCustomerCreateFormSection.passwordField}}" userInput="{{CustomerEntityOne.password}}" stepKey="TypePassword"/>
54+
<fillField selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}" userInput="{{CustomerEntityOne.password}}" stepKey="TypeConfirmationPassword"/>
55+
<click selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}" stepKey="clickOnCreateAccount"/>
56+
<see userInput="Thank you for registering" stepKey="verifyAccountCreated"/>
57+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/>
58+
<amOnPage url="{{AdminOrderPage.url({$grabOrderNumber})}}" stepKey="navigateToOrderPage"/>
59+
<waitForPageLoad stepKey="waitForCreatedOrderPage"/>
60+
<see stepKey="seeCustomerName" userInput="{{CustomerEntityOne.firstname}}" selector="{{AdminShipmentOrderInformationSection.customerName}}"/>
61+
</test>
62+
</tests>

app/code/Magento/Cms/Test/Mftf/ActionGroup/CMSActionGroup.xml

+16
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,20 @@
4444
<waitForPageLoad stepKey="waitForPageLoad3"/>
4545
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection" />
4646
</actionGroup>
47+
48+
<actionGroup name="AddStoreViewToCmsPage" extends="navigateToCreatedCMSPage">
49+
<arguments>
50+
<argument name="storeViewName" type="string"/>
51+
</arguments>
52+
<remove keyForRemoval="clickExpandContentTabForPage"/>
53+
<remove keyForRemoval="waitForLoadingMaskOfStagingSection"/>
54+
<click selector="{{CmsNewPagePiwSection.header}}" stepKey="clickPageInWebsites" after="waitForPageLoad3"/>
55+
<waitForElementVisible selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="waitForStoreGridReload"/>
56+
<clickWithLeftButton selector="{{CmsNewPagePiwSection.selectStoreView(storeViewName)}}" stepKey="clickStoreView"/>
57+
<click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandButtonMenu"/>
58+
<waitForElementVisible selector="{{CmsNewPagePageActionsSection.splitButtonMenu}}" stepKey="waitForSplitButtonMenuVisible"/>
59+
<click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/>
60+
<waitForPageLoad stepKey="waitForPageLoad"/>
61+
<see userInput="You saved the page." stepKey="seeMessage"/>
62+
</actionGroup>
4763
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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="StoreViewLanguageCorrectSwitchTest">
12+
<annotations>
13+
<features value="Cms"/>
14+
<stories value="Store View (language) switch leads to 404"/>
15+
<group value="Cms"/>
16+
<title value="Check that Store View(language) switches correct"/>
17+
<description value="Check that Store View(language) switches correct"/>
18+
<severity value="MAJOR"/>
19+
<testCaseId value="MAGETWO-96388"/>
20+
<useCaseId value="MAGETWO-57337"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
25+
<!-- Create Cms Pages -->
26+
<createData entity="_newDefaultCmsPage" stepKey="createFirstCmsPage"/>
27+
<createData entity="_newDefaultCmsPage" stepKey="createSecondCmsPage"/>
28+
</before>
29+
<after>
30+
<deleteData createDataKey="createFirstCmsPage" stepKey="deleteFirstCmsPage"/>
31+
<deleteData createDataKey="createSecondCmsPage" stepKey="deleteSecondCmsPage"/>
32+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView">
33+
<argument name="customStore" value="NewStoreViewData"/>
34+
</actionGroup>
35+
<actionGroup ref="logout" stepKey="logout"/>
36+
</after>
37+
38+
<!-- Create StoreView -->
39+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView">
40+
<argument name="customStore" value="NewStoreViewData"/>
41+
</actionGroup>
42+
43+
<!-- Add StoreView To Cms Page-->
44+
<actionGroup ref="AddStoreViewToCmsPage" stepKey="gotToCmsPage">
45+
<argument name="CMSPage" value="$$createSecondCmsPage$$"/>
46+
<argument name="storeViewName" value="{{NewStoreViewData.name}}"/>
47+
</actionGroup>
48+
49+
<!-- Check that Cms Page is open -->
50+
<amOnPage url="{{StorefrontHomePage.url}}/$$createFirstCmsPage.identifier$$" stepKey="gotToFirstCmsPage"/>
51+
<see userInput="$$createFirstCmsPage.title$$" stepKey="seePageTitle"/>
52+
53+
<!-- Switch StoreView and check that Cms Page is open -->
54+
<click selector="{{StorefrontHeaderSection.storeViewSwitcher}}" stepKey="clickStoreViewSwitcher"/>
55+
<waitForElementVisible selector="{{StorefrontHeaderSection.storeViewDropdown}}" stepKey="waitForStoreViewDropDown"/>
56+
<click selector="{{StorefrontHeaderSection.storeViewOption(NewStoreViewData.code)}}" stepKey="selectStoreView"/>
57+
<amOnPage url="{{StorefrontHomePage.url}}/$$createSecondCmsPage.identifier$$" stepKey="gotToSecondCmsPage"/>
58+
<see userInput="$$createSecondCmsPage.title$$" stepKey="seePageTitle1"/>
59+
</test>
60+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="EnableAllowGuestCheckout" type="allow_guest_checkout_config">
12+
<requiredEntity type="guest_checkout">AllowGuestCheckoutYes</requiredEntity>
13+
</entity>
14+
<entity name="AllowGuestCheckoutYes" type="guest_checkout">
15+
<data key="value">1</data>
16+
</entity>
17+
18+
<entity name="DisableAllowGuestCheckout" type="allow_guest_checkout_config">
19+
<requiredEntity type="guest_checkout">AllowGuestCheckoutNo</requiredEntity>
20+
</entity>
21+
<entity name="AllowGuestCheckoutNo" type="guest_checkout">
22+
<data key="value">0</data>
23+
</entity>
24+
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
10+
<operation name="AllowGuestCheckoutConfig" dataType="allow_guest_checkout_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/checkout/" method="POST">
11+
<object key="groups" dataType="allow_guest_checkout_config">
12+
<object key="options" dataType="allow_guest_checkout_config">
13+
<object key="fields" dataType="allow_guest_checkout_config">
14+
<object key="guest_checkout" dataType="guest_checkout">
15+
<field key="value">string</field>
16+
</object>
17+
</object>
18+
</object>
19+
</object>
20+
</operation>
21+
</operations>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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="addOptionsToAttributeActionGroup">
12+
<arguments>
13+
<argument name="option1" defaultValue="colorProductAttribute2"/>
14+
<argument name="option2" defaultValue="colorDefaultProductAttribute1"/>
15+
<argument name="option3" defaultValue="colorProductAttribute3"/>
16+
<argument name="option4" defaultValue="colorProductAttribute1"/>
17+
<argument name="option5" defaultValue="colorDefaultProductAttribute2"/>
18+
</arguments>
19+
<!--Add option 1 to attribute-->
20+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption1"/>
21+
<waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('1')}}" time="30" stepKey="waitForOptionRow1" after="clickAddOption1"/>
22+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('0')}}" userInput="{{option1.name}}" stepKey="fillAdminLabel1" after="waitForOptionRow1"/>
23+
<!--Add option 2 to attribute-->
24+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption2" after="fillAdminLabel1"/>
25+
<waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('2')}}" time="30" stepKey="waitForOptionRow2" after="clickAddOption2"/>
26+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('1')}}" userInput="{{option2.name}}" stepKey="fillAdminLabel2" after="waitForOptionRow2"/>
27+
<!--Add option 3 to attribute-->
28+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption3" after="fillAdminLabel2"/>
29+
<waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('3')}}" time="30" stepKey="waitForOptionRow3" after="clickAddOption3"/>
30+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('2')}}" userInput="{{option3.name}}" stepKey="fillAdminLabel3" after="waitForOptionRow3"/>
31+
<!--Add option 4 to attribute-->
32+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption4" after="fillAdminLabel3"/>
33+
<waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('4')}}" time="30" stepKey="waitForOptionRow4" after="clickAddOption4"/>
34+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('3')}}" userInput="{{option4.name}}" stepKey="fillAdminLabel4" after="waitForOptionRow4"/>
35+
<!--Add option 5 to attribute-->
36+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickAddOption5" after="fillAdminLabel4"/>
37+
<waitForElementVisible selector="{{AdminNewAttributePanel.isDefault('5')}}" time="30" stepKey="waitForOptionRow5" after="clickAddOption5"/>
38+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('4')}}" userInput="{{option5.name}}" stepKey="fillAdminLabel5" after="waitForOptionRow5"/>
39+
<!--Save attribute-->
40+
<click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickSaveAttribute" after="fillAdminLabel5"/>
41+
<waitForPageLoad stepKey="waitForSavingAttribute"/>
42+
<see userInput="You saved the product attribute." stepKey="seeSuccessMessage"/>
43+
</actionGroup>
44+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<element name="applySingleQuantityToEachSkus" type="radio" selector=".admin__field-label[for='apply-single-inventory-radio']" timeout="30"/>
3838
<element name="quantity" type="input" selector="#apply-single-inventory-input"/>
3939
<element name="gridLoadingMask" type="text" selector="[data-role='spinner'][data-component*='product_attributes_listing']"/>
40+
<element name="attributeCheckboxByName" type="input" selector="//*[contains(@data-attribute-option-title,'{{arg}}')]//input[@type='checkbox']" parameterized="true"/>
4041
<element name="attributeColorCheckbox" type="select" selector="//div[contains(text(),'color') and @class='data-grid-cell-content']/../preceding-sibling::td/label/input"/>
4142
</section>
4243
</sections>

0 commit comments

Comments
 (0)