Skip to content

Commit e3975c6

Browse files
committed
Merge remote-tracking branch 'upstream/2.4-develop' into 2.4-develop
2 parents 63550be + b1ef766 commit e3975c6

File tree

267 files changed

+8174
-946
lines changed

Some content is hidden

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

267 files changed

+8174
-946
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AdminFillSearchTermActionGroup">
12+
<annotations>
13+
<description>Fills the search terms form with sample data.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="searchQuery" type="string"/>
17+
<argument name="store" type="string"/>
18+
<argument name="redirectUrl" type="string"/>
19+
<argument name="suggestedTerms" type="string"/>
20+
</arguments>
21+
<!-- Fill form fields -->
22+
<fillField selector="{{AdminSearchTermsPageFormFieldsSection.query_text}}" userInput="{{searchQuery}}" stepKey="fillFieldSearchQuery"/>
23+
<selectOption selector="{{AdminSearchTermsPageFormFieldsSection.store_id}}" userInput="{{store}}" stepKey="selectStoreView"/>
24+
<fillField selector="{{AdminSearchTermsPageFormFieldsSection.redirect}}" userInput="{{redirectUrl}}" stepKey="fillFieldRedirectUrl"/>
25+
<selectOption selector="{{AdminSearchTermsPageFormFieldsSection.display_in_terms}}" userInput="{{suggestedTerms}}" stepKey="selectSuggestedTerms" />
26+
</actionGroup>
27+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AdminOpenNewSearchTermsPageActionGroup">
12+
<annotations>
13+
<description>Navigate to search terms form page.</description>
14+
</annotations>
15+
<amOnPage url="{{AdminSearchTermsFormPage.url}}" stepKey="amOnSearchTermsForm"/>
16+
<waitForPageLoad stepKey="waitForPageLoad1"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AdminSaveSearchTermActionGroup">
12+
<annotations>
13+
<description>Save a new search term from Magento admin.</description>
14+
</annotations>
15+
<!-- Click save action and verify success message -->
16+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveSearchButton"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="SearchTerms">
12+
<data key="searchQuery" unique="suffix">books</data>
13+
<data key="store">Default Store View</data>
14+
<data key="redirectUrl">http://sample.com</data>
15+
<data key="suggestedTerms">1</data>
16+
</entity>
17+
</entities>
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminSearchTermsFormPage" url="search/term/new/" area="admin" module="Magento_AdvancedSearch">
12+
<section name="AdminSearchTermsPageFormFieldsSection"/>
13+
</page>
14+
</pages>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="AdminSearchTermsPageFormFieldsSection">
12+
<element name="query_text" type="input" selector="#query_text"/>
13+
<element name="store_id" type="select" selector="#store_id"/>
14+
<element name="redirect" type="input" selector="#redirect"/>
15+
<element name="display_in_terms" type="select" selector="#display_in_terms"/>
16+
</section>
17+
</sections>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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="AdminAddSearchTermTest">
12+
<annotations>
13+
<features value="AdvancedSearch"/>
14+
<stories value="Add a new search term"/>
15+
<title value="Admin should be able to create a new search term"/>
16+
<description value="Admin should be able to create a new search term using search terms grid"/>
17+
<severity value="CRITICAL"/>
18+
<group value="AdvancedSearch"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
25+
</after>
26+
<actionGroup ref="AdminOpenNewSearchTermsPageActionGroup" stepKey="navigateToSearchTermPage"/>
27+
<actionGroup ref="AdminFillSearchTermActionGroup" stepKey="fillNewSearchTermData">
28+
<argument name="searchQuery" value="{{SearchTerms.searchQuery}}"/>
29+
<argument name="store" value="{{SearchTerms.store}}"/>
30+
<argument name="redirectUrl" value="{{SearchTerms.redirectUrl}}"/>
31+
<argument name="suggestedTerms" value="{{SearchTerms.suggestedTerms}}"/>
32+
</actionGroup>
33+
<actionGroup ref="AdminSaveSearchTermActionGroup" stepKey="saveSearchTerm"/>
34+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSaveSearchTermSuccessMessage">
35+
<argument name="message" value="You saved the search term."/>
36+
<argument name="messageType" value="success"/>
37+
</actionGroup>
38+
</test>
39+
</tests>

app/code/Magento/Backend/Test/Mftf/Data/GeneralLocalConfigsData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@
2020
<data key="scope_code">base</data>
2121
<data key="value">en_US</data>
2222
</entity>
23+
<entity name="GeneralLocalCodeConfigsForMexico">
24+
<data key="path">general/locale/code</data>
25+
<data key="scope">websites</data>
26+
<data key="scope_code">base</data>
27+
<data key="value">es_MX</data>
28+
</entity>
2329
</entities>

