Skip to content

Commit 7fff0a1

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into AC10982
2 parents 10c7f0e + d3511ca commit 7fff0a1

File tree

26 files changed

+688
-75
lines changed

26 files changed

+688
-75
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddProductCustomOptionActionGroup.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

9-
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<!-- Add custom option, title and type -->
1212
<actionGroup name="AdminAddProductCustomOptionActionGroup">
@@ -17,9 +17,10 @@
1717
<argument name="customOptionTitle" type="string"/>
1818
<argument name="customOptionType" type="string"/>
1919
</arguments>
20-
20+
2121
<scrollTo selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="scrollToCustomizableOptionsSection"/>
2222
<waitForPageLoad stepKey="waitForScrolling"/>
23+
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/>
2324
<click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/>
2425
<waitForPageLoad stepKey="waitForAddProductPageLoad"/>
2526
<fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionTitle}}"/>

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -475,5 +475,16 @@
475475
<data key="is_filterable_in_grid">true</data>
476476
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
477477
</entity>
478+
<entity name="productAttributeAgeGroupDropdown" type="ProductAttribute">
479+
<data key="default_frontend_label" unique="suffix">Age Group</data>
480+
<data key="attribute_code" unique="suffix">agegroup</data>
481+
<data key="frontend_input">select</data>
482+
<data key="scope">website</data>
483+
<data key="is_required">false</data>
484+
<data key="is_unique">false</data>
485+
<data key="is_searchable">false</data>
486+
<data key="is_used_for_promo_rules">true</data>
487+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
488+
</entity>
478489
</entities>
479490

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -125,4 +125,16 @@
125125
<data key="sort_order">3</data>
126126
<requiredEntity type="StoreLabel">Option14Store1</requiredEntity>
127127
</entity>
128+
<entity name="productAttributeOptionAdult" type="ProductAttributeOption">
129+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
130+
<data key="label">Adult</data>
131+
<data key="is_default">false</data>
132+
<data key="sort_order">0</data>
133+
</entity>
134+
<entity name="productAttributeOptionChildren" type="ProductAttributeOption">
135+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
136+
<data key="label">children</data>
137+
<data key="is_default">false</data>
138+
<data key="sort_order">0</data>
139+
</entity>
128140
</entities>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -91,6 +91,6 @@
9191
<element name="customTextAttribute" type="input" selector="//input[@name='product[{{attribute_code}}]']" parameterized="true"/>
9292
<element name="customSelectAttribute" type="select" selector="//select[@name='product[{{attribute_code}}]']" parameterized="true"/>
9393
<element name="customSwitcherAttribute" type="checkbox" selector="//input[@name='product[{{attribute_code}}]' and @value='{{checked_value}}']/parent::div[@data-role='switcher']" parameterized="true"/>
94-
94+
<element name="attributeOptionUncheckDefaultValue" type="checkbox" selector="input[name='use_default[{{attribute_code}}]']" parameterized="true"/>
9595
</section>
9696
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontVerifySingleProductCatalogPriceRuleAcrossWebsitesTest">
11+
<annotations>
12+
<features value="CatalogRule"/>
13+
<stories value="Apply catalog price rule"/>
14+
<title value="Catalog rule should apply for product on multiple websites"/>
15+
<description value="Testcase verifies On storefront catalog price rule applied for product on multiple websites"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-7409"/>
18+
</annotations>
19+
<before>
20+
<!--Create dropdown product attribute-->
21+
<createData entity="productAttributeAgeGroupDropdown" stepKey="createDropdownAttribute"/>
22+
<!--Create attribute options-->
23+
<createData entity="productAttributeOptionAdult" stepKey="createFirstAttributeOption">
24+
<requiredEntity createDataKey="createDropdownAttribute"/>
25+
</createData>
26+
<createData entity="productAttributeOptionChildren" stepKey="createSecondAttributeOption">
27+
<requiredEntity createDataKey="createDropdownAttribute"/>
28+
</createData>
29+
<!--Add attribute to default attribute set-->
30+
<createData entity="AddToDefaultSet" stepKey="addAttributeToDefaultSet">
31+
<requiredEntity createDataKey="createDropdownAttribute"/>
32+
</createData>
33+
<!-- Create Simple Product -->
34+
<createData entity="SimpleProduct" stepKey="createProduct">
35+
<field key="price">100.00</field>
36+
</createData>
37+
<!-- Login as Admin -->
38+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
39+
<!--Create custom website -->
40+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createCustomWebsite">
41+
<argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/>
42+
<argument name="websiteCode" value="{{NewWebSiteData.code}}"/>
43+
</actionGroup>
44+
<!-- Create custom store-->
45+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createCustomStore">
46+
<argument name="website" value="{{NewWebSiteData.name}}"/>
47+
<argument name="storeGroupName" value="{{NewWebSiteData.name}}"/>
48+
<argument name="storeGroupCode" value="{{NewWebSiteData.code}}"/>
49+
</actionGroup>
50+
<!-- Create custom store view-->
51+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
52+
<argument name="StoreGroup" value="NewWebSiteData"/>
53+
<argument name="customStore" value="NewWebSiteData"/>
54+
</actionGroup>
55+
</before>
56+
<after>
57+
<!--set main website as default-->
58+
<actionGroup ref="AdminSetDefaultWebsiteActionGroup" stepKey="setMainWebsiteAsDefault">
59+
<argument name="websiteName" value="Main Website"/>
60+
</actionGroup>
61+
<!-- Delete product -->
62+
<deleteData createDataKey="createProduct" stepKey="deleteFirstProduct"/>
63+
<deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/>
64+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteCustomWebsite">
65+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
66+
</actionGroup>
67+
<!-- Delete created price rules -->
68+
<actionGroup ref="RemoveCatalogPriceRuleActionGroup" stepKey="deleteCatalogPriceRule">
69+
<argument name="ruleName" value="{{_defaultCatalogRule.name}}"/>
70+
</actionGroup>
71+
<!-- Logout -->
72+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
73+
</after>
74+
<!--Assign product to custom website-->
75+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
76+
<argument name="productId" value="$$createProduct.id$$"/>
77+
</actionGroup>
78+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
79+
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct">
80+
<argument name="website" value="{{NewWebSiteData.name}}"/>
81+
</actionGroup>
82+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
83+
<!--Switch scope to Default store view-->
84+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchDefaultStoreView">
85+
<argument name="storeViewName" value="'Default Store View'"/>
86+
</actionGroup>
87+
<uncheckOption selector="{{AdminProductFormSection.attributeOptionUncheckDefaultValue('$$createDropdownAttribute.attribute_code$$')}}" stepKey="unCheckDefaultValueInDefaultStoreview"/>
88+
<selectOption selector="{{AdminProductFormSection.customSelectAttribute('$$createDropdownAttribute.attribute_code$$')}}" userInput="Adult" stepKey="selectValueForAttributeInDefaultStoreview"/>
89+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductInDefaultStoreView"/>
90+
<!--Switch scope to custom store view-->
91+
<actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchScopeToCustomStoreView">
92+
<argument name="storeViewName" value="{{NewWebSiteData.name}}"/>
93+
</actionGroup>
94+
<uncheckOption selector="{{AdminProductFormSection.attributeOptionUncheckDefaultValue('$$createDropdownAttribute.attribute_code$$')}}" stepKey="unCheckDefaultValueInCustomStoreview"/>
95+
<selectOption selector="{{AdminProductFormSection.customSelectAttribute('$$createDropdownAttribute.attribute_code$$')}}" userInput="children" stepKey="selectValueForAttributeInCustomStoreview"/>
96+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductInCustomStoreView"/>
97+
<!-- create catalog price with 50% discount and condition -->
98+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/>
99+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForSecondCatalogPriceRule">
100+
<argument name="websites" value="'Main Website',{{NewWebSiteData.name}}"/>
101+
</actionGroup>
102+
<actionGroup ref="AdminFillCatalogRuleConditionWithSelectAttributeActionGroup" stepKey="fillConditionsForCatalogPriceRule">
103+
<argument name="condition" value="$$createDropdownAttribute.default_frontend_label$$"/>
104+
<argument name="conditionValue" value="Adult"/>
105+
</actionGroup>
106+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
107+
<argument name="discountAmount" value="50"/>
108+
</actionGroup>
109+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
110+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
111+
<argument name="indices" value=""/>
112+
</actionGroup>
113+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
114+
<argument name="tags" value="config full_page"/>
115+
</actionGroup>
116+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductOnStorefront">
117+
<argument name="product" value="$$createProduct$$"/>
118+
</actionGroup>
119+
<waitForText selector="{{StorefrontProductInfoMainSection.updatedPrice}}" userInput="$50.00" stepKey="assertProductPriceAmountOnMainWebsite"/>
120+
<actionGroup ref="AdminSetDefaultWebsiteActionGroup" stepKey="setSecondaryWebsiteAsDefault">
121+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
122+
</actionGroup>
123+
<!-- Clean config and full page cache-->
124+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
125+
<argument name="tags" value="config full_page"/>
126+
</actionGroup>
127+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductOnStorefront">
128+
<argument name="product" value="$$createProduct$$"/>
129+
</actionGroup>
130+
<waitForText selector="{{StorefrontProductInfoMainSection.updatedPrice}}" userInput="$100.00" stepKey="assertProductPriceAmountOnCustomWebsite"/>
131+
</test>
132+
</tests>

