Skip to content

Commit 212d69a

Browse files
authored
Merge pull request #6849 from magento-l3/TANGO_PR-05-11-2021_24
TANGO PR 05-11-2021 v24
2 parents 5ba21f0 + 17fca68 commit 212d69a

File tree

15 files changed

+537
-59
lines changed

15 files changed

+537
-59
lines changed
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
11+
<actionGroup name="StorefrontCartPageCheckMapMessagePresentAndClickableActionGroup">
12+
<annotations>
13+
<description>
14+
Assert that the MAP message is present on the product listing in the cart, and What's this? link is clickable and bring up the info popup.
15+
</description>
16+
</annotations>
17+
<!-- Confirm that the MAP message and help link are visible -->
18+
<see selector="{{StorefrontCartMapSection.mapNotice}}" userInput="See price before order confirmation." stepKey="seeMsrpNotice"/>
19+
<see selector="{{StorefrontCartMapSection.mapWhatsThis}}" userInput="What's this?" stepKey="seeMsrpNoticeHelpLink"/>
20+
<!-- Confirm that clicking on the 'What's this?' link shows the help popup -->
21+
<click selector="{{StorefrontCartMapSection.mapWhatsThis}}" stepKey="clickOnWhatsThisLink"/>
22+
<waitForElementVisible selector="{{StorefrontCartMapSection.mapWhatsThisPopup}}" stepKey="waitForTheInfoMessage"/>
23+
<!-- Confirm that clicking on X button closes the popup -->
24+
<click selector="{{StorefrontCartMapSection.mapWhatsThisPopupClose}}" stepKey="clickOnCloseInfoMessage"/>
25+
<waitForElementNotVisible selector="{{StorefrontCartMapSection.mapWhatsThisPopup}}" stepKey="waitForTheInfoMessageToClose"/>
26+
</actionGroup>
27+
</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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontCartMapSection">
12+
<element name="mapNotice" type="text" selector=".msrp.notice"/>
13+
<element name="mapWhatsThis" type="text" selector=".msrp .action.help.map"/>
14+
<element name="mapWhatsThisPopup" type="text" selector="//div[@id='map-popup-text-what-this']"/>
15+
<element name="mapWhatsThisPopupClose" type="text" selector=".popup button.action.close"/>
16+
</section>
17+
</sections>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="StorefrontVerifyMapMessagePopupOnCartViewPageTest">
10+
<annotations>
11+
<stories value="Shopping Cart"/>
12+
<features value="Checkout"/>
13+
<title value="Minimum Advertised Price 'What's this?' popup does not displays in cart"/>
14+
<description value="When Minimum Advertised Price (MAP) is enabled and the product has MAP set in Advanced Pricing, click on 'What's this?' at the product listing in the shopping cart must display the popup with the info message."/>
15+
<testCaseId value="MC-41596"/>
16+
<useCaseId value="MC-41494"/>
17+
<severity value="MAJOR"/>
18+
<group value="shoppingCart"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Enable MAP functionality in Magento Instance -->
23+
<createData entity="MsrpEnableMAP" stepKey="enableMAP"/>
24+
<!-- Create product and category -->
25+
<createData entity="_defaultCategory" stepKey="category"/>
26+
<createData entity="SimpleProduct" stepKey="product">
27+
<requiredEntity createDataKey="category"/>
28+
</createData>
29+
</before>
30+
<after>
31+
<!-- Disable MAP functionality in Magento Instance -->
32+
<createData entity="MsrpDisableMAP" stepKey="disableMAP"/>
33+
<!-- Delete product and category -->
34+
<deleteData createDataKey="product" stepKey="deleteSimpleProduct"/>
35+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
36+
</after>
37+
38+
<!-- Add MAP to the newly created product Advanced Pricing -->
39+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
40+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminProductEditPage">
41+
<argument name="productId" value="$$product.id$$"/>
42+
</actionGroup>
43+
<actionGroup ref="AdminAddMinimumAdvertisedPriceActionGroup" stepKey="setMapToCreatedProduct">
44+
<argument name="msrpData" value="MsrpBeforeOrderConfirmation"/>
45+
</actionGroup>
46+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
47+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>
48+
49+
<!--Adding the newly created product to shopping cart.-->
50+
<actionGroup ref="StorefrontNavigateToCategoryUrlActionGroup" stepKey="goToCategoryPageOnFrontEnd">
51+
<argument name="categoryUrl" value="$category.custom_attributes[url_key]$"/>
52+
</actionGroup>
53+
<actionGroup ref="StorefrontAddSimpleProductToCartActionGroup" stepKey="addProductToCart">
54+
<argument name="product" value="$product$"/>
55+
</actionGroup>
56+
57+
<!-- Navigate to the cart edit page -->
58+
<actionGroup ref="clickViewAndEditCartFromMiniCartActionGroup" stepKey="goToCartViewAndEditPage"/>
59+
60+
<!-- Check if MAP message and link are present and functioning -->
61+
<actionGroup ref="StorefrontCartPageCheckMapMessagePresentAndClickableActionGroup" stepKey="checkFormMapFunctioning"/>
62+
</test>
63+
</tests>