app/code/Magento/Catalog/Helper/Output.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function productAttribute($product, $attributeHtml, $attributeName)
182182
if ($attributeHtml !== null
183183
&& $attribute->getIsHtmlAllowedOnFront()
184184
&& $attribute->getIsWysiwygEnabled()
185-
&& $this->isDirectivesExists($attributeHtml)
185+
&& $this->isDirectivesExists((string)$attributeHtml)
186186
) {
187187
$attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
188188
}
@@ -219,7 +219,7 @@ public function categoryAttribute($category, $attributeHtml, $attributeName)
219219
if ($attributeHtml !== null
220220
&& $attribute->getIsHtmlAllowedOnFront()
221221
&& $attribute->getIsWysiwygEnabled()
222-
&& $this->isDirectivesExists($attributeHtml)
222+
&& $this->isDirectivesExists((string)$attributeHtml)
223223

224224
) {
225225
$attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml);
@@ -238,7 +238,7 @@ public function categoryAttribute($category, $attributeHtml, $attributeName)
238238
* @param string $attributeHtml
239239
* @return bool
240240
*/
241-
public function isDirectivesExists($attributeHtml)
241+
public function isDirectivesExists(string $attributeHtml): bool
242242
{
243243
$matches = false;
244244
foreach ($this->directivePatterns as $pattern) {
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="AdminCatalogPriceRuleDeleteAllActionGroup">
11+
<annotations>
12+
<description>Open Catalog Price Rule grid and delete all rules one by one. Need to avoid interference with other tests that test catalog price rules.</description>
13+
</annotations>
14+
15+
<amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage"/>
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\CatalogRule\Test\Mftf\Helper\CatalogPriceRuleHelper" method="deleteAllCatalogPriceRules" stepKey="deleteAllCatalogPriceRulesOneByOne">
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>
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\CatalogRule\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 CatalogPriceRuleHelper 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 deleteAllCatalogPriceRules(
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+
}

app/code/Magento/Checkout/CustomerData/DefaultItem.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface;
1111

1212
/**
13-
* Default item
13+
* Default cart item
1414
*/
1515
class DefaultItem extends AbstractItem
1616
{
@@ -78,7 +78,7 @@ public function __construct(
7878
}
7979

8080
/**
81-
* {@inheritdoc}
81+
* @inheritdoc
8282
*/
8383
protected function doGetItemData()
8484
{
@@ -106,6 +106,7 @@ protected function doGetItemData()
106106
],
107107
'canApplyMsrp' => $this->msrpHelper->isShowBeforeOrderConfirm($this->item->getProduct())
108108
&& $this->msrpHelper->isMinimalPriceLessMsrp($this->item->getProduct()),
109+
'message' => $this->item->getMessage(),
109110
];
110111
}
111112

@@ -121,6 +122,8 @@ protected function getOptionList()
121122
}
122123

123124
/**
125+
* Returns product for thumbnail.
126+
*
124127
* @return \Magento\Catalog\Model\Product
125128
* @codeCoverageIgnore
126129
*/
@@ -130,6 +133,8 @@ protected function getProductForThumbnail()
130133
}
131134

132135
/**
136+
* Returns product.
137+
*
133138
* @return \Magento\Catalog\Model\Product
134139
* @codeCoverageIgnore
135140
*/

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@
2929
<createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule">
3030
<requiredEntity createDataKey="createCartPriceRule"/>
3131
</createData>
32+
33+
<!-- Login as admin -->
34+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
3235
</before>
3336
<after>
3437
<!-- Delete simple product -->
3538
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
36-
3739
<!-- Delete sales rule -->
3840
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/>
39-
41+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/>
4042
<!-- Admin log out -->
4143
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4244
</after>
4345

4446
<!-- Go to Storefront as Guest and add simple product to cart -->
4547
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
46-
<argument name="product" value="$$createProduct$$"/>
48+
<argument name="product" value="$createProduct$"/>
4749
</actionGroup>
4850

4951
<!-- Go to Checkout -->
@@ -56,16 +58,18 @@
5658

5759
<!-- Click Apply Discount Code: section is expanded. Input promo code, apply and see success message -->
5860
<actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon">
59-
<argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/>
61+
<argument name="discountCode" value="$createCouponForCartPriceRule.code$"/>
6062
</actionGroup>
6163

6264
<!-- Apply button is disappeared -->
6365
<dontSeeElement selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="dontSeeApplyButton"/>
6466

6567
<!-- Cancel coupon button is appeared -->
68+
<waitForElementVisible selector="{{DiscountSection.CancelCouponBtn}}" stepKey="waitCancelButtonAppears"/>
6669
<seeElement selector="{{DiscountSection.CancelCouponBtn}}" stepKey="seeCancelCouponButton"/>
6770

6871
<!-- Order summary contains information about applied code -->
72+
<waitForElementVisible selector="{{CheckoutPaymentSection.discount}}" stepKey="waitForDiscountCouponInSummaryBlock"/>
6973
<seeElement selector="{{CheckoutPaymentSection.discount}}" stepKey="seeDiscountCouponInSummaryBlock"/>
7074
<see selector="{{CheckoutPaymentSection.discountPrice}}" userInput="-$5.00" stepKey="seeDiscountPrice"/>
7175

@@ -76,16 +80,13 @@
7680
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
7781
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
7882

79-
<!-- Login as admin -->
80-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
81-
8283
<!-- Verify total on order page -->
8384
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderById">
84-
<argument name="orderId" value="$grabOrderNumber"/>
85+
<argument name="orderId" value="{$grabOrderNumber}"/>
8586
</actionGroup>
8687

8788
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
8889
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
89-
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$$createProduct.price$$" stepKey="checkTotal"/>
90+
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$createProduct.price$" stepKey="checkTotal"/>
9091
</test>
9192
</tests>

0 commit comments

Comments
 (0)