Skip to content

Commit 0dd29c5

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr114
2 parents 18fd2af + 84a808e commit 0dd29c5

File tree

56 files changed

+1626
-383
lines changed

Some content is hidden

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

56 files changed

+1626
-383
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</annotations>
1515

1616
<seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/>
17+
<scrollToTopOfPage stepKey="scrollToTopOfTheCategoryPage"/>
1718
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveCategory"/>
1819
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageAppears"/>
1920
<see userInput="You saved the category." selector="{{AdminMessagesSection.success}}" stepKey="assertSuccessMessage"/>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontProductAbsentOnCategoryPageActionGroup">
12+
<annotations>
13+
<description>Navigate to category page and verify product is absent.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="categoryUrlKey" defaultValue="{{_defaultCategory.url_key}}"/>
17+
<argument name="productName" defaultValue="{{SimpleProduct.name}}"/>
18+
</arguments>
19+
20+
<amOnPage url="{{StorefrontCategoryPage.url(categoryUrlKey)}}" stepKey="navigateToCategoryPage"/>
21+
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
22+
<dontSee selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{productName}}" stepKey="assertProductIsNotPresent"/>
23+
</actionGroup>
24+
</actionGroups>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="StorefrontAssertProductAbsentOnCategoryPageActionGroup">
1212
<annotations>
13-
<description>Navigate to category page and verify product is absent.</description>
13+
<description>DEPRECATED. Please use AssertStorefrontProductAbsentOnCategoryPageActionGroup instead.
14+
Navigate to category page and verify product is absent.</description>
1415
</annotations>
1516
<arguments>
1617
<argument name="category" defaultValue="_defaultCategory"/>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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\Catalog\ViewModel\Product\Listing;
9+
10+
use Magento\Framework\View\Element\Block\ArgumentInterface;
11+
use Magento\Framework\App\ActionInterface;
12+
use Magento\Framework\Url\Helper\Data as UrlHelper;
13+
14+
/**
15+
* Check is available add to compare.
16+
*/
17+
class PreparePostData implements ArgumentInterface
18+
{
19+
/**
20+
* @var UrlHelper
21+
*/
22+
private $urlHelper;
23+
24+
/**
25+
* @param UrlHelper $urlHelper
26+
*/
27+
public function __construct(UrlHelper $urlHelper)
28+
{
29+
$this->urlHelper = $urlHelper;
30+
}
31+
32+
/**
33+
* Wrapper for the PostHelper::getPostData()
34+
*
35+
* @param string $url
36+
* @param array $data
37+
* @return array
38+
*/
39+
public function getPostData(string $url, array $data = []):array
40+
{
41+
if (!isset($data[ActionInterface::PARAM_NAME_URL_ENCODED])) {
42+
$data[ActionInterface::PARAM_NAME_URL_ENCODED] = $this->urlHelper->getEncodedUrl();
43+
}
44+
return ['action' => $url, 'data' => $data];
45+
}
46+
}

app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
<block class="Magento\Catalog\Block\Product\ProductList\Related" name="catalog.product.related" template="Magento_Catalog::product/list/items.phtml">
177177
<arguments>
178178
<argument name="type" xsi:type="string">related</argument>
179+
<argument name="view_model" xsi:type="object">Magento\Catalog\ViewModel\Product\Listing\PreparePostData</argument>
179180
</arguments>
180181
<block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="related.product.addto" as="addto">
181182
<block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
@@ -186,6 +187,7 @@
186187
<block class="Magento\Catalog\Block\Product\ProductList\Upsell" name="product.info.upsell" template="Magento_Catalog::product/list/items.phtml">
187188
<arguments>
188189
<argument name="type" xsi:type="string">upsell</argument>
190+
<argument name="view_model" xsi:type="object">Magento\Catalog\ViewModel\Product\Listing\PreparePostData</argument>
189191
</arguments>
190192
<block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="upsell.product.addto" as="addto">
191193
<block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"

0 commit comments

Comments
 (0)