app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
7878
<a href="#" class="action help map"
7979
id="<?= ($block->escapeHtmlAttr($helpLinkId)) ?>"
8080
data-mage-init='{"addToCart":{
81+
"origin": "info",
8182
"helpLinkId": "#<?= $block->escapeJs($block->escapeHtml($helpLinkId)) ?>",
8283
"productName": "<?= $block->escapeJs($block->escapeHtml($product->getName())) ?>",
8384
"showAddToCart": false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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="StorefrontCheckoutMiniCartSubtotalMatchesAfterRemoveProductFromCartTest">
12+
<annotations>
13+
<features value="Multishipping"/>
14+
<stories value="Multiple Shipping"/>
15+
<title value="Check mini shopping cart Subtotal Price matches with the View Cart subtotal price after remove product from cart"/>
16+
<description value="Verify mini shopping cart Subtotal Price matches with the View Cart subtotal price after remove product from cart"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-42067"/>
19+
<useCaseId value="MC-41924"/>
20+
<group value="Multishipment"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
25+
<createData entity="SimpleProduct" stepKey="createdSimpleProduct">
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
<createData entity="Customer_US_UK_DE" stepKey="createCustomerWithMultipleAddresses"/>
29+
</before>
30+
<after>
31+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
32+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
33+
<deleteData createDataKey="createdSimpleProduct" stepKey="deleteCreatedSimpleProduct"/>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/>
36+
</after>
37+
<!-- Login to the Storefront as created customer -->
38+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
39+
<argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/>
40+
</actionGroup>
41+
<!-- Open the simple product page -->
42+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductPage">
43+
<argument name="product" value="$$createdSimpleProduct$$"/>
44+
</actionGroup>
45+
<!-- Add to Cart three times of the product -->
46+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
47+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart">
48+
<argument name="productName" value="$$createdSimpleProduct.name$$"/>
49+
<argument name="productQty" value="3"/>
50+
</actionGroup>
51+
<waitForPageLoad time="120" stepKey="waitForAddToCart"/>
52+
<!-- Go to Cart Summary Section -->
53+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
54+
<!-- Check Out with Multiple Addresses -->
55+
<actionGroup ref="StorefrontCheckoutWithMultipleAddressesActionGroup" stepKey="checkoutWithMultipleAddresses"/>
56+
<!-- Remove first simple product from cart -->
57+
<actionGroup ref="StorefrontRemoveProductOnCheckoutActionGroup" stepKey="removeFirstProductFromCart"/>
58+
<!-- Go back to the cart -->
59+
<click selector="{{MultishippingSection.back}}" stepKey="backToCart"/>
60+
<!-- Check and verify subtotals at mini cart summary section-->
61+
<waitForPageLoad time="120" stepKey="waitForCartSummaryPageToLoad"/>
62+
<grabTextFrom selector="{{CheckoutCartProductSection.productSubtotalByName($$createdSimpleProduct.name$$)}}" stepKey="grabTextFromProductsSubtotalField"/>
63+
<grabTextFrom selector="{{CheckoutCartSummarySection.subTotal}}" stepKey="grabTextFromCartSubtotalField"/>
64+
<assertEquals message="Subtotals should be equal" stepKey="assertSubtotalsFields">
65+
<expectedResult type="variable">$grabTextFromProductsSubtotalField</expectedResult>
66+
<actualResult type="variable">$grabTextFromCartSubtotalField</actualResult>
67+
</assertEquals>
68+
</test>
69+
</tests>

