Skip to content

Commit

Permalink
Merge branch '2.4-develop' into mftf-go-to-orders-grid-page
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Kilo authored Jul 10, 2020
2 parents a86e1da + f8f1e5e commit 2f64397
Show file tree
Hide file tree
Showing 93 changed files with 2,536 additions and 725 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@
</actionGroup>

<!--Navigate to Product attribute page-->
<amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="navigateToNewProductAttributePage"/>
<fillField userInput="test_label" selector="{{AttributePropertiesSection.DefaultLabel}}" stepKey="fillDefaultLabel"/>
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="Text Swatch" stepKey="selectInputType"/>
<click selector="{{AttributePropertiesSection.addSwatch}}" stepKey="clickAddSwatch"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,20 @@ protected function _reindexRows($changedIds = [])
$productsTypes = $this->getProductsTypes($changedIds);
$parentProductsTypes = $this->getParentProductsTypes($changedIds);

$changedIds = array_merge($changedIds, ...array_values($parentProductsTypes));
$changedIds = array_unique(array_merge($changedIds, ...array_values($parentProductsTypes)));
$productsTypes = array_merge_recursive($productsTypes, $parentProductsTypes);

if ($changedIds) {
$this->deleteIndexData($changedIds);
}
foreach ($productsTypes as $productType => $entityIds) {
$indexer = $this->_getIndexer($productType);

$typeIndexers = $this->getTypeIndexers();
foreach ($typeIndexers as $productType => $indexer) {
$entityIds = $productsTypes[$productType] ?? [];
if (empty($entityIds)) {
continue;
}

if ($indexer instanceof DimensionalIndexerInterface) {
foreach ($this->dimensionCollectionFactory->create() as $dimensions) {
$this->tableMaintainer->createMainTmpTable($dimensions);
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="AdminCreateCategoryWithInactiveIncludeInMenuActionGroup" extends="CreateCategoryActionGroup">
<annotations>
<description>EXTENDS: CreateCategory. Add "disableIncludeInMenuOption" step.</description>
</annotations>
<arguments>
<argument name="categoryEntity" defaultValue="_defaultCategory"/>
</arguments>

<click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="disableIncludeInMenuOption"
after="seeCategoryPageTitle"/>
</actionGroup>
</actionGroups>
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="AdminCreateInactiveCategoryActionGroup" extends="CreateCategoryActionGroup">
<annotations>
<description>EXTENDS: CreateCategory. Add "disableCategory" step.</description>
</annotations>
<arguments>
<argument name="categoryEntity" defaultValue="_defaultCategory"/>
</arguments>

<click selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="disableCategory"
after="seeCategoryPageTitle"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AssertAdminCategoryIsInactiveActionGroup">
<annotations>
<description>Verify the category is disabled</description>
</annotations>

<dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="seeCategoryIsDisabled"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<element name="shortDescriptionTextArea" type="textarea" selector="#product_form_short_description"/>
<element name="sectionHeaderIfNotShowing" type="button" selector="//div[@data-index='content']//div[contains(@class, '_hide')]"/>
<element name="pageHeader" type="textarea" selector="//*[@class='page-header row']"/>
<element name="attributeInput" type="input" selector="input[name='product[{{attributeCode}}]']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?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="AdminChangeProductAttributeGroupTest">
<annotations>
<title value="Preserving attribute value after attribute group is changed"/>
<description value="Attribute value should be preserved after changing attribute group"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-35612"/>
<useCaseId value="MC-31892"/>
<group value="catalog"/>
</annotations>
<before>
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<createData entity="productAttributeText" stepKey="createProductAttribute"/>
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
<createData entity="CatalogAttributeSet" stepKey="createSecondAttributeSet"/>

<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$createAttributeSet.attribute_set_id$/"
stepKey="onAttributeSetEdit"/>
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup">
<argument name="group" value="Product Details"/>
<argument name="attribute" value="$createProductAttribute.attribute_code$"/>
</actionGroup>
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/>
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$createSecondAttributeSet.attribute_set_id$/"
stepKey="onSecondAttributeSetEdit"/>
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToContentGroup">
<argument name="group" value="Content"/>
<argument name="attribute" value="$createProductAttribute.attribute_code$"/>
</actionGroup>
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveSecondAttributeSet"/>
</before>
<after>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
<deleteData createDataKey="createSecondAttributeSet" stepKey="deleteSecondAttributeSet"/>
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>

<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
<argument name="product" value="$createSimpleProduct$"/>
</actionGroup>

<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct1">
<argument name="product" value="$createSimpleProduct$"/>
</actionGroup>

<actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectAttributeSet">
<argument name="attributeSetName" value="$createAttributeSet.attribute_set_name$"/>
</actionGroup>
<waitForText userInput="$createProductAttribute.default_frontend_label$" stepKey="seeAttributeInForm"/>
<fillField selector="{{AdminProductFormSection.attributeRequiredInput($createProductAttribute.attribute_code$)}}"
userInput="test"
stepKey="fillProductAttributeValue"/>
<actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectSecondAttributeSet">
<argument name="attributeSetName" value="$createSecondAttributeSet.attribute_set_name$"/>
</actionGroup>
<actionGroup ref="ExpandAdminProductSectionActionGroup" stepKey="expandContentSection"/>
<waitForText userInput="$createProductAttribute.default_frontend_label$" stepKey="seeAttributeInSection"/>
<grabValueFrom selector="{{AdminProductContentSection.attributeInput($createProductAttribute.attribute_code$)}}"
stepKey="attributeValue"/>
<assertEquals stepKey="assertAttributeValue">
<expectedResult type="string">test</expectedResult>
<actualResult type="variable">attributeValue</actualResult>
</assertEquals>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,12 @@
</after>
<!-- Create In active Category -->
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<click selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="disableCategory"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.IncludeInMenu}}" stepKey="enableIncludeInMenu"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/>
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/>
<waitForPageLoad stepKey="waitForCategorySaved"/>
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="assertSuccessMessage"/>
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" />
<dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="dontCategoryIsChecked"/>
<!--Verify InActive Category is created-->
<seeElement selector="{{AdminCategoryContentSection.categoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" />
<actionGroup ref="AdminCreateInactiveCategoryActionGroup" stepKey="createInactiveCategory"/>
<actionGroup ref="AssertAdminCategoryIsInactiveActionGroup" stepKey="seeDisabledCategory"/>
<!--Verify Category is not listed store front page-->
<amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/>
<waitForPageLoad stepKey="waitForPageToBeLoaded"/>
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="dontSeeCategoryOnStoreFrontPage"/>
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStoreFront"/>
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="doNotSeeCategoryNameInMenu">
<argument name="categoryName" value="{{_defaultCategory.name}}"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,11 @@
</after>
<!--Create Category with not included in menu Subcategory -->
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
<click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="disableIncludeInMenu"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/>
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/>
<waitForPageLoad stepKey="waitForCategorySaved"/>
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="assertSuccessMessage"/>
<waitForPageLoad stepKey="waitForPageSaved"/>
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" />
<!--Verify Category is created/>-->
<seeElement selector="{{AdminCategoryContentSection.activeCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" />
<actionGroup ref="AdminCreateCategoryWithInactiveIncludeInMenuActionGroup" stepKey="createNotIncludedInMenuCategory"/>
<!--Verify Category in store front page menu/>-->
<amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/>
<waitForPageLoad stepKey="waitForPageToBeLoaded"/>
<see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryPageTitle"/>
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="dontSeeCategoryOnNavigation"/>
<actionGroup ref="CheckCategoryOnStorefrontActionGroup" stepKey="CheckCategoryOnStorefront"/>
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="doNotSeeCategoryOnNavigation">
<argument name="categoryName" value="{{_defaultCategory.name}}"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="navigateToNewProductAttributePage"/>

<!-- Set attribute properties -->
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;

/**
* {@inheritdoc}
* @inheritdoc
*/
class ProductLinksTypeResolver implements TypeResolverInterface
{
Expand All @@ -20,9 +20,9 @@ class ProductLinksTypeResolver implements TypeResolverInterface
private $linkTypes = ['related', 'upsell', 'crosssell'];

/**
* {@inheritdoc}
* @inheritdoc
*/
public function resolveType(array $data) : string
public function resolveType(array $data): string
{
if (isset($data['link_type'])) {
$linkType = $data['link_type'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ class BatchProductLinks implements BatchServiceContractResolverInterface
/**
* @var string[]
*/
private static $linkTypes = ['related', 'upsell', 'crosssell'];
private $linkTypes;

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

/**
* @inheritDoc
Expand All @@ -44,7 +52,7 @@ public function convertToServiceArgument(ResolveRequestInterface $request)
/** @var \Magento\Catalog\Model\Product $product */
$product = $value['model'];

return new ListCriteria((string)$product->getId(), self::$linkTypes, $product);
return new ListCriteria((string)$product->getId(), $this->linkTypes, $product);
}

/**
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/CatalogGraphQl/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,14 @@
<preference type="\Magento\CatalogGraphQl\Model\Resolver\Product\Price\Provider" for="\Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderInterface"/>

<preference type="Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search" for="Magento\CatalogGraphQl\Model\Resolver\Products\Query\ProductQueryInterface"/>

<type name="\Magento\CatalogGraphQl\Model\Resolver\Product\BatchProductLinks">
<arguments>
<argument name="linkTypes" xsi:type="array">
<item name="related" xsi:type="string">related</item>
<item name="upsell" xsi:type="string">upsell</item>
<item name="crosssell" xsi:type="string">crosssell</item>
</argument>
</arguments>
</type>
</config>
12 changes: 7 additions & 5 deletions app/code/Magento/CatalogImportExport/Model/Import/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ protected function _saveProducts()
}

$rowSku = $rowData[self::COL_SKU];
$rowSkuNormalized = mb_strtolower($rowSku);

if (null === $rowSku) {
$this->getErrorAggregator()->addRowToSkip($rowNum);
Expand All @@ -1604,9 +1605,9 @@ protected function _saveProducts()
$storeId = !empty($rowData[self::COL_STORE])
? $this->getStoreIdByCode($rowData[self::COL_STORE])
: Store::DEFAULT_STORE_ID;
$rowExistingImages = $existingImages[$storeId][$rowSku] ?? [];
$rowExistingImages = $existingImages[$storeId][$rowSkuNormalized] ?? [];
$rowStoreMediaGalleryValues = $rowExistingImages;
$rowExistingImages += $existingImages[Store::DEFAULT_STORE_ID][$rowSku] ?? [];
$rowExistingImages += $existingImages[Store::DEFAULT_STORE_ID][$rowSkuNormalized] ?? [];

if (self::SCOPE_STORE == $rowScope) {
// set necessary data from SCOPE_DEFAULT row
Expand Down Expand Up @@ -1762,10 +1763,11 @@ protected function _saveProducts()
continue;
}

if (isset($rowExistingImages[$uploadedFile])) {
$currentFileData = $rowExistingImages[$uploadedFile];
$uploadedFileNormalized = ltrim($uploadedFile, '/\\');
if (isset($rowExistingImages[$uploadedFileNormalized])) {
$currentFileData = $rowExistingImages[$uploadedFileNormalized];
$currentFileData['store_id'] = $storeId;
$storeMediaGalleryValueExists = isset($rowStoreMediaGalleryValues[$uploadedFile]);
$storeMediaGalleryValueExists = isset($rowStoreMediaGalleryValues[$uploadedFileNormalized]);
if (array_key_exists($uploadedFile, $imageHiddenStates)
&& $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile]
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ public function getExistingImages(array $bunch)
foreach ($this->connection->fetchAll($select) as $image) {
$storeId = $image['store_id'];
unset($image['store_id']);
$result[$storeId][$image['sku']][$image['value']] = $image;
$sku = mb_strtolower($image['sku']);
$value = ltrim($image['value'], '/\\');
$result[$storeId][$sku][$value] = $image;
}

return $result;
Expand Down
Loading

0 comments on commit 2f64397

Please sign in to comment.