Skip to content

Commit 426f064

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop
- merged latest code from mainline branch
2 parents fea9c82 + 79b58c9 commit 426f064

File tree

14 files changed

+469
-42
lines changed

14 files changed

+469
-42
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<argument name="selector" type="string"/>
1717
<argument name="userInput" type="string"/>
1818
</arguments>
19-
19+
20+
<waitForElementVisible selector="{{selector}}" time="60" stepKey="waitForElementVisible"/>
2021
<see selector="{{selector}}" userInput="{{userInput}}" stepKey="assertElement"/>
2122
</actionGroup>
2223
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<argument name="qty" type="string"/>
2020
</arguments>
2121

22+
<waitForElementVisible selector="{{CheckoutCartProductSection.productName}}" time="60" stepKey="waitForProductNameVisible"/>
2223
<see selector="{{CheckoutCartProductSection.productName}}" userInput="{{productName}}" stepKey="seeProductNameInCheckoutSummary"/>
2324
<see selector="{{CheckoutCartProductSection.ProductPriceByName(productName)}}" userInput="{{productPrice}}" stepKey="seeProductPriceInCart"/>
2425
<see selector="{{CheckoutCartProductSection.productSubtotalByName(productName)}}" userInput="{{subtotal}}" stepKey="seeSubtotalPrice"/>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1010
<test name="StorefrontAddBundleDynamicProductToShoppingCartTest">
1111
<annotations>
12+
<features value="Checkout"/>
1213
<stories value="Shopping Cart"/>
1314
<title value="Add bundle dynamic product to the cart"/>
1415
<description value="Add bundle dynamic product to the cart"/>
@@ -18,6 +19,7 @@
1819
</annotations>
1920

2021
<before>
22+
<magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/>
2123
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2224
<magentoCLI command="config:set {{EnableFlatRateDefaultPriceConfigData.path}} {{EnableFlatRateDefaultPriceConfigData.value}}" stepKey="enableFlatRateDefaultPrice"/>
2325
<createData entity="SimpleSubCategory" stepKey="createSubCategory"/>
@@ -46,19 +48,23 @@
4648
<requiredEntity createDataKey="createBundleOption1_1"/>
4749
<requiredEntity createDataKey="simpleProduct2"/>
4850
</createData>
49-
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
50-
<magentoCLI command="cache:flush" stepKey="flushCache"/>
51+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
52+
<actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/>
53+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
54+
<argument name="indices" value="cataloginventory_stock"/>
55+
</actionGroup>
5156
</before>
5257
<after>
5358
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
5459
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
5560
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
5661
<deleteData createDataKey="createSubCategory" stepKey="deleteCategory"/>
62+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/>
5763
</after>
5864

5965
<!--Open Product page in StoreFront -->
6066
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct">
61-
<argument name="product" value="$$createBundleProduct$$"/>
67+
<argument name="product" value="$createBundleProduct$"/>
6268
</actionGroup>
6369

6470
<!--Assert Product Price Range -->
@@ -93,8 +99,8 @@
9399

94100
<!--Assert Product items in cart -->
95101
<actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertSimpleProduct1ItemsInCheckOutCart">
96-
<argument name="productName" value="$$createBundleProduct.name$$"/>
97-
<argument name="productSku" value="$$createBundleProduct.sku$$"/>
102+
<argument name="productName" value="$createBundleProduct.name$"/>
103+
<argument name="productSku" value="$createBundleProduct.sku$"/>
98104
<argument name="productPrice" value="$50.00"/>
99105
<argument name="subtotal" value="$100.00" />
100106
<argument name="qty" value="2"/>
@@ -107,13 +113,13 @@
107113
</actionGroup>
108114
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductOptionInCart">
109115
<argument name="selector" value="{{CheckoutCartProductSection.productOptionLabel}}"/>
110-
<argument name="userInput" value="1 x $$simpleProduct2.name$$ $50.00"/>
116+
<argument name="userInput" value="1 x $simpleProduct2.name$ $50.00"/>
111117
</actionGroup>
112118

113119
<!-- Assert Product in Mini Cart -->
114120
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/>
115121
<actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="assertSimpleProduct3MiniCart">
116-
<argument name="productName" value="$$createBundleProduct.name$$"/>
122+
<argument name="productName" value="$createBundleProduct.name$"/>
117123
<argument name="productPrice" value="$50.00"/>
118124
<argument name="cartSubtotal" value="$100.00" />
119125
<argument name="qty" value="2"/>

app/code/Magento/Developer/Model/Logger/Handler/Debug.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug
2121
*/
2222
private $state;
2323

24-
/**
25-
* @var ScopeConfigInterface
26-
*/
27-
private $scopeConfig;
28-
2924
/**
3025
* @var DeploymentConfig
3126
*/
@@ -34,22 +29,19 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug
3429
/**
3530
* @param DriverInterface $filesystem
3631
* @param State $state
37-
* @param ScopeConfigInterface $scopeConfig
3832
* @param DeploymentConfig $deploymentConfig
3933
* @param string $filePath
4034
* @throws \Exception
4135
*/
4236
public function __construct(
4337
DriverInterface $filesystem,
4438
State $state,
45-
ScopeConfigInterface $scopeConfig,
4639
DeploymentConfig $deploymentConfig,
4740
$filePath = null
4841
) {
4942
parent::__construct($filesystem, $filePath);
5043

5144
$this->state = $state;
52-
$this->scopeConfig = $scopeConfig;
5345
$this->deploymentConfig = $deploymentConfig;
5446
}
5547

app/code/Magento/Developer/Model/Logger/Handler/Syslog.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ class Syslog extends \Magento\Framework\Logger\Handler\Syslog
2929
private $deploymentConfig;
3030

3131
/**
32-
* @param ScopeConfigInterface $scopeConfig Scope config
3332
* @param DeploymentConfig $deploymentConfig Deployment config
3433
* @param string $ident The string ident to be added to each message
35-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3634
*/
3735
public function __construct(
38-
ScopeConfigInterface $scopeConfig,
3936
DeploymentConfig $deploymentConfig,
4037
string $ident
4138
) {

app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/SyslogTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ protected function setUp(): void
4444
$this->deploymentConfigMock = $this->createMock(DeploymentConfig::class);
4545

4646
$this->model = new Syslog(
47-
$this->scopeConfigMock,
4847
$this->deploymentConfigMock,
4948
'Magento'
5049
);
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Rule\Test\Mftf\Helper;
9+
10+
use Facebook\WebDriver\Remote\RemoteWebDriver as FacebookWebDriver;
11+
use Facebook\WebDriver\WebDriverBy;
12+
use Magento\FunctionalTestingFramework\Helper\Helper;
13+
use Magento\FunctionalTestingFramework\Module\MagentoWebDriver;
14+
15+
/**
16+
* Class for MFTF helpers for CatalogRule module.
17+
*/
18+
class RuleHelper extends Helper
19+
{
20+
/**
21+
* Delete all Catalog Price Rules obe by one.
22+
*
23+
* @param string $emptyRow
24+
* @param string $modalAceptButton
25+
* @param string $deleteButton
26+
* @param string $successMessageContainer
27+
* @param string $successMessage
28+
*
29+
* @return void
30+
*/
31+
public function deleteAllRulesOneByOne(
32+
string $firstNotEmptyRow,
33+
string $modalAcceptButton,
34+
string $deleteButton,
35+
string $successMessageContainer,
36+
string $successMessage
37+
): void {
38+
try {
39+
/** @var MagentoWebDriver $webDriver */
40+
$magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');
41+
/** @var FacebookWebDriver $webDriver */
42+
$webDriver = $magentoWebDriver->webDriver;
43+
$rows = $webDriver->findElements(WebDriverBy::cssSelector($firstNotEmptyRow));
44+
while (!empty($rows)) {
45+
$rows[0]->click();
46+
$magentoWebDriver->waitForPageLoad(30);
47+
$magentoWebDriver->click($deleteButton);
48+
$magentoWebDriver->waitForPageLoad(30);
49+
$magentoWebDriver->waitForElementVisible($modalAcceptButton, 10);
50+
$magentoWebDriver->waitForPageLoad(60);
51+
$magentoWebDriver->click($modalAcceptButton);
52+
$magentoWebDriver->waitForPageLoad(60);
53+
$magentoWebDriver->waitForLoadingMaskToDisappear();
54+
$magentoWebDriver->waitForElementVisible($successMessageContainer, 10);
55+
$magentoWebDriver->see($successMessage, $successMessageContainer);
56+
$rows = $webDriver->findElements(WebDriverBy::cssSelector($firstNotEmptyRow));
57+
}
58+
} catch (\Exception $e) {
59+
$this->fail($e->getMessage());
60+
}
61+
}
62+
}
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/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCartPriceRuleDeleteAllActionGroup">
11+
<annotations>
12+
<description>Open Cart Price Rule grid and delete all rules one by one. Need to avoid interference with other tests that test cart price rules.</description>
13+
</annotations>
14+
15+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToAdminCartPriceRuleGridPage"/>
16+
<!-- It sometimes is loading too long for default 10s -->
17+
<waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/>
18+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/>
19+
<helper class="\Magento\Rule\Test\Mftf\Helper\RuleHelper" method="deleteAllRulesOneByOne" stepKey="deleteAllRulesOneByOne">
20+
<argument name="firstNotEmptyRow">{{AdminDataGridTableSection.firstNotEmptyRow}}</argument>
21+
<argument name="modalAcceptButton">{{AdminConfirmationModalSection.ok}}</argument>
22+
<argument name="deleteButton">{{AdminMainActionsSection.delete}}</argument>
23+
<argument name="successMessageContainer">{{AdminMessagesSection.success}}</argument>
24+
<argument name="successMessage">You deleted the rule.</argument>
25+
</helper>
26+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
27+
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
28+
</actionGroup>
29+
</actionGroups>

dev/tests/api-functional/testsuite/Magento/Search/Api/SearchTest.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,24 @@ class SearchTest extends WebapiAbstract
2424
*/
2525
private $product;
2626

27+
/**
28+
* @inheritDoc
29+
*/
2730
protected function setUp(): void
2831
{
2932
$productSku = 'simple';
3033

3134
$objectManager = Bootstrap::getObjectManager();
32-
$productRepository = $objectManager->create(ProductRepositoryInterface::class);
35+
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
3336
$this->product = $productRepository->get($productSku);
3437
}
3538

3639
/**
37-
* @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
40+
* Tests that webapi call returns response when search criteria is valid.
41+
*
42+
* @magentoApiDataFixture Magento/Catalog/_files/products.php
3843
*/
39-
public function testExistingProductSearch()
44+
public function testExistingProductSearch(): void
4045
{
4146
$productName = $this->product->getName();
4247

@@ -47,14 +52,16 @@ public function testExistingProductSearch()
4752

4853
self::assertArrayHasKey('search_criteria', $response);
4954
self::assertArrayHasKey('items', $response);
50-
self::assertGreaterThan(0, count($response['items']));
55+
self::assertGreaterThan(1, count($response['items']));
5156
self::assertGreaterThan(0, $response['items'][0]['id']);
5257
}
5358

5459
/**
55-
* @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
60+
* Tests that response is empty if invalid data is provided.
61+
*
62+
* @magentoApiDataFixture Magento/Catalog/_files/products.php
5663
*/
57-
public function testNonExistentProductSearch()
64+
public function testNonExistentProductSearch(): void
5865
{
5966
$searchCriteria = $this->buildSearchCriteria('nonExistentProduct');
6067
$serviceInfo = $this->buildServiceInfo($searchCriteria);

lib/internal/Magento/Framework/Cache/LockGuardedCacheLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function lockedLoadData(
116116
callable $dataSaver
117117
) {
118118
$cachedData = $dataLoader(); //optimistic read
119-
$deadline = microtime(true) + $this->loadTimeout / 100;
119+
$deadline = microtime(true) + $this->loadTimeout / 1000;
120120

121121
if (empty($this->allowParallelGenerationConfigValue)) {
122122
$cacheConfig = $this

0 commit comments

Comments
 (0)