app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontFillFormAdvancedSearchActionGroup.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -17,11 +17,17 @@
1717
<argument name="price_from" type="string" defaultValue=""/>
1818
<argument name="price_to" type="string" defaultValue=""/>
1919
</arguments>
20+
<clearField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" stepKey="clearName"/>
2021
<fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ProductName}}" userInput="{{productName}}" stepKey="fillName"/>
22+
<clearField selector="{{StorefrontCatalogSearchAdvancedFormSection.SKU}}" stepKey="clearSku"/>
2123
<fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.SKU}}" userInput="{{sku}}" stepKey="fillSku"/>
24+
<clearField selector="{{StorefrontCatalogSearchAdvancedFormSection.Description}}" stepKey="clearDescription"/>
2225
<fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.Description}}" userInput="{{description}}" stepKey="fillDescription"/>
26+
<clearField selector="{{StorefrontCatalogSearchAdvancedFormSection.ShortDescription}}" stepKey="clearShortDescription"/>
2327
<fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.ShortDescription}}" userInput="{{short_description}}" stepKey="fillShortDescription"/>
28+
<clearField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceFrom}}" stepKey="clearPriceFrom"/>
2429
<fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceFrom}}" userInput="{{price_from}}" stepKey="fillPriceFrom"/>
30+
<clearField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceTo}}" stepKey="clearPriceTo"/>
2531
<fillField selector="{{StorefrontCatalogSearchAdvancedFormSection.PriceTo}}" userInput="{{price_to}}" stepKey="fillPriceTo"/>
2632
<scrollTo selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="scrollToSubmitButton"/>
2733
<click selector="{{StorefrontCatalogSearchAdvancedFormSection.SubmitButton}}" stepKey="clickSubmit"/>