app/code/Magento/Paypal/Controller/Transparent/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator;
1919
use Magento\Paypal\Model\Payflow\Transparent;
2020
use Magento\Sales\Api\PaymentFailuresInterface;
21-
use Magento\Framework\Session\Generic as Session;
21+
use Magento\Checkout\Model\Session;
2222
use Magento\Framework\App\Action\HttpPostActionInterface;
2323

2424
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="StorefrontCheckoutSelectPaypalPaymentMethodActionGroup">
12+
<annotations>
13+
<description>Select Paypal payment method on onepage checkout</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="paymentMethod" defaultValue="{{StorefrontPaypalCheckoutSection.creditCard}}" type="string"/>
17+
</arguments>
18+
<click selector="{{paymentMethod}}" stepKey="selectPaypalPaymentMethod"/>
19+
<waitForPageLoad stepKey="waitForPaypalFormLoad"/>
20+
<scrollTo selector="{{paymentMethod}}" stepKey="scrollToCreditCardSection"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Paypal/Test/Unit/Controller/Transparent/ResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Framework\DataObject;
1414
use Magento\Framework\Exception\LocalizedException;
1515
use Magento\Framework\Registry;
16-
use Magento\Framework\Session\Generic as Session;
16+
use Magento\Checkout\Model\Session;
1717
use Magento\Framework\View\Layout\ProcessorInterface;
1818
use Magento\Framework\View\Result\Layout;
1919
use Magento\Framework\View\Result\LayoutFactory;
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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\Sales\Model\Grid;
9+
10+
use Magento\Framework\App\CacheInterface;
11+
12+
/**
13+
* Cache for last grid update time.
14+
*/
15+
class LastUpdateTimeCache
16+
{
17+
/**
18+
* Prefix for cache key.
19+
*/
20+
private const CACHE_PREFIX = 'LAST_GRID_UPDATE_TIME';
21+
22+
/**
23+
* @var CacheInterface
24+
*/
25+
private $cache;
26+
27+
/**
28+
* @param CacheInterface $cache
29+
*/
30+
public function __construct(CacheInterface $cache)
31+
{
32+
$this->cache = $cache;
33+
}
34+
35+
/**
36+
* Save last grid update time.
37+
*
38+
* @param string $gridTableName
39+
* @param string $lastUpdatedAt
40+
* @return void
41+
*/
42+
public function save(string $gridTableName, string $lastUpdatedAt): void
43+
{
44+
$this->cache->save(
45+
$lastUpdatedAt,
46+
$this->getCacheKey($gridTableName),
47+
[],
48+
3600
49+
);
50+
}
51+
52+
/**
53+
* Get last grid update time.
54+
*
55+
* @param string $gridTableName
56+
* @return string|null
57+
*/
58+
public function get(string $gridTableName): ?string
59+
{
60+
$lastUpdatedAt = $this->cache->load($this->getCacheKey($gridTableName));
61+
62+
return $lastUpdatedAt ?: null;
63+
}
64+
65+
/**
66+
* Remove last grid update time.
67+
*
68+
* @param string $gridTableName
69+
* @return void
70+
*/
71+
public function remove(string $gridTableName): void
72+
{
73+
$this->cache->remove($this->getCacheKey($gridTableName));
74+
}
75+
76+
/**
77+
* Generate cache key.
78+
*
79+
* @param string $gridTableName
80+
* @return string
81+
*/
82+
private function getCacheKey(string $gridTableName): string
83+
{
84+
return self::CACHE_PREFIX . ':' . $gridTableName;
85+
}
86+
}

