Skip to content

Commit

Permalink
Merge branch '2.4-develop' into fix-admin-area-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Hotel authored Nov 14, 2024
2 parents 39c1afc + 651928c commit 1fd0a36
Show file tree
Hide file tree
Showing 274 changed files with 5,996 additions and 25,322 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminAddRestrictedRoleForGlobalSearchActionGroup" extends="AdminCreateRoleActionGroup">
<remove keyForRemoval="navigateToNewRole"/>
<remove keyForRemoval="waitForPageLoad1"/>
<remove keyForRemoval="fillRoleName"/>
<remove keyForRemoval="enterPassword"/>
<remove keyForRemoval="clickRoleResourcesTab"/>
<remove keyForRemoval="waitForScopeSelection"/>
<remove keyForRemoval="clickSaveRoleButton"/>
<remove keyForRemoval="waitForPageLoad2"/>
<remove keyForRemoval="clickCheckbox"/>
<scrollTo selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}" x="0" y="-120" stepKey="scrollToResourceElement" after="selectResourceAccessCustom"/>
<click stepKey="clickTFACheckbox" selector="{{AdminEditRoleInfoSection.checkboxByRole('Magento_TwoFactorAuth::tfa')}}" after="waitForTfaRole"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

Expand All @@ -17,8 +19,8 @@
<severity value="MAJOR" />
<description value="Check login with restrict role."/>
<group value="login"/>
<group value="pr_exclude"/>
<group value="cloud"/>
<group value="pr_exclude"/>
</annotations>

<before>
Expand All @@ -29,7 +31,7 @@
<argument name="restrictedRole" value="Global Search"/>
</actionGroup>
<actionGroup ref="AdminUserClickRoleResourceTabActionGroup" stepKey="switchToRoleResourceTab"/>
<actionGroup ref="AdminAddRestrictedRoleActionGroup" stepKey="addRestrictedRoleStores">
<actionGroup ref="AdminAddRestrictedRoleForGlobalSearchActionGroup" stepKey="addRestrictedRoleStores">
<argument name="User" value="adminRole"/>
<argument name="restrictedRole" value="Global Search"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright 2024 Adobe
* All Rights Reserved.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontVerifyDiscountOnDynamicBundleProductDifferentCartRulesTest">
<annotations>
<features value="Bundle"/>
<stories value="Discount on dynamic bundle products with different Cart Rules"/>
<title value="Verify dynamic bundle product prices with different Cart Rules on storefront"/>
<description value="Verify discount on dynamic-priced Bundle Product when associated Products are assigned to Categories with different Cart Rules"/>
<severity value="MAJOR"/>
<testCaseId value="AC-4709"/>
</annotations>
<before>
<createData entity="SimpleSubCategory" stepKey="createFirstCategory"/>
<createData entity="SimpleSubCategory" stepKey="createSecondCategory"/>
<!--Create two simple product-->
<createData entity="ApiSimpleProduct" stepKey="simpleProduct1">
<requiredEntity createDataKey="createFirstCategory"/>
<field key="price">99.99</field>
</createData>
<createData entity="ApiSimpleProduct" stepKey="simpleProduct2">
<requiredEntity createDataKey="createSecondCategory"/>
<field key="price">34.49</field>
</createData>
<!--Create Bundle product-->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
<requiredEntity createDataKey="createFirstCategory"/>
</createData>
<createData entity="MultipleSelectOption" stepKey="createBundleOption1">
<requiredEntity createDataKey="createBundleProduct"/>
<field key="required">true</field>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1"/>
<requiredEntity createDataKey="simpleProduct1"/>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1"/>
<requiredEntity createDataKey="simpleProduct2"/>
</createData>
</before>
<after>
<deleteData createDataKey="createFirstCategory" stepKey="deleteFirstCategory"/>
<deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule">
<argument name="ruleName" value="{{CustomSalesRuleWithNoCouponCode.name}}"/>
</actionGroup>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<!-- Create cart price rule -->
<actionGroup ref="AdminCreateCartPriceRuleActionGroup" stepKey="createCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode"/>
</actionGroup>
<!-- Search and go to cart price rule page -->
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCreatedCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
</actionGroup>
<actionGroup ref="AdminCreateCustomConditionInCartPriceRuleActionGroup" stepKey="createCustomCondition"/>
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveAndAssertCartPriceRuleSuccessSaveMessage"/>
<!-- Open Bundle Product page on storefront-->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage">
<argument name="productUrl" value="$createBundleProduct.custom_attributes[url_key]$"/>
</actionGroup>
<!-- Click on customize And Add To Cart Button -->
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickOnCustomizeAndAddToCartButton"/>
<!-- Select Two Products, enter the quantity and add product to the cart -->
<selectOption selector="{{StorefrontBundledSection.multiSelectOption}}" parameterArray="[$$simpleProduct1.name$$ +$99.99, $$simpleProduct2.name$$ +$34.49]" stepKey="selectOptions"/>
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
<argument name="quantity" value="1"/>
</actionGroup>
<!-- Go to shopping cart page -->
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
<argument name="discount" value="13.45"/>
</actionGroup>
<!-- Search and go to cart price rule page and remove condition-->
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="goToCartPriceRulePage"/>
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
</actionGroup>
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
<waitForElementClickable selector="{{AdminCartPriceRulesFormSection.removeCondition('1--1')}}" stepKey="waitForRemoveToBeClickable"/>
<click selector="{{AdminCartPriceRulesFormSection.removeCondition('1--1')}}" stepKey="removeCondition"/>
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveCartPriceRuleSuccessSaveMessage"/>
<!-- Go to shopping cart page -->
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToShoppingCartPage"/>
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="checkDiscount">
<argument name="discount" value="13.45"/>
</actionGroup>
<!-- Assign category 1 to simple product 2 and unAssign category2 -->
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="OpenSimpleProductPage">
<argument name="productId" value="$$simpleProduct2.id$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unAssignCategoryTwo">
<argument name="categoryName" value="$$createSecondCategory.name$$"/>
</actionGroup>
<createData entity="AssignProductToCategory" stepKey="assignCategoryOne">
<requiredEntity createDataKey="createFirstCategory"/>
<requiredEntity createDataKey="simpleProduct2"/>
</createData>
<!-- Search and go to cart price rule page and add condition in action tab -->
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="againOpenCartPriceRulePage"/>
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="againFilterCartPriceRule">
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
</actionGroup>
<actionGroup ref="AdminCreateCustomConditionInActionTabInCartPriceRuleActionGroup" stepKey="createConditionInActionsTab"/>
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveCartPriceRule"/>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule"/>
</actionGroup>
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
<argument name="tags" value="config full_page"/>
</actionGroup>
<!-- Go to shopping cart page -->
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="againGoToShoppingCartPage"/>
<waitForElementNotVisible selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="discountIsNotApplied"/>
</test>
</tests>
7 changes: 3 additions & 4 deletions app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2024 Adobe
* All Rights Reserved.
*/