app/code/Magento/Cron/Console/Command/CronCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
2+
23
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
4+
* Copyright 2017 Adobe
5+
* All Rights Reserved.
56
*/
67

78
namespace Magento\Cron\Console\Command;
@@ -135,10 +136,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
135136
$params[ProcessCronQueueObserver::STANDALONE_PROCESS_STARTED] = $bootstrapOptionValue;
136137
}
137138
}
139+
138140
/** @var Cron $cronObserver */
139141
$cronObserver = $objectManager->create(Cron::class, ['parameters' => $params]);
140142
$cronObserver->launch();
141-
$output->writeln('<info>' . 'Ran jobs by schedule.' . '</info>');
143+
144+
// phpcs:ignore Magento2.Functions.DiscouragedFunction.Discouraged,Magento2.Exceptions.TryProcessSystemResources.MissingTryCatch
145+
if (stream_isatty(STDOUT)) {
146+
$output->writeln('<info>' . 'Ran jobs by schedule.' . '</info>');
147+
}
142148

143149
return Cli::RETURN_SUCCESS;
144150
}

app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2016 Adobe
4+
* All Rights Reserved.
55
*/
66

77
/**
@@ -278,10 +278,12 @@ function ($a, $b) {
278278
&& $this->getCronGroupConfigurationValue($groupId, 'use_separate_process') == 1
279279
) {
280280
$this->_shell->execute(
281-
$phpPath . ' %s cron:run --group=' . $groupId . ' --' . Cli::INPUT_KEY_BOOTSTRAP . '='
281+
'%s %s cron:run --group=%s --' . Cli::INPUT_KEY_BOOTSTRAP . '='
282282
. self::STANDALONE_PROCESS_STARTED . '=1',
283283
[
284-
BP . '/bin/magento'
284+
$phpPath,
285+
BP . '/bin/magento',
286+
$groupId,
285287
]
286288
);
287289
continue;
@@ -848,7 +850,7 @@ private function processPendingJobs(string $groupId, array $jobsRoot, int $curre
848850
/** @var Schedule $schedule */
849851
foreach ($pendingJobs as $schedule) {
850852
if (isset($processedJobs[$schedule->getJobCode()])) {
851-
// process only on job per run
853+
// process only one of each job per run
852854
continue;
853855
}
854856
$jobConfig = isset($jobsRoot[$schedule->getJobCode()]) ? $jobsRoot[$schedule->getJobCode()] : null;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* Copyright 2017 Adobe
5+
* All Rights Reserved.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace Magento\Cron\Shell;
11+
12+
use Magento\Framework\App\Filesystem\DirectoryList;
13+
use Magento\Framework\Filesystem;
14+
use Magento\Framework\OsInfo;
15+
use Magento\Framework\Shell\CommandRenderer;
16+
17+
class CommandRendererBackground extends CommandRenderer
18+
{
19+
/**
20+
* @param Filesystem $filesystem
21+
* @param OsInfo $osInfo
22+
*/
23+
public function __construct(
24+
private readonly Filesystem $filesystem,
25+
private readonly OsInfo $osInfo,
26+
) {
27+
}
28+
29+
/**
30+
* @inheritDoc
31+
*/
32+
public function render($command, array $arguments = []): string
33+
{
34+
$command = parent::render($command, $arguments);
35+
36+
$logFile = '/dev/null';
37+
if ($groupId = $arguments[2] ?? null) {
38+
$logDir = $this->filesystem->getDirectoryRead(DirectoryList::LOG)->getAbsolutePath();
39+
// @phpcs:ignore Magento2.Functions.DiscouragedFunction.Discouraged
40+
$logFile = escapeshellarg($logDir . 'magento.cron.' . $groupId . '.log');
41+
}
42+
43+
return $this->osInfo->isWindows() ?
44+
'start /B "magento background task" ' . $command
45+
: str_replace('2>&1', ">> $logFile 2>&1 &", $command);
46+
}
47+
}

app/code/Magento/Cron/Test/Unit/Console/Command/CronCommandTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
2+
23
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
4+
* Copyright 2017 Adobe
5+
* All Rights Reserved.
56
*/
7+
68
declare(strict_types=1);
79

810
namespace Magento\Cron\Test\Unit\Console\Command;
@@ -80,7 +82,7 @@ public function testExecute()
8082
new CronCommand($this->objectManagerFactory, $this->deploymentConfigMock)
8183
);
8284
$commandTester->execute([]);
83-
$expectedMsg = 'Ran jobs by schedule.' . PHP_EOL;
85+
$expectedMsg = '';
8486
$this->assertEquals($expectedMsg, $commandTester->getDisplay());
8587
}
8688
}

0 commit comments

Comments
 (0)