app/code/Magento/Sales/Model/ResourceModel/Grid.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
use Magento\Framework\App\ObjectManager;
99
use Magento\Framework\DB\Adapter\AdapterInterface;
1010
use Magento\Framework\Model\ResourceModel\Db\Context;
11+
use Magento\Sales\Model\Grid\LastUpdateTimeCache;
1112
use Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProviderInterface;
1213

1314
/**
14-
* Class Grid
15+
* Sales order grid resource model.
1516
*/
1617
class Grid extends AbstractGrid
1718
{
@@ -45,6 +46,11 @@ class Grid extends AbstractGrid
4546
*/
4647
private $notSyncedDataProvider;
4748

49+
/**
50+
* @var LastUpdateTimeCache
51+
*/
52+
private $lastUpdateTimeCache;
53+
4854
/**
4955
* Order grid rows batch size
5056
*/
@@ -58,7 +64,8 @@ class Grid extends AbstractGrid
5864
* @param array $joins
5965
* @param array $columns
6066
* @param string $connectionName
61-
* @param NotSyncedDataProviderInterface $notSyncedDataProvider
67+
* @param NotSyncedDataProviderInterface|null $notSyncedDataProvider
68+
* @param LastUpdateTimeCache|null $lastUpdateTimeCache
6269
*/
6370
public function __construct(
6471
Context $context,
@@ -68,15 +75,19 @@ public function __construct(
6875
array $joins = [],
6976
array $columns = [],
7077
$connectionName = null,
71-
NotSyncedDataProviderInterface $notSyncedDataProvider = null
78+
NotSyncedDataProviderInterface $notSyncedDataProvider = null,
79+
LastUpdateTimeCache $lastUpdateTimeCache = null
7280
) {
7381
$this->mainTableName = $mainTableName;
7482
$this->gridTableName = $gridTableName;
7583
$this->orderIdField = $orderIdField;
7684
$this->joins = $joins;
7785
$this->columns = $columns;
78-
$this->notSyncedDataProvider =
79-
$notSyncedDataProvider ?: ObjectManager::getInstance()->get(NotSyncedDataProviderInterface::class);
86+
$this->notSyncedDataProvider = $notSyncedDataProvider ??
87+
ObjectManager::getInstance()->get(NotSyncedDataProviderInterface::class);
88+
$this->lastUpdateTimeCache = $lastUpdateTimeCache ??
89+
ObjectManager::getInstance()->get(LastUpdateTimeCache::class);
90+
8091
parent::__construct($context, $connectionName);
8192
}
8293

@@ -118,6 +129,7 @@ public function refresh($value, $field = null)
118129
*/
119130
public function refreshBySchedule()
120131
{
132+
$lastUpdatedAt = null;
121133
$notSyncedIds = $this->notSyncedDataProvider->getIds($this->mainTableName, $this->gridTableName);
122134
foreach (array_chunk($notSyncedIds, self::BATCH_SIZE) as $bunch) {
123135
$select = $this->getGridOriginSelect()->where($this->mainTableName . '.entity_id IN (?)', $bunch);
@@ -127,6 +139,15 @@ public function refreshBySchedule()
127139
$fetchResult,
128140
array_keys($this->columns)
129141
);
142+
143+
$timestamps = array_column($fetchResult, 'updated_at');
144+
if ($timestamps) {
145+
$lastUpdatedAt = max(max($timestamps), $lastUpdatedAt);
146+
}
147+
}
148+
149+
if ($lastUpdatedAt) {
150+
$this->lastUpdateTimeCache->save($this->gridTableName, $lastUpdatedAt);
130151
}
131152
}
132153

0 commit comments

Comments
 (0)