/**
Expand Down Expand Up @@ -392,8 +392,7 @@ protected function _getNodeJson($node, $level = 0)
$item['id'] = $node->getId();
$item['store'] = (int)$this->getStore()->getId();
$item['path'] = $node->getData('path');

$item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
$item['a_attr'] = ['class' => $node->getIsActive() ? 'active-category' : 'not-active-category'];
//$item['allowDrop'] = ($level<3) ? true : false;
$allowMove = $this->_isCategoryMoveable($node);
$item['allowDrop'] = $allowMove;
Expand Down
9 changes: 4 additions & 5 deletions app/code/Magento/Catalog/Model/CategoryRepository.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/

namespace Magento\Catalog\Model;
Expand Down Expand Up @@ -149,7 +148,7 @@ public function save(CategoryInterface $category)
*/
public function get($categoryId, $storeId = null)
{
$cacheKey = $storeId ?? 'all';
$cacheKey = $storeId ?? $this->storeManager->getStore()->getId();
if (!isset($this->instances[$categoryId][$cacheKey])) {
/** @var Category $category */
$category = $this->categoryFactory->create();
Expand Down Expand Up @@ -231,7 +230,7 @@ protected function validateCategory(Category $category)
* Lazy loader for the converter.
*
* @return ExtensibleDataObjectConverter
*
* phpcs:disable Magento2.Annotation.MethodAnnotationStructure
* @deprecated 101.0.0
* @see we don't recommend this approach anymore
*/
Expand Down
12 changes: 3 additions & 9 deletions app/code/Magento/Catalog/Model/ResourceModel/Category.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2011 Adobe
* All Rights Reserved.
*/

/**
Expand Down Expand Up @@ -37,8 +37,6 @@ class Category extends AbstractResource implements ResetAfterRequestInterface
protected $_tree;

/**
* Catalog products table name
*
* @var string
*/
protected $_categoryProductTable;
Expand All @@ -49,15 +47,11 @@ class Category extends AbstractResource implements ResetAfterRequestInterface
private $entitiesWhereAttributesIs;

/**
* Id of 'is_active' category attribute
*
* @var int
*/
protected $_isActiveAttributeId = null;

/**
* Id of store
*
* @var int
*/
protected $_storeId = null;
Expand Down Expand Up @@ -455,7 +449,7 @@ protected function _saveCategoryProducts($category)
'position' => (int)$position,
];
}
$connection->insertMultiple($this->getCategoryProductTable(), $data);
$connection->insertOnDuplicate($this->getCategoryProductTable(), $data, ['position']);
}

/**
Expand Down
Loading

0 comments on commit 1fd0a36

Please sign in to comment.