Skip to content

Commit

Permalink
Merge branch 'jquery-upgrade' of github.com:magento-lynx/magento2ce i…
Browse files Browse the repository at this point in the history
…nto MC-42049_fix_keydown_and_keyup
  • Loading branch information
eliseacornejo committed May 25, 2021
2 parents f4e745c + 84a457b commit dc9ff50
Show file tree
Hide file tree
Showing 18 changed files with 541 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ define([
closed: function () {
var doc = self.iframe.get(0).document;

if (doc && $.isFunction(doc.execCommand)) {
if (doc && typeof doc.execCommand === 'function') {
//IE9 break script loading but not execution on iframe removing
doc.execCommand('stop');
self.iframe.remove();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">

<actionGroup name="StorefrontCartPageCheckMapMessagePresentAndClickableActionGroup">
<annotations>
<description>
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.
</description>
</annotations>
<!-- Confirm that the MAP message and help link are visible -->
<see selector="{{StorefrontCartMapSection.mapNotice}}" userInput="See price before order confirmation." stepKey="seeMsrpNotice"/>
<see selector="{{StorefrontCartMapSection.mapWhatsThis}}" userInput="What's this?" stepKey="seeMsrpNoticeHelpLink"/>
<!-- Confirm that clicking on the 'What's this?' link shows the help popup -->
<click selector="{{StorefrontCartMapSection.mapWhatsThis}}" stepKey="clickOnWhatsThisLink"/>
<waitForElementVisible selector="{{StorefrontCartMapSection.mapWhatsThisPopup}}" stepKey="waitForTheInfoMessage"/>
<!-- Confirm that clicking on X button closes the popup -->
<click selector="{{StorefrontCartMapSection.mapWhatsThisPopupClose}}" stepKey="clickOnCloseInfoMessage"/>
<waitForElementNotVisible selector="{{StorefrontCartMapSection.mapWhatsThisPopup}}" stepKey="waitForTheInfoMessageToClose"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontCartMapSection">
<element name="mapNotice" type="text" selector=".msrp.notice"/>
<element name="mapWhatsThis" type="text" selector=".msrp .action.help.map"/>
<element name="mapWhatsThisPopup" type="text" selector="//div[@id='map-popup-text-what-this']"/>
<element name="mapWhatsThisPopupClose" type="text" selector=".popup button.action.close"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontVerifyMapMessagePopupOnCartViewPageTest">
<annotations>
<stories value="Shopping Cart"/>
<features value="Checkout"/>
<title value="Minimum Advertised Price 'What's this?' popup does not displays in cart"/>
<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."/>
<testCaseId value="MC-41596"/>
<useCaseId value="MC-41494"/>
<severity value="MAJOR"/>
<group value="shoppingCart"/>
<group value="checkout"/>
</annotations>
<before>
<!-- Enable MAP functionality in Magento Instance -->
<createData entity="MsrpEnableMAP" stepKey="enableMAP"/>
<!-- Create product and category -->
<createData entity="_defaultCategory" stepKey="category"/>
<createData entity="SimpleProduct" stepKey="product">
<requiredEntity createDataKey="category"/>
</createData>
</before>
<after>
<!-- Disable MAP functionality in Magento Instance -->
<createData entity="MsrpDisableMAP" stepKey="disableMAP"/>
<!-- Delete product and category -->
<deleteData createDataKey="product" stepKey="deleteSimpleProduct"/>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
</after>

<!-- Add MAP to the newly created product Advanced Pricing -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openAdminProductEditPage">
<argument name="productId" value="$$product.id$$"/>
</actionGroup>
<actionGroup ref="AdminAddMinimumAdvertisedPriceActionGroup" stepKey="setMapToCreatedProduct">
<argument name="msrpData" value="MsrpBeforeOrderConfirmation"/>
</actionGroup>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>

<!--Adding the newly created product to shopping cart.-->
<actionGroup ref="StorefrontNavigateToCategoryUrlActionGroup" stepKey="goToCategoryPageOnFrontEnd">
<argument name="categoryUrl" value="$category.custom_attributes[url_key]$"/>
</actionGroup>
<actionGroup ref="StorefrontAddSimpleProductToCartActionGroup" stepKey="addProductToCart">
<argument name="product" value="$product$"/>
</actionGroup>

<!-- Navigate to the cart edit page -->
<actionGroup ref="clickViewAndEditCartFromMiniCartActionGroup" stepKey="goToCartViewAndEditPage"/>

<!-- Check if MAP message and link are present and functioning -->
<actionGroup ref="StorefrontCartPageCheckMapMessagePresentAndClickableActionGroup" stepKey="checkFormMapFunctioning"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
<a href="#" class="action help map"
id="<?= ($block->escapeHtmlAttr($helpLinkId)) ?>"
data-mage-init='{"addToCart":{
"origin": "info",
"helpLinkId": "#<?= $block->escapeJs($block->escapeHtml($helpLinkId)) ?>",
"productName": "<?= $block->escapeJs($block->escapeHtml($product->getName())) ?>",
"showAddToCart": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ define([
customAttributesObject;

$.each(addrs, function (key) {
if (addrs.hasOwnProperty(key) && !$.isFunction(addrs[key])) {
if (addrs.hasOwnProperty(key) && typeof addrs[key] !== 'function') {
output[self.toUnderscore(key)] = addrs[key];
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCheckoutMiniCartSubtotalMatchesAfterRemoveProductFromCartTest">
<annotations>
<features value="Multishipping"/>
<stories value="Multiple Shipping"/>
<title value="Check mini shopping cart Subtotal Price matches with the View Cart subtotal price after remove product from cart"/>
<description value="Verify mini shopping cart Subtotal Price matches with the View Cart subtotal price after remove product from cart"/>
<severity value="MAJOR"/>
<testCaseId value="MC-42067"/>
<useCaseId value="MC-41924"/>
<group value="Multishipment"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
<createData entity="SimpleProduct" stepKey="createdSimpleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="Customer_US_UK_DE" stepKey="createCustomerWithMultipleAddresses"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
<deleteData createDataKey="createdSimpleProduct" stepKey="deleteCreatedSimpleProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/>
</after>
<!-- Login to the Storefront as created customer -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
<argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/>
</actionGroup>
<!-- Open the simple product page -->
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductPage">
<argument name="product" value="$$createdSimpleProduct$$"/>
</actionGroup>
<!-- Add to Cart three times of the product -->
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart">
<argument name="productName" value="$$createdSimpleProduct.name$$"/>
<argument name="productQty" value="3"/>
</actionGroup>
<waitForPageLoad time="120" stepKey="waitForAddToCart"/>
<!-- Go to Cart Summary Section -->
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
<!-- Check Out with Multiple Addresses -->
<actionGroup ref="StorefrontCheckoutWithMultipleAddressesActionGroup" stepKey="checkoutWithMultipleAddresses"/>
<!-- Remove first simple product from cart -->
<actionGroup ref="StorefrontRemoveProductOnCheckoutActionGroup" stepKey="removeFirstProductFromCart"/>
<!-- Go back to the cart -->
<click selector="{{MultishippingSection.back}}" stepKey="backToCart"/>
<!-- Check and verify subtotals at mini cart summary section-->
<waitForPageLoad time="120" stepKey="waitForCartSummaryPageToLoad"/>
<grabTextFrom selector="{{CheckoutCartProductSection.productSubtotalByName($$createdSimpleProduct.name$$)}}" stepKey="grabTextFromProductsSubtotalField"/>
<grabTextFrom selector="{{CheckoutCartSummarySection.subTotal}}" stepKey="grabTextFromCartSubtotalField"/>
<assertEquals message="Subtotals should be equal" stepKey="assertSubtotalsFields">
<expectedResult type="variable">$grabTextFromProductsSubtotalField</expectedResult>
<actualResult type="variable">$grabTextFromCartSubtotalField</actualResult>
</assertEquals>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator;
use Magento\Paypal\Model\Payflow\Transparent;
use Magento\Sales\Api\PaymentFailuresInterface;
use Magento\Framework\Session\Generic as Session;
use Magento\Checkout\Model\Session;
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontCheckoutSelectPaypalPaymentMethodActionGroup">
<annotations>
<description>Select Paypal payment method on onepage checkout</description>
</annotations>
<arguments>
<argument name="paymentMethod" defaultValue="{{StorefrontPaypalCheckoutSection.creditCard}}" type="string"/>
</arguments>
<click selector="{{paymentMethod}}" stepKey="selectPaypalPaymentMethod"/>
<waitForPageLoad stepKey="waitForPaypalFormLoad"/>
<scrollTo selector="{{paymentMethod}}" stepKey="scrollToCreditCardSection"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Magento\Framework\DataObject;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Registry;
use Magento\Framework\Session\Generic as Session;
use Magento\Checkout\Model\Session;
use Magento\Framework\View\Layout\ProcessorInterface;
use Magento\Framework\View\Result\Layout;
use Magento\Framework\View\Result\LayoutFactory;
Expand Down
86 changes: 86 additions & 0 deletions app/code/Magento/Sales/Model/Grid/LastUpdateTimeCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Sales\Model\Grid;

use Magento\Framework\App\CacheInterface;

/**
* Cache for last grid update time.
*/
class LastUpdateTimeCache
{
/**
* Prefix for cache key.
*/
private const CACHE_PREFIX = 'LAST_GRID_UPDATE_TIME';

/**
* @var CacheInterface
*/
private $cache;

/**
* @param CacheInterface $cache
*/
public function __construct(CacheInterface $cache)
{
$this->cache = $cache;
}

/**
* Save last grid update time.
*
* @param string $gridTableName
* @param string $lastUpdatedAt
* @return void
*/
public function save(string $gridTableName, string $lastUpdatedAt): void
{
$this->cache->save(
$lastUpdatedAt,
$this->getCacheKey($gridTableName),
[],
3600
);
}

/**
* Get last grid update time.
*
* @param string $gridTableName
* @return string|null
*/
public function get(string $gridTableName): ?string
{
$lastUpdatedAt = $this->cache->load($this->getCacheKey($gridTableName));

return $lastUpdatedAt ?: null;
}

/**
* Remove last grid update time.
*
* @param string $gridTableName
* @return void
*/
public function remove(string $gridTableName): void
{
$this->cache->remove($this->getCacheKey($gridTableName));
}

/**
* Generate cache key.
*
* @param string $gridTableName
* @return string
*/
private function getCacheKey(string $gridTableName): string
{
return self::CACHE_PREFIX . ':' . $gridTableName;
}
}
Loading

0 comments on commit dc9ff50

Please sign in to comment.