diff --git a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js index d79c42a711565..1d46084020220 100644 --- a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js +++ b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js @@ -56,7 +56,7 @@ define([ */ checkCustomerData: function (formId, captchaData, captcha) { if (!_.isEmpty(captchaData) && - !_.isEmpty(captchaData)[formId] && + !_.isEmpty(captchaData[formId]) && captchaData[formId].timestamp > captcha.timestamp ) { if (!captcha.isRequired() && captchaData[formId].isRequired) { diff --git a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php index 83a2d1340794c..a0f6fcf315c7f 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php +++ b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php @@ -6,12 +6,22 @@ namespace Magento\Catalog\Model\Product\Price; +use Magento\Catalog\Api\Data\SpecialPriceInterface; +use Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory; +use Magento\Catalog\Api\SpecialPriceStorageInterface; +use Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor; +use Magento\Catalog\Model\Product\Price\Validation\Result; +use Magento\Catalog\Model\ProductIdLocatorInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Catalog\Helper\Data; +use Magento\Store\Api\StoreRepositoryInterface; /** * Special price storage presents efficient price API and is used to retrieve, update or delete special prices. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SpecialPriceStorage implements \Magento\Catalog\Api\SpecialPriceStorageInterface +class SpecialPriceStorage implements SpecialPriceStorageInterface { /** * @var \Magento\Catalog\Api\SpecialPriceInterface @@ -19,52 +29,59 @@ class SpecialPriceStorage implements \Magento\Catalog\Api\SpecialPriceStorageInt private $specialPriceResource; /** - * @var \Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory + * @var SpecialPriceInterfaceFactory */ private $specialPriceFactory; /** - * @var \Magento\Catalog\Model\ProductIdLocatorInterface + * @var ProductIdLocatorInterface */ private $productIdLocator; /** - * @var \Magento\Store\Api\StoreRepositoryInterface + * @var StoreRepositoryInterface */ private $storeRepository; /** - * @var \Magento\Catalog\Model\Product\Price\Validation\Result + * @var Result */ private $validationResult; /** - * @var \Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor + * @var InvalidSkuProcessor */ private $invalidSkuProcessor; /** * @var array */ - private $allowedProductTypes = []; + private $allowedProductTypes; + + /** + * @var Data + */ + private $catalogData; /** * @param \Magento\Catalog\Api\SpecialPriceInterface $specialPriceResource - * @param \Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory $specialPriceFactory - * @param \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator - * @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository - * @param \Magento\Catalog\Model\Product\Price\Validation\Result $validationResult - * @param \Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor $invalidSkuProcessor - * @param array $allowedProductTypes [optional] + * @param SpecialPriceInterfaceFactory $specialPriceFactory + * @param ProductIdLocatorInterface $productIdLocator + * @param StoreRepositoryInterface $storeRepository + * @param Result $validationResult + * @param InvalidSkuProcessor $invalidSkuProcessor + * @param array $allowedProductTypes + * @param Data|null $catalogData */ public function __construct( \Magento\Catalog\Api\SpecialPriceInterface $specialPriceResource, - \Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory $specialPriceFactory, - \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator, - \Magento\Store\Api\StoreRepositoryInterface $storeRepository, - \Magento\Catalog\Model\Product\Price\Validation\Result $validationResult, - \Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor $invalidSkuProcessor, - array $allowedProductTypes = [] + SpecialPriceInterfaceFactory $specialPriceFactory, + ProductIdLocatorInterface $productIdLocator, + StoreRepositoryInterface $storeRepository, + Result $validationResult, + InvalidSkuProcessor $invalidSkuProcessor, + array $allowedProductTypes = [], + ?Data $catalogData = null ) { $this->specialPriceResource = $specialPriceResource; $this->specialPriceFactory = $specialPriceFactory; @@ -73,10 +90,11 @@ public function __construct( $this->validationResult = $validationResult; $this->invalidSkuProcessor = $invalidSkuProcessor; $this->allowedProductTypes = $allowedProductTypes; + $this->catalogData = $catalogData ?: ObjectManager::getInstance()->get(Data::class); } /** - * {@inheritdoc} + * @inheritdoc */ public function get(array $skus) { @@ -85,7 +103,7 @@ public function get(array $skus) $prices = []; foreach ($rawPrices as $rawPrice) { - /** @var \Magento\Catalog\Api\Data\SpecialPriceInterface $price */ + /** @var SpecialPriceInterface $price */ $price = $this->specialPriceFactory->create(); $sku = isset($rawPrice['sku']) ? $rawPrice['sku'] @@ -102,7 +120,7 @@ public function get(array $skus) } /** - * {@inheritdoc} + * @inheritdoc */ public function update(array $prices) { @@ -113,7 +131,7 @@ public function update(array $prices) } /** - * {@inheritdoc} + * @inheritdoc */ public function delete(array $prices) { @@ -140,52 +158,14 @@ private function retrieveValidPrices(array $prices) foreach ($prices as $key => $price) { if (!$price->getSku() || in_array($price->getSku(), $failedSkus)) { - $this->validationResult->addFailedItem( - $key, - __( - 'The product that was requested doesn\'t exist. Verify the product and try again. ' - . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', - [ - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ), - [ - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ); + $errorMessage = 'The product that was requested doesn\'t exist. Verify the product and try again. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; + $this->addFailedItemPrice($price, $key, $errorMessage, []); } + $this->checkStore($price, $key); $this->checkPrice($price, $key); $this->checkDate($price, $price->getPriceFrom(), 'Price From', $key); $this->checkDate($price, $price->getPriceTo(), 'Price To', $key); - try { - $this->storeRepository->getById($price->getStoreId()); - } catch (NoSuchEntityException $e) { - $this->validationResult->addFailedItem( - $key, - __( - 'Requested store is not found. ' - . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', - [ - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ), - [ - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ); - } } foreach ($this->validationResult->getFailedRowIds() as $id) { @@ -195,77 +175,95 @@ private function retrieveValidPrices(array $prices) return $prices; } + /** + * Check that store exists and is global when price scope is global and otherwise add error to aggregator. + * + * @param SpecialPriceInterface $price + * @param int $key + * @return void + */ + private function checkStore(SpecialPriceInterface $price, int $key): void + { + if ($this->catalogData->isPriceGlobal() && $price->getStoreId() !== 0) { + $errorMessage = 'Could not change non global Price when price scope is global. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; + $this->addFailedItemPrice($price, $key, $errorMessage, []); + } + + try { + $this->storeRepository->getById($price->getStoreId()); + } catch (NoSuchEntityException $e) { + $errorMessage = 'Requested store is not found. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; + $this->addFailedItemPrice($price, $key, $errorMessage, []); + } + } + /** * Check that date value is correct and add error to aggregator if it contains incorrect data. * - * @param \Magento\Catalog\Api\Data\SpecialPriceInterface $price + * @param SpecialPriceInterface $price * @param string $value * @param string $label * @param int $key * @return void */ - private function checkDate(\Magento\Catalog\Api\Data\SpecialPriceInterface $price, $value, $label, $key) + private function checkDate(SpecialPriceInterface $price, $value, $label, $key) { if ($value && !$this->isCorrectDateValue($value)) { - $this->validationResult->addFailedItem( - $key, - __( - 'Invalid attribute %label = %priceTo. ' - . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', - [ - 'label' => $label, - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ), - [ - 'label' => $label, - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ); + $errorMessage = 'Invalid attribute %label = %priceTo. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; + $this->addFailedItemPrice($price, $key, $errorMessage, ['label' => $label]); } } /** - * Check that provided price value is not empty and not lower then zero and add error to aggregator if price + * Check price. + * + * Verify that provided price value is not empty and not lower then zero and add error to aggregator if price * contains not valid data. * - * @param \Magento\Catalog\Api\Data\SpecialPriceInterface $price + * @param SpecialPriceInterface $price * @param int $key * @return void */ - private function checkPrice(\Magento\Catalog\Api\Data\SpecialPriceInterface $price, $key) + private function checkPrice(SpecialPriceInterface $price, int $key): void { if (null === $price->getPrice() || $price->getPrice() < 0) { - $this->validationResult->addFailedItem( - $key, - __( - 'Invalid attribute Price = %price. ' - . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', - [ - 'price' => $price->getPrice(), - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ), - [ - 'price' => $price->getPrice(), - 'SKU' => $price->getSku(), - 'storeId' => $price->getStoreId(), - 'priceFrom' => $price->getPriceFrom(), - 'priceTo' => $price->getPriceTo() - ] - ); + $errorMessage = 'Invalid attribute Price = %price. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; + $this->addFailedItemPrice($price, $key, $errorMessage, ['price' => $price->getPrice()]); } } + /** + * Adds failed item price to validation result + * + * @param SpecialPriceInterface $price + * @param int $key + * @param string $message + * @param array $firstParam + * @return void + */ + private function addFailedItemPrice( + SpecialPriceInterface $price, + int $key, + string $message, + array $firstParam + ): void { + $additionalInfo = []; + if ($firstParam) { + $additionalInfo = array_merge($additionalInfo, $firstParam); + } + + $additionalInfo['SKU'] = $price->getSku(); + $additionalInfo['storeId'] = $price->getStoreId(); + $additionalInfo['priceFrom'] = $price->getPriceFrom(); + $additionalInfo['priceTo'] = $price->getPriceTo(); + + $this->validationResult->addFailedItem($key, __($message, $additionalInfo), $additionalInfo); + } + /** * Retrieve SKU by product ID. * diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php index 7eb19193f8bdd..448b3769c7157 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php @@ -6,10 +6,18 @@ namespace Magento\Catalog\Model\ResourceModel\Product\Price; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\SpecialPriceInterface; +use Magento\Catalog\Model\ProductIdLocatorInterface; +use Magento\Catalog\Model\ResourceModel\Attribute; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\Exception\CouldNotDeleteException; +use Magento\Framework\App\ObjectManager; + /** * Special price resource. */ -class SpecialPrice implements \Magento\Catalog\Api\SpecialPriceInterface +class SpecialPrice implements SpecialPriceInterface { /** * Price storage table. @@ -26,24 +34,24 @@ class SpecialPrice implements \Magento\Catalog\Api\SpecialPriceInterface private $datetimeTable = 'catalog_product_entity_datetime'; /** - * @var \Magento\Catalog\Model\ResourceModel\Attribute + * @var Attribute */ private $attributeResource; /** - * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface + * @var ProductAttributeRepositoryInterface */ private $attributeRepository; /** - * @var \Magento\Catalog\Model\ProductIdLocatorInterface + * @var ProductIdLocatorInterface */ private $productIdLocator; /** * Metadata pool. * - * @var \Magento\Framework\EntityManager\MetadataPool + * @var MetadataPool */ private $metadataPool; @@ -76,16 +84,16 @@ class SpecialPrice implements \Magento\Catalog\Api\SpecialPriceInterface private $itemsPerOperation = 500; /** - * @param \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource - * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository - * @param \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator - * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool + * @param Attribute $attributeResource + * @param ProductAttributeRepositoryInterface $attributeRepository + * @param ProductIdLocatorInterface $productIdLocator + * @param MetadataPool $metadataPool */ public function __construct( - \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource, - \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, - \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator, - \Magento\Framework\EntityManager\MetadataPool $metadataPool + Attribute $attributeResource, + ProductAttributeRepositoryInterface $attributeRepository, + ProductIdLocatorInterface $productIdLocator, + MetadataPool $metadataPool ) { $this->attributeResource = $attributeResource; $this->attributeRepository = $attributeRepository; @@ -94,7 +102,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function get(array $skus) { @@ -132,7 +140,7 @@ public function get(array $skus) } /** - * {@inheritdoc} + * @inheritdoc */ public function update(array $prices) { @@ -187,49 +195,63 @@ public function update(array $prices) } /** - * {@inheritdoc} + * @inheritdoc */ public function delete(array $prices) { - $skus = array_unique( - array_map(function ($price) { - return $price->getSku(); - }, $prices) - ); - $ids = $this->retrieveAffectedIds($skus); $connection = $this->attributeResource->getConnection(); - $connection->beginTransaction(); - try { - foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) { - $this->attributeResource->getConnection()->delete( - $this->attributeResource->getTable($this->priceTable), - [ - 'attribute_id = ?' => $this->getPriceAttributeId(), - $this->getEntityLinkField() . ' IN (?)' => $idsBunch - ] - ); - } - foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) { - $this->attributeResource->getConnection()->delete( - $this->attributeResource->getTable($this->datetimeTable), - [ - 'attribute_id IN (?)' => [$this->getPriceFromAttributeId(), $this->getPriceToAttributeId()], - $this->getEntityLinkField() . ' IN (?)' => $idsBunch - ] - ); + + foreach ($this->getStoreSkus($prices) as $storeId => $skus) { + + $ids = $this->retrieveAffectedIds(array_unique($skus)); + $connection->beginTransaction(); + try { + foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) { + $connection->delete( + $this->attributeResource->getTable($this->priceTable), + [ + 'attribute_id = ?' => $this->getPriceAttributeId(), + 'store_id = ?' => $storeId, + $this->getEntityLinkField() . ' IN (?)' => $idsBunch + ] + ); + } + foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) { + $connection->delete( + $this->attributeResource->getTable($this->datetimeTable), + [ + 'attribute_id IN (?)' => [$this->getPriceFromAttributeId(), $this->getPriceToAttributeId()], + 'store_id = ?' => $storeId, + $this->getEntityLinkField() . ' IN (?)' => $idsBunch + ] + ); + } + $connection->commit(); + } catch (\Exception $e) { + $connection->rollBack(); + throw new CouldNotDeleteException(__('Could not delete Prices'), $e); } - $connection->commit(); - } catch (\Exception $e) { - $connection->rollBack(); - throw new \Magento\Framework\Exception\CouldNotDeleteException( - __('Could not delete Prices'), - $e - ); } return true; } + /** + * Returns associative arrays of store_id as key and array of skus as value. + * + * @param \Magento\Catalog\Api\Data\SpecialPriceInterface[] $priceItems + * @return array + */ + private function getStoreSkus(array $priceItems): array + { + $storeSkus = []; + foreach ($priceItems as $priceItem) { + $storeSkus[$priceItem->getStoreId()][] = $priceItem->getSku(); + } + + return $storeSkus; + } + /** * Get link field. * @@ -312,9 +334,9 @@ private function retrieveAffectedIds(array $skus) $affectedIds = []; foreach ($this->productIdLocator->retrieveProductIdsBySkus($skus) as $productIds) { - $affectedIds = array_merge($affectedIds, array_keys($productIds)); + $affectedIds[] = array_keys($productIds); } - return array_unique($affectedIds); + return array_unique(array_merge([], ...$affectedIds)); } } diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByCustomDateRangeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByCustomDateRangeActionGroup.xml new file mode 100644 index 0000000000000..30b15abb234d5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FilterProductGridByCustomDateRangeActionGroup.xml @@ -0,0 +1,27 @@ + + + + + + + Filters the Admin Products grid by the provided Date Filter. + + + + + + + + + + + + + + diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml index d70c48f2b00e3..590b9a185e5e4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml @@ -75,6 +75,7 @@ + diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateWithCustomLocaleTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateWithCustomLocaleTest.xml new file mode 100644 index 0000000000000..eae9cebd7e638 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateWithCustomLocaleTest.xml @@ -0,0 +1,101 @@ + + + + + + + + + + <description value="Product grid date filters does not work for en_GB locale"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-40644"/> + <useCaseId value="MC-40240"/> + <group value="catalog"/> + </annotations> + + <before> + <!-- Deploy static content with United Kingdom locale--> + <magentoCLI command="setup:static-content:deploy en_GB" stepKey="deployStaticContentWithUnitedKingdomLocale"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <!-- Create new User --> + <actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/> + <actionGroup ref="AdminCreateUserWithRoleAndLocaleActionGroup" stepKey="createAdminUser"> + <argument name="user" value="activeAdmin"/> + <argument name="role" value="roleDefaultAdministrator"/> + <argument name="interfaceLocale" value="en_GB"/> + </actionGroup> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> + <argument name="ProductAttribute" value="dateProductAttribute"/> + </actionGroup> + <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetGridFilter"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + + <!-- Generate date for use as default value, needs to be MM/d/YYYY and mm/d/yy --> + <generateDate date="now" format="m/j/Y" stepKey="generateDefaultDate"/> + <generateDate date="now" format="j/m/Y" stepKey="generateDefaultDateGB"/> + + <!-- Navigate to Stores > Attributes > Product. --> + <actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="goToProductAttributes"/> + + <!-- Create new Product Attribute as TextField, with code and default value. --> + <actionGroup ref="CreateProductAttributeWithDateFieldActionGroup" stepKey="createAttribute"> + <argument name="attribute" value="dateProductAttribute"/> + <argument name="date" value="{$generateDefaultDate}"/> + </actionGroup> + + <!-- Go to default attribute set edit page --> + <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/{{AddToDefaultSet.attributeSetId}}/" stepKey="onAttributeSetEdit"/> + <!-- Assert created attribute in unassigned section --> + <see userInput="{{dateProductAttribute.attribute_code}}" selector="{{AdminProductAttributeSetEditSection.unassignedAttributesTree}}" stepKey="seeAttributeInUnassigned"/> + <!-- Assign attribute to a group --> + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup"> + <argument name="group" value="Product Details"/> + <argument name="attribute" value="{{dateProductAttribute.attribute_code}}"/> + </actionGroup> + <!-- Assert attribute in a group --> + <see userInput="{{dateProductAttribute.attribute_code}}" selector="{{AdminProductAttributeSetEditSection.groupTree}}" stepKey="seeAttributeInGroup"/> + <!-- Save attribute set --> + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/> + + <!-- Open Product Edit Page and set custom attribute value --> + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct"> + <argument name="product" value="$createProduct$"/> + </actionGroup> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct"> + <argument name="product" value="$createProduct$"/> + </actionGroup> + <fillField selector="{{AdminProductFormSection.newAddedAttributeInput(dateProductAttribute.attribute_code)}}" userInput="{$generateDefaultDate}" stepKey="fillCustomDateValue"/> + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> + + <!-- Logout master admin and Login as new User --> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutMasterAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginToNewAdmin"> + <argument name="username" value="{{activeAdmin.username}}"/> + <argument name="password" value="{{activeAdmin.password}}"/> + </actionGroup> + + <!-- Open Product Index Page and filter the product --> + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex2"/> + <actionGroup ref="FilterProductGridByCustomDateRangeActionGroup" stepKey="filterProductGridByCustomDateRange"> + <argument name="code" value="{{dateProductAttribute.attribute_code}}"/> + <argument name="date" value="{$generateDefaultDateGB}"/> + </actionGroup> + <!-- Check products filtering --> + <see selector="{{AdminProductGridSection.productGridNameProduct($createProduct.name$)}}" userInput="$createProduct.name$" stepKey="seeProductName"/> + </test> +</tests> diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php b/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php index 5e7039912999b..f74d8ca358b3f 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php @@ -34,19 +34,27 @@ class UpdateUrlKeyForProducts implements DataPatchInterface, PatchVersionInterfa */ private $urlProduct; + /** + * @var \Magento\Framework\EntityManager\MetadataPool + */ + private $metadataPool; + /** * @param ModuleDataSetupInterface $moduleDataSetup * @param EavSetupFactory $eavSetupFactory * @param Url $urlProduct + * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool */ public function __construct( ModuleDataSetupInterface $moduleDataSetup, EavSetupFactory $eavSetupFactory, - Url $urlProduct + Url $urlProduct, + \Magento\Framework\EntityManager\MetadataPool $metadataPool ) { $this->moduleDataSetup = $moduleDataSetup; $this->eavSetup = $eavSetupFactory->create(['setup' => $moduleDataSetup]); $this->urlProduct = $urlProduct; + $this->metadataPool = $metadataPool; } /** @@ -58,7 +66,7 @@ public function apply() $table = $this->moduleDataSetup->getTable('catalog_product_entity_varchar'); $select = $this->moduleDataSetup->getConnection()->select()->from( $table, - ['value_id', 'value'] + [$this->getProductLinkField(), 'attribute_id', 'store_id', 'value_id', 'value'] )->where( 'attribute_id = ?', $this->eavSetup->getAttributeId($productTypeId, 'url_key') @@ -99,4 +107,17 @@ public function getAliases() { return []; } + + /** + * Return product id field name - entity_id|row_id + * + * @return string + * @throws \Exception + */ + private function getProductLinkField() + { + return $this->metadataPool + ->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class) + ->getLinkField(); + } } diff --git a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php index 5338a16004a00..ceb0240af1dfd 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php +++ b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php @@ -86,30 +86,6 @@ public function beforeSavePaymentInformationAndPlaceOrder( } } - /** - * Check validation before saving the payment information - * - * @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject - * @param int $cartId - * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod - * @param \Magento\Quote\Api\Data\AddressInterface|null $billingAddress - * @return void - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotSaveException - */ - public function beforeSavePaymentInformation( - \Magento\Checkout\Api\PaymentInformationManagementInterface $subject, - $cartId, - \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, - \Magento\Quote\Api\Data\AddressInterface $billingAddress = null - ) { - $quote = $this->quoteRepository->getActive($cartId); - if ($this->isAgreementEnabled() && !$quote->getIsMultiShipping()) { - $this->validateAgreements($paymentMethod); - } - } - /** * Validate agreements base on the payment method * diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php index b7e5127df1f8b..6aa3d62230091 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php @@ -126,11 +126,9 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() ->willReturn(true); $searchCriteriaMock = $this->createMock(SearchCriteria::class); $this->quoteMock - ->expects($this->once()) ->method('getIsMultiShipping') ->willReturn(false); $this->quoteRepositoryMock - ->expects($this->once()) ->method('getActive') ->with($cartId) ->willReturn($this->quoteMock); @@ -146,7 +144,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation( + $this->model->beforeSavePaymentInformationAndPlaceOrder( $this->subjectMock, $cartId, $this->paymentMock, @@ -166,11 +164,9 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali ->willReturn(true); $searchCriteriaMock = $this->createMock(SearchCriteria::class); $this->quoteMock - ->expects($this->once()) ->method('getIsMultiShipping') ->willReturn(false); $this->quoteRepositoryMock - ->expects($this->once()) ->method('getActive') ->with($cartId) ->willReturn($this->quoteMock); @@ -186,7 +182,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali $this->paymentMock->expects(static::atLeastOnce()) ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation( + $this->model->beforeSavePaymentInformationAndPlaceOrder( $this->subjectMock, $cartId, $this->paymentMock, @@ -198,40 +194,6 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali ); } - public function testBeforeSavePaymentInformation() - { - $cartId = 100; - $agreements = [1, 2, 3]; - $this->scopeConfigMock - ->expects($this->once()) - ->method('isSetFlag') - ->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE) - ->willReturn(true); - $this->quoteMock - ->expects($this->once()) - ->method('getIsMultiShipping') - ->willReturn(false); - $this->quoteRepositoryMock - ->expects($this->once()) - ->method('getActive') - ->with($cartId) - ->willReturn($this->quoteMock); - $searchCriteriaMock = $this->createMock(SearchCriteria::class); - $this->agreementsFilterMock->expects($this->once()) - ->method('buildSearchCriteria') - ->willReturn($searchCriteriaMock); - $this->checkoutAgreementsListMock->expects($this->once()) - ->method('getList') - ->with($searchCriteriaMock) - ->willReturn([1]); - $this->extensionAttributesMock->expects($this->once())->method('getAgreementIds')->willReturn($agreements); - $this->agreementsValidatorMock->expects($this->once())->method('isValid')->with($agreements)->willReturn(true); - $this->paymentMock->expects(static::atLeastOnce()) - ->method('getExtensionAttributes') - ->willReturn($this->extensionAttributesMock); - $this->model->beforeSavePaymentInformation($this->subjectMock, $cartId, $this->paymentMock, $this->addressMock); - } - /** * Build payment extension mock. * diff --git a/app/code/Magento/Cms/Model/Page/DataProvider.php b/app/code/Magento/Cms/Model/Page/DataProvider.php index 41010575a1f27..6afde01cfe6c6 100644 --- a/app/code/Magento/Cms/Model/Page/DataProvider.php +++ b/app/code/Magento/Cms/Model/Page/DataProvider.php @@ -5,24 +5,24 @@ */ namespace Magento\Cms\Model\Page; -use Magento\Cms\Model\Page; +use Magento\Cms\Api\Data\PageInterface; +use Magento\Cms\Api\PageRepositoryInterface; +use Magento\Cms\Model\PageFactory; use Magento\Cms\Model\ResourceModel\Page\CollectionFactory; use Magento\Framework\App\ObjectManager; use Magento\Framework\App\Request\DataPersistorInterface; use Magento\Framework\App\RequestInterface; -use Magento\Ui\DataProvider\Modifier\PoolInterface; use Magento\Framework\AuthorizationInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Ui\DataProvider\Modifier\PoolInterface; +use Magento\Ui\DataProvider\ModifierPoolDataProvider; +use Psr\Log\LoggerInterface; /** - * Class DataProvider + * Cms Page DataProvider */ -class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider +class DataProvider extends ModifierPoolDataProvider { - /** - * @var \Magento\Cms\Model\ResourceModel\Page\Collection - */ - protected $collection; - /** * @var DataPersistorInterface */ @@ -33,6 +33,11 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider */ protected $loadedData; + /** + * @var PageRepositoryInterface + */ + private $pageRepository; + /** * @var AuthorizationInterface */ @@ -49,9 +54,14 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider private $customLayoutManager; /** - * @var CollectionFactory + * @var PageFactory + */ + private $pageFactory; + + /** + * @var LoggerInterface */ - private $collectionFactory; + private $logger; /** * @param string $name @@ -65,6 +75,9 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider * @param AuthorizationInterface|null $auth * @param RequestInterface|null $request * @param CustomLayoutManagerInterface|null $customLayoutManager + * @param PageRepositoryInterface|null $pageRepository + * @param PageFactory|null $pageFactory + * @param LoggerInterface|null $logger * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -78,33 +91,22 @@ public function __construct( PoolInterface $pool = null, ?AuthorizationInterface $auth = null, ?RequestInterface $request = null, - ?CustomLayoutManagerInterface $customLayoutManager = null + ?CustomLayoutManagerInterface $customLayoutManager = null, + ?PageRepositoryInterface $pageRepository = null, + ?PageFactory $pageFactory = null, + ?LoggerInterface $logger = null ) { + parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); $this->collection = $pageCollectionFactory->create(); - $this->collectionFactory = $pageCollectionFactory; $this->dataPersistor = $dataPersistor; - parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); $this->auth = $auth ?? ObjectManager::getInstance()->get(AuthorizationInterface::class); $this->meta = $this->prepareMeta($this->meta); $this->request = $request ?? ObjectManager::getInstance()->get(RequestInterface::class); $this->customLayoutManager = $customLayoutManager ?? ObjectManager::getInstance()->get(CustomLayoutManagerInterface::class); - } - - /** - * Find requested page. - * - * @return Page|null - */ - private function findCurrentPage(): ?Page - { - if ($this->getRequestFieldName() && ($pageId = (int)$this->request->getParam($this->getRequestFieldName()))) { - //Loading data for the collection. - $this->getData(); - return $this->collection->getItemById($pageId); - } - - return null; + $this->pageRepository = $pageRepository ?? ObjectManager::getInstance()->get(PageRepositoryInterface::class); + $this->pageFactory = $pageFactory ?: ObjectManager::getInstance()->get(PageFactory::class); + $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class); } /** @@ -128,29 +130,53 @@ public function getData() if (isset($this->loadedData)) { return $this->loadedData; } - $this->collection = $this->collectionFactory->create(); - $items = $this->collection->getItems(); - /** @var $page \Magento\Cms\Model\Page */ - foreach ($items as $page) { - $this->loadedData[$page->getId()] = $page->getData(); - if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) { - //Deprecated layout update exists. - $this->loadedData[$page->getId()]['layout_update_selected'] = '_existing_'; + + $page = $this->getCurrentPage(); + $this->loadedData[$page->getId()] = $page->getData(); + if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) { + //Deprecated layout update exists. + $this->loadedData[$page->getId()]['layout_update_selected'] = '_existing_'; + } + + return $this->loadedData; + } + + /** + * Return current page + * + * @return PageInterface + */ + private function getCurrentPage(): PageInterface + { + $pageId = $this->getPageId(); + if ($pageId) { + try { + $page = $this->pageRepository->getById($pageId); + } catch (LocalizedException $exception) { + $page = $this->pageFactory->create(); } + + return $page; } $data = $this->dataPersistor->get('cms_page'); - if (!empty($data)) { - $page = $this->collection->getNewEmptyItem(); - $page->setData($data); - $this->loadedData[$page->getId()] = $page->getData(); - if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) { - $this->loadedData[$page->getId()]['layout_update_selected'] = '_existing_'; - } - $this->dataPersistor->clear('cms_page'); + if (empty($data)) { + return $this->pageFactory->create(); } + $this->dataPersistor->clear('cms_page'); - return $this->loadedData; + return $this->pageFactory->create() + ->setData($data); + } + + /** + * Returns current page id from request + * + * @return int + */ + private function getPageId(): int + { + return (int) $this->request->getParam($this->getRequestFieldName()); } /** @@ -186,16 +212,20 @@ public function getMeta() //List of custom layout files available for current page. $options = [['label' => 'No update', 'value' => '_no_update_']]; - if ($page = $this->findCurrentPage()) { - //We must have a specific page selected. - //If custom layout XML is set then displaying this special option. + + $page = null; + try { + $page = $this->pageRepository->getById($this->getPageId()); if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) { $options[] = ['label' => 'Use existing layout update XML', 'value' => '_existing_']; } foreach ($this->customLayoutManager->fetchAvailableFiles($page) as $layoutFile) { $options[] = ['label' => $layoutFile, 'value' => $layoutFile]; } + } catch (LocalizedException $e) { + $this->logger->error($e->getMessage()); } + $customLayoutMeta = [ 'design' => [ 'children' => [ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml b/app/code/Magento/Cms/view/frontend/layout/cms_noroute_index.xml similarity index 100% rename from app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml rename to app/code/Magento/Cms/view/frontend/layout/cms_noroute_index.xml diff --git a/app/code/Magento/Customer/Model/ResourceModel/Grid/Collection.php b/app/code/Magento/Customer/Model/ResourceModel/Grid/Collection.php index 0fab27161ce25..e14594daf8011 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Grid/Collection.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Grid/Collection.php @@ -7,10 +7,12 @@ use Magento\Customer\Model\ResourceModel\Customer; use Magento\Customer\Ui\Component\DataProvider\Document; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy; use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory; use Magento\Framework\Event\ManagerInterface as EventManager; use Magento\Framework\Locale\ResolverInterface; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult; use Psr\Log\LoggerInterface as Logger; @@ -24,6 +26,11 @@ class Collection extends SearchResult */ private $localeResolver; + /** + * @var TimezoneInterface + */ + private $timeZone; + /** * @inheritdoc */ @@ -42,6 +49,7 @@ class Collection extends SearchResult * @param ResolverInterface $localeResolver * @param string $mainTable * @param string $resourceModel + * @param TimezoneInterface|null $timeZone */ public function __construct( EntityFactory $entityFactory, @@ -50,10 +58,13 @@ public function __construct( EventManager $eventManager, ResolverInterface $localeResolver, $mainTable = 'customer_grid_flat', - $resourceModel = Customer::class + $resourceModel = Customer::class, + TimezoneInterface $timeZone = null ) { $this->localeResolver = $localeResolver; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel); + $this->timeZone = $timeZone ?: ObjectManager::getInstance() + ->get(TimezoneInterface::class); } /** @@ -81,6 +92,14 @@ public function addFieldToFilter($field, $condition = null) return $this; } + if ($field === 'created_at') { + if (is_array($condition)) { + foreach ($condition as $key => $value) { + $condition[$key] = $this->timeZone->convertConfigTimeToUtc($value); + } + } + } + if (is_string($field) && count(explode('.', $field)) === 1) { $field = 'main_table.' . $field; } diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup.xml new file mode 100644 index 0000000000000..cbe227c1809f3 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup.xml @@ -0,0 +1,19 @@ +<?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="StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup"> + <annotations> + <description>Clicks the "Print Order" link on the My Account->My Orders->Order View page</description> + </annotations> + + <click selector="{{StorefrontCustomerOrderViewSection.printOrderLink}}" stepKey="clickPrintOrderLink"/> + <waitForPageLoad stepKey="waitForPageLoaded"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup.xml new file mode 100644 index 0000000000000..232667cd9a8e5 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup.xml @@ -0,0 +1,19 @@ +<?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="StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup"> + <annotations> + <description>Clicks the top "View Order" link on the My Account->My Orders page</description> + </annotations> + + <click selector="{{StorefrontCustomerOrderSection.viewOrder}}" stepKey="clickViewOrder"/> + <waitForPageLoad stepKey="waitForPageLoaded"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml index 5b6c4fd23e038..dd8b576ad7bb7 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml @@ -21,9 +21,7 @@ </annotations> <before> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexCustomerGrid"> - <argument name="indices" value="customer_grid"/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindexCustomerGrid"/> </before> <after> @@ -40,9 +38,7 @@ <fillField userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerAccountInformationSection.email}}" stepKey="fillEmail"/> <click selector="{{AdminCustomerMainActionsSection.saveButton}}" stepKey="saveCustomer"/> <seeElement selector="{{AdminCustomerMessagesSection.successMessage}}" stepKey="assertSuccessMessage"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage"/> <comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitForLoad2"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml index 62dcd6fc4d894..b3d432b7776aa 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml @@ -20,9 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml index c6e72901b062c..15eae933ccdda 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml @@ -20,9 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml index 52c8029b8f778..55c9315f42fa9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml @@ -20,9 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml index 77422c6e8da3f..b975cf62765c1 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml @@ -6,7 +6,8 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest"> <annotations> <features value="Customer"/> @@ -23,37 +24,41 @@ <createData entity="SimpleProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createSimpleCategory"/> </createData> - <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="login"/> </before> <after> <deleteData createDataKey="createSimpleCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> - <argument name="customer" value="$simpleCustomer$"/> - </actionGroup> - <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSecondProduct"> - <argument name="product" value="$createSimpleProduct$"/> - </actionGroup> - <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> - <argument name="customer" value="$simpleCustomer$"/> - <argument name="address" value="US_Address_TX"/> - </actionGroup> - <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> - <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> - <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> - - <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startCreateInvoice"/> - <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoice"/> - <actionGroup ref="GoToShipmentIntoOrderActionGroup" stepKey="goToShipment"/> - <actionGroup ref="SubmitShipmentIntoOrderActionGroup" stepKey="submitShipment"/> - - <!--Create Credit Memo--> - <actionGroup ref="StartToCreateCreditMemoActionGroup" stepKey="startToCreateCreditMemo"> - <argument name="orderId" value="{$getOrderId}"/> - </actionGroup> - <actionGroup ref="SubmitCreditMemoActionGroup" stepKey="submitCreditMemo"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToNewOrderPage"/> + <createData entity="CustomerCart" stepKey="createCustomerCart"> + <requiredEntity createDataKey="simpleCustomer"/> + </createData> + <createData entity="CustomerCartItem" stepKey="addSecondProduct"> + <requiredEntity createDataKey="createCustomerCart"/> + <requiredEntity createDataKey="createSimpleProduct"/> + </createData> + <createData entity="CustomerAddressInformation" stepKey="fillCustomerInfo"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFlatRate"/> + <updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="submitOrder"> + <requiredEntity createDataKey="createCustomerCart"/> + </updateData> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="getOrderId"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="startCreateInvoice"/> + <createData entity="Invoice" stepKey="submitInvoice"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToShipment"/> + <createData entity="Shipment" stepKey="submitShipment"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="startToCreateCreditMemo"/> + <createData entity="CreditMemo" stepKey="submitCreditMemo"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="logInCustomer"> <argument name="Customer" value="$$simpleCustomer$$"/> @@ -61,12 +66,11 @@ <actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToMyOrdersPage"> <argument name="menu" value="My Orders"/> </actionGroup> - <click selector="{{StorefrontCustomerOrderSection.viewOrder}}" stepKey="clickViewOrder"/> - <click selector="{{StorefrontCustomerOrderViewSection.printOrderLink}}" stepKey="clickPrintOrderLink"/> - <waitForPageLoad stepKey="waitPageReload"/> + <actionGroup ref="StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup" stepKey="clickViewOrder"/> + <actionGroup ref="StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup" stepKey="clickPrintOrderLink"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitPageReload"/> <switchToWindow stepKey="switchToWindow"/> <switchToPreviousTab stepKey="switchToPreviousTab"/> - <actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBook"> <argument name="menu" value="Address Book"/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml index 257d4c9b2e3c2..4ffb59dd7c658 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml @@ -25,9 +25,7 @@ <deleteData createDataKey="customer" stepKey="deleteCustomer"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml index bac1c665cbe78..7a9743482f81e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml @@ -20,9 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml index 3f95e55c56132..3fa29aef9908e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml @@ -20,9 +20,7 @@ </annotations> <before> <createData stepKey="customer" entity="Simple_US_Customer_Multiple_Addresses"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml index fb6793b1751a6..971a93f64d800 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml @@ -20,9 +20,7 @@ </annotations> <before> <createData stepKey="customer" entity="Simple_Customer_Without_Address"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index 6a157c6312530..34cd34425815a 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -42,9 +42,7 @@ <!--Set account sharing option - Default value is 'Per Website'--> <comment userInput="Set account sharing option - Default value is 'Per Website'" stepKey="setAccountSharingOption"/> <createData entity="CustomerAccountSharingDefault" stepKey="setToAccountSharingToDefault"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> </before> <after> <!--delete all created data and set main website country options to default--> @@ -62,9 +60,7 @@ <actionGroup ref="SetWebsiteCountryOptionsToDefaultActionGroup" stepKey="setCountryOptionsToDefault"/> <createData entity="CustomerAccountSharingSystemValue" stepKey="setAccountSharingToSystemValue"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml index 130e1ba6723ae..9371a51e7770f 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml @@ -102,9 +102,7 @@ <requiredEntity createDataKey="createDownloadableProduct1"/> </createData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml index 47b61b332f571..148afb6d67c21 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml @@ -36,7 +36,7 @@ <argument name="dob" value="{{EN_US_DATE.short4DigitYear}}"/> </actionGroup> <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> + <argument name="indices" value="customer_grid"/> </actionGroup> <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml index a909582c32b3d..16a3ad59b5494 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml @@ -51,11 +51,7 @@ <argument name="StoreGroup" value="SecondStoreGroupUnique"/> <argument name="customStore" value="SecondStoreUnique"/> </actionGroup> - - <!-- Reindex --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexAllIndexes"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindexAllIndexes"/> </before> <after> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml index 4aa4e99e79489..b4a3bb88d2e28 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml @@ -30,9 +30,7 @@ <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml index 06dde74de20f9..0e620992ad6be 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml @@ -30,9 +30,7 @@ <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml index 66e1b60331e97..79691face4911 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml @@ -39,9 +39,7 @@ <getData entity="GetProduct" stepKey="arg3"> <requiredEntity createDataKey="simple2"/> </getData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml index 79b465abe2ac6..2d7c2aee05cb0 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml @@ -30,9 +30,7 @@ <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml index c196abbce99ed..5142558eaff66 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml @@ -29,9 +29,7 @@ <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryDeletedAllImagesActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryDeletedAllImagesActionGroup.xml index 4aa460327578a..33e9838f2c443 100644 --- a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryDeletedAllImagesActionGroup.xml +++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryDeletedAllImagesActionGroup.xml @@ -12,7 +12,7 @@ <amOnPage url="{{AdminStandaloneMediaGalleryPage.url}}" stepKey="openMediaGalleryPage"/> <!-- It sometimes is loading too long for default 10s --> <waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> + <conditionalClick selector="{{AdminEnhancedMediaGalleryFiltersSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> <helper class="\Magento\MediaGalleryUi\Test\Mftf\Helper\MediaGalleryUiHelper" method="deleteAllImagesUsingMassAction" stepKey="deleteAllImagesUsingMassAction"> <argument name="emptyRow">{{AdminMediaGalleryGridSection.noDataMessage}}</argument> <argument name="deleteImagesButton">{{AdminEnhancedMediaGalleryMassActionSection.deleteImages}}</argument> diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryFiltersSection.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryFiltersSection.xml index da9f773d0f75e..77e42b780df81 100644 --- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryFiltersSection.xml +++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryFiltersSection.xml @@ -26,5 +26,6 @@ <element name="searchOptionsFilterDone" type="button" selector="//div[label/span[contains(text(), '{{filterName}}')]]//button[@data-action='close-advanced-select']" parameterized="true"/> <element name="duplicatedFilterCheckbox" type="button" selector="//input[@name='duplicated']"/> <element name="activeFilterValue" type="text" selector="//div[@class='media-gallery-container']//div[@class='admin__current-filters-list-wrap']//li//span[contains(text(), '{{filterPlaceholder}}')]" parameterized="true"/> + <element name="clearFilters" type="button" selector="//div[@class='media-gallery-container']//div[@class='admin__data-grid-header']//button[@data-action='grid-filter-reset']" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Sales/Block/Order/Items.php b/app/code/Magento/Sales/Block/Order/Items.php index d7255a24aead5..be3f9ce14c98d 100644 --- a/app/code/Magento/Sales/Block/Order/Items.php +++ b/app/code/Magento/Sales/Block/Order/Items.php @@ -9,18 +9,28 @@ */ namespace Magento\Sales\Block\Order; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Registry; +use Magento\Framework\View\Element\AbstractBlock; +use Magento\Framework\View\Element\Template\Context; +use Magento\Sales\Block\Items\AbstractItems; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\ResourceModel\Order\Item\Collection; +use Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory; +use Magento\Theme\Block\Html\Pager; + /** * Sales order view items block. * * @api * @since 100.0.2 */ -class Items extends \Magento\Sales\Block\Items\AbstractItems +class Items extends AbstractItems { /** * Core registry * - * @var \Magento\Framework\Registry + * @var Registry */ protected $_coreRegistry = null; @@ -32,30 +42,30 @@ class Items extends \Magento\Sales\Block\Items\AbstractItems private $itemsPerPage; /** - * @var \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory + * @var CollectionFactory */ private $itemCollectionFactory; /** - * @var \Magento\Sales\Model\ResourceModel\Order\Item\Collection|null + * @var Collection|null */ private $itemCollection; /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Registry $registry + * @param Context $context + * @param Registry $registry * @param array $data - * @param \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory|null $itemCollectionFactory + * @param CollectionFactory|null $itemCollectionFactory */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Registry $registry, + Context $context, + Registry $registry, array $data = [], - \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory $itemCollectionFactory = null + CollectionFactory $itemCollectionFactory = null ) { $this->_coreRegistry = $registry; - $this->itemCollectionFactory = $itemCollectionFactory ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory::class); + $this->itemCollectionFactory = $itemCollectionFactory ?: ObjectManager::getInstance() + ->get(CollectionFactory::class); parent::__construct($context, $data); } @@ -68,18 +78,12 @@ public function __construct( protected function _prepareLayout() { $this->itemsPerPage = $this->_scopeConfig->getValue('sales/orders/items_per_page'); + $this->itemCollection = $this->createItemsCollection(); - $this->itemCollection = $this->itemCollectionFactory->create(); - $this->itemCollection->setOrderFilter($this->getOrder()); - - /** @var \Magento\Theme\Block\Html\Pager $pagerBlock */ + /** @var Pager $pagerBlock */ $pagerBlock = $this->getChildBlock('sales_order_item_pager'); if ($pagerBlock) { - $pagerBlock->setLimit($this->itemsPerPage); - //here pager updates collection parameters - $pagerBlock->setCollection($this->itemCollection); - $pagerBlock->setAvailableLimit([$this->itemsPerPage]); - $pagerBlock->setShowAmounts($this->isPagerDisplayed()); + $this->preparePager($pagerBlock); } return parent::_prepareLayout(); @@ -122,7 +126,7 @@ public function getItems() */ public function getPagerHtml() { - /** @var \Magento\Theme\Block\Html\Pager $pagerBlock */ + /** @var Pager $pagerBlock */ $pagerBlock = $this->getChildBlock('sales_order_item_pager'); return $pagerBlock ? $pagerBlock->toHtml() : ''; } @@ -130,10 +134,39 @@ public function getPagerHtml() /** * Retrieve current order model instance * - * @return \Magento\Sales\Model\Order + * @return Order */ public function getOrder() { return $this->_coreRegistry->registry('current_order'); } + + /** + * Prepare pager block + * + * @param AbstractBlock $pagerBlock + */ + private function preparePager(AbstractBlock $pagerBlock): void + { + $collectionToPager = $this->createItemsCollection(); + $collectionToPager->addFieldToFilter('parent_item_id', ['null' => true]); + $pagerBlock->setCollection($collectionToPager); + + $pagerBlock->setLimit($this->itemsPerPage); + $pagerBlock->setAvailableLimit([$this->itemsPerPage]); + $pagerBlock->setShowAmounts($this->isPagerDisplayed()); + } + + /** + * Create items collection + * + * @return Collection + */ + private function createItemsCollection(): Collection + { + $collection = $this->itemCollectionFactory->create(); + $collection->setOrderFilter($this->getOrder()); + + return $collection; + } } diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup.xml new file mode 100644 index 0000000000000..fe24996ba2834 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup.xml @@ -0,0 +1,19 @@ +<?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="AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup"> + <annotations> + <description>Click create new status button</description> + </annotations> + + <click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/> + <waitForPageLoad stepKey="waitForPageLoaded"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreateOrderFormShippingAddressActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreateOrderFormShippingAddressActionGroup.xml new file mode 100644 index 0000000000000..32cedca015c97 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminCreateOrderFormShippingAddressActionGroup.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * seeInField 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="AssertAdminCreateOrderFormShippingAddressActionGroup"> + <annotations> + <description>Verify shipping address inputs on admin create order page. Start on admin create new order page.</description> + </annotations> + <arguments> + <argument name="prefix" type="string" defaultValue="{{CustomerAddressSimple.prefix}}"/> + <argument name="firstname" type="string" defaultValue="{{CustomerAddressSimple.firstname}}"/> + <argument name="middleName" type="string" defaultValue="{{CustomerAddressSimple.middlename}}"/> + <argument name="lastname" type="string" defaultValue="{{CustomerAddressSimple.lastname}}"/> + <argument name="suffix" type="string" defaultValue="{{CustomerAddressSimple.suffix}}"/> + <argument name="company" type="string" defaultValue="{{CustomerAddressSimple.company}}"/> + <argument name="streetLine1" type="string" defaultValue="{{CustomerAddressSimple.street[0]}}"/> + <argument name="streetLine2" type="string" defaultValue="{{CustomerAddressSimple.street[1]}}"/> + <argument name="city" type="string" defaultValue="{{CustomerAddressSimple.city}}"/> + <argument name="countryId" type="string" defaultValue="{{CustomerAddressSimple.country_id}}"/> + <argument name="state" type="string" defaultValue="{{CustomerAddressSimple.state}}"/> + <argument name="province" type="string" defaultValue=""/> + <argument name="postcode" type="string" defaultValue="{{CustomerAddressSimple.postcode}}"/> + <argument name="telephone" type="string" defaultValue="{{CustomerAddressSimple.telephone}}"/> + <argument name="fax" type="string" defaultValue="{{CustomerAddressSimple.fax}}"/> + <argument name="vatNumber" type="string" defaultValue=""/> + </arguments> + + <waitForElementVisible selector="{{AdminOrderFormShippingAddressSection.NamePrefix}}" stepKey="waitForInputVisible"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.NamePrefix}}" userInput="{{prefix}}" stepKey="verifyPrefix"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.FirstName}}" userInput="{{firstname}}" stepKey="verifyFirstName"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.MiddleName}}" userInput="{{middleName}}" stepKey="verifyMiddleName"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.LastName}}" userInput="{{lastname}}" stepKey="verifyLastName"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.NameSuffix}}" userInput="{{suffix}}" stepKey="verifySuffix"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.Company}}" userInput="{{company}}" stepKey="verifyCompany"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.StreetLine1}}" userInput="{{streetLine1}}" stepKey="verifyStreetLine1"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.StreetLine2}}" userInput="{{streetLine2}}" stepKey="verifyStreetLine2"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.City}}" userInput="{{city}}" stepKey="verifyCity"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.Country}}" userInput="{{countryId}}" stepKey="verifyCountry"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.State}}" userInput="{{state}}" stepKey="verifyState"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.Province}}" userInput="{{province}}" stepKey="verifyProvince"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.PostalCode}}" userInput="{{postcode}}" stepKey="verifyPostalCode"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.Phone}}" userInput="{{telephone}}" stepKey="verifyPhone"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.Fax}}" userInput="{{fax}}" stepKey="verifyFax"/> + <seeInField selector="{{AdminOrderFormShippingAddressSection.VatNumber}}" userInput="{{vatNumber}}" stepKey="verifyVatNumber"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml index 7d6e2048c9432..9c99b3140bc0c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml @@ -94,9 +94,7 @@ <requiredEntity createDataKey="createConfigProduct"/> <requiredEntity createDataKey="createConfigChildProduct1"/> </createData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml index 9f09a59fa8d5e..9680cbd1e289a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml @@ -35,9 +35,7 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct"> <field key="price">10.00</field> </createData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml index 33bc1a39ca11a..fa11b567fee95 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml @@ -57,10 +57,7 @@ </actionGroup> <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> - <!--Run re-index task--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!--Go to bundle product page--> <amOnPage url="{{StorefrontProductPage.url($$createCategory.name$$)}}" stepKey="navigateToBundleProductPage"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml index 5c61a8b089b97..f3ce8106c2730 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml @@ -27,7 +27,7 @@ <!-- Go to new order status page --> <actionGroup ref="AdminGoToOrderStatusPageActionGroup" stepKey="goToOrderStatusPage"/> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/> + <actionGroup ref="AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup" stepKey="clickCreateNewStatus"/> <!-- Fill the form and validate message --> <actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml index 84bda226c9512..f8e7be5fdb5b6 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml @@ -27,7 +27,7 @@ <!-- Go to new order status page --> <actionGroup ref="AdminGoToOrderStatusPageActionGroup" stepKey="goToOrderStatusPage"/> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/> + <actionGroup ref="AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup" stepKey="clickCreateNewStatus"/> <!-- Fill the form and validate message --> <actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml index f4ad885429189..c5fc6170d2782 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml @@ -27,7 +27,7 @@ <!-- Go to new order status page --> <actionGroup ref="AdminGoToOrderStatusPageActionGroup" stepKey="goToOrderStatusPage"/> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/> + <actionGroup ref="AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup" stepKey="clickCreateNewStatus"/> <!-- Fill the form and validate message --> <actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelClosedAndProcessingTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelClosedAndProcessingTest.xml new file mode 100644 index 0000000000000..2671cd6989c51 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelClosedAndProcessingTest.xml @@ -0,0 +1,100 @@ +<?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="AdminMassOrdersCancelClosedAndProcessingTest"> + <annotations> + <stories value="Mass Update Orders"/> + <title value="Mass cancel orders in status Processing, Closed"/> + <description value="Try to cancel orders in status Processing, Closed"/> + <severity value="MAJOR"/> + <testCaseId value="MC-16184"/> + <group value="sales"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> + + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="defaultSimpleProduct" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <createData entity="CustomerCart" stepKey="createCustomerCartOne"> + <requiredEntity createDataKey="createCustomer"/> + </createData> + <createData entity="CustomerCartItem" stepKey="addCartItemOne"> + <requiredEntity createDataKey="createCustomerCartOne"/> + <requiredEntity createDataKey="createProduct"/> + </createData> + <createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress"> + <requiredEntity createDataKey="createCustomerCartOne"/> + </createData> + <updateData createDataKey="createCustomerCartOne" entity="CustomerOrderPaymentMethod" stepKey="sendCustomerPaymentInformationOne"> + <requiredEntity createDataKey="createCustomerCartOne"/> + </updateData> + <createData entity="Invoice" stepKey="invoiceOrderOne"> + <requiredEntity createDataKey="createCustomerCartOne"/> + </createData> + + <createData entity="CustomerCart" stepKey="createCustomerCartTwo"> + <requiredEntity createDataKey="createCustomer"/> + </createData> + <createData entity="CustomerCartItem" stepKey="addCartItemTwo"> + <requiredEntity createDataKey="createCustomerCartTwo"/> + <requiredEntity createDataKey="createProduct"/> + </createData> + <createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddressTwo"> + <requiredEntity createDataKey="createCustomerCartTwo"/> + </createData> + <updateData createDataKey="createCustomerCartTwo" entity="CustomerOrderPaymentMethod" stepKey="sendCustomerPaymentInformationTwo"> + <requiredEntity createDataKey="createCustomerCartTwo"/> + </updateData> + <createData entity="Invoice" stepKey="invoiceOrderTwo"> + <requiredEntity createDataKey="createCustomerCartTwo"/> + </createData> + <createData entity="CreditMemo" stepKey="refundOrderTwo"> + <requiredEntity createDataKey="createCustomerCartTwo"/> + </createData> + </before> + <after> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + + <actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/> + <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/> + <grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCartOne.return$)}}" stepKey="getFirstOrderId"/> + <grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCartTwo.return$)}}" stepKey="getSecondOrderId"/> + + <actionGroup ref="AdminTwoOrderActionOnGridActionGroup" stepKey="massActionCancel"> + <argument name="action" value="Cancel"/> + <argument name="orderId" value="{$getFirstOrderId}"/> + <argument name="secondOrderId" value="{$getSecondOrderId}"/> + </actionGroup> + <see userInput="You cannot cancel the order(s)." stepKey="assertOrderCancelMassActionFailMessage"/> + + <actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="seeFirstOrder"> + <argument name="orderId" value="{$getFirstOrderId}"/> + <argument name="orderStatus" value="Processing"/> + </actionGroup> + <see userInput="{$getFirstOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertFirstOrderID"/> + <see userInput="Processing" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertFirstOrderStatus"/> + + <actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="seeSecondOrder"> + <argument name="orderId" value="{$getSecondOrderId}"/> + <argument name="orderStatus" value="Closed"/> + </actionGroup> + <see userInput="{$getSecondOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertSecondOrderID"/> + <see userInput="Closed" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertSecondStatus"/> + </test> +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml index 6eb4195524224..3400e07373f54 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml @@ -8,15 +8,18 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminMassOrdersCancelProcessingAndClosedTest"> + <test name="AdminMassOrdersCancelProcessingAndClosedTest" deprecated="Use AdminMassOrdersCancelClosedAndProcessingTest instead"> <annotations> <stories value="Mass Update Orders"/> - <title value="Mass cancel orders in status Processing, Closed"/> + <title value="DEPRECATED. Mass cancel orders in status Processing, Closed"/> <description value="Try to cancel orders in status Processing, Closed"/> <severity value="MAJOR"/> <testCaseId value="MC-16184"/> <group value="sales"/> <group value="mtf_migrated"/> + <skip> + <issueId value="DEPRECATED">Use AdminMassOrdersCancelClosedAndProcessingTest instead</issueId> + </skip> </annotations> <before> <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml index 41964cbf605da..592c8b7981bed 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml @@ -21,7 +21,6 @@ <before> <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> - <!-- Create Data --> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> <createData entity="_defaultCategory" stepKey="createCategory"/> <createData entity="defaultSimpleProduct" stepKey="createProduct"> @@ -29,43 +28,49 @@ </createData> </before> <after> - <!-- Delete data --> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <!-- Create order --> - <actionGroup ref="CreateOrderActionGroup" stepKey="createFirstOrder"> - <argument name="product" value="$$createProduct$$"/> - <argument name="customer" value="$$createCustomer$$"/> - </actionGroup> - <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> - <assertNotEmpty stepKey="assertOrderIdIsNotEmpty" after="getOrderId"> - <actualResult type="const">$getOrderId</actualResult> - </assertNotEmpty> - - <!-- Create Shipment for Order --> - <actionGroup ref="AdminCreateInvoiceAndShipmentActionGroup" stepKey="createShipment"/> + <createData entity="CustomerCart" stepKey="createCustomerCart"> + <requiredEntity createDataKey="createCustomer"/> + </createData> + <createData entity="CustomerCartItem" stepKey="addCartItem"> + <requiredEntity createDataKey="createCustomerCart"/> + <requiredEntity createDataKey="createProduct"/> + </createData> + <createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="createFirstOrder"> + <requiredEntity createDataKey="createCustomerCart"/> + </updateData> + <createData entity="Invoice" stepKey="invoiceOrder"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="getOrderId"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertOrderIdIsNotEmpty"/> + <createData entity="Shipment" stepKey="createShipment"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> - <!-- Navigate to backend: Go to Sales > Orders --> <actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/> + <grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCart.return$)}}" stepKey="grabOrderId"/> - <!-- Select Mass Action according to dataset: Hold --> <actionGroup ref="AdminOrderActionOnGridActionGroup" stepKey="actionHold"> <argument name="action" value="Hold"/> - <argument name="orderId" value="$getOrderId"/> + <argument name="orderId" value="$grabOrderId"/> </actionGroup> <see userInput="No order(s) were put on hold." stepKey="assertOrderOnHoldFailMessage"/> - <!--Assert order in orders grid --> <actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="seeFirstOrder"> - <argument name="orderId" value="{$getOrderId}"/> + <argument name="orderId" value="{$grabOrderId}"/> <argument name="orderStatus" value="Complete"/> </actionGroup> - <see userInput="{$getOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertOrderID"/> + <see userInput="{$grabOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertOrderID"/> <see userInput="Complete" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertOrderStatus"/> </test> </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml index 163da4917b50a..e8b842a48890e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml @@ -20,7 +20,6 @@ </annotations> <before> <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> - <!-- Create Data --> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> <createData entity="_defaultCategory" stepKey="createCategory"/> <createData entity="defaultSimpleProduct" stepKey="createProduct"> @@ -28,40 +27,43 @@ </createData> </before> <after> - <!-- Delete data --> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <!-- Create order --> - <actionGroup ref="CreateOrderActionGroup" stepKey="createOrder"> - <argument name="product" value="$$createProduct$$"/> - <argument name="customer" value="$$createCustomer$$"/> - </actionGroup> - <grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/> - <assertNotEmpty stepKey="assertOrderIdIsNotEmpty" after="getOrderId"> - <actualResult type="const">$getOrderId</actualResult> - </assertNotEmpty> + <createData entity="CustomerCart" stepKey="createCustomerCart"> + <requiredEntity createDataKey="createCustomer"/> + </createData> + <createData entity="CustomerCartItem" stepKey="addCartItem"> + <requiredEntity createDataKey="createCustomerCart"/> + <requiredEntity createDataKey="createProduct"/> + </createData> + <createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="createOrder"> + <requiredEntity createDataKey="createCustomerCart"/> + </updateData> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="getOrderId"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertOrderIdIsNotEmpty"/> - <!-- Navigate to backend: Go to Sales > Orders --> <actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/> + <grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCart.return$)}}" stepKey="grabOrderId"/> - <!-- Select Mass Action according to dataset: Cancel --> <actionGroup ref="AdminOrderActionOnGridActionGroup" stepKey="ActionCancel"> <argument name="action" value="Cancel"/> - <argument name="orderId" value="$getOrderId"/> + <argument name="orderId" value="$grabOrderId"/> </actionGroup> <see userInput="We canceled 1 order(s)." stepKey="assertOrderCancelMassActionSuccessMessage"/> - <!--Assert orders in orders grid --> <actionGroup ref="AdminOrderFilterByOrderIdAndStatusActionGroup" stepKey="filterOrder"> - <argument name="orderId" value="{$getOrderId}"/> + <argument name="orderId" value="{$grabOrderId}"/> <argument name="orderStatus" value="Canceled"/> </actionGroup> - <see userInput="{$getOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertOrderID"/> + <see userInput="{$grabOrderId}" selector="{{AdminOrdersGridSection.gridCell('1','ID')}}" stepKey="assertOrderID"/> <see userInput="Canceled" selector="{{AdminOrdersGridSection.gridCell('1','Status')}}" stepKey="assertOrderStatus"/> </test> </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml index 4799984b76745..f24ac5c587913 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml @@ -29,9 +29,7 @@ <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToAdminCatalogPriceRuleGridPage2"/> <!-- It sometimes is loading too long for default 10s --> <waitForPageLoad time="60" stepKey="waitForPageFullyLoaded2"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml index 0224bca9d96ac..814be5ccd86bf 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml @@ -26,7 +26,7 @@ <!--Go to new order status page--> <actionGroup ref="AdminGoToOrderStatusPageActionGroup" stepKey="goToOrderStatusPage"/> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/> + <actionGroup ref="AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup" stepKey="clickCreateNewStatus"/> <!--Fill the form and validate save success message--> <actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml index 861a5a5bf42df..ac17d41c43c3d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml @@ -49,7 +49,7 @@ <!-- Create order status --> <actionGroup ref="AdminGoToOrderStatusPageActionGroup" stepKey="goToOrderStatusPage"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForOrderStatusPageLoad"/> - <click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/> + <actionGroup ref="AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup" stepKey="clickCreateNewStatus"/> <!-- Fill form and validate message --> <actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml index 08d5776b79ea0..32668bc5c857d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml @@ -75,9 +75,7 @@ <requiredEntity createDataKey="createConfigProduct"/> <requiredEntity createDataKey="createConfigChildProduct1"/> </createData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml index 452d65ea5ae57..850dd9e1b5795 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml @@ -57,9 +57,7 @@ <!-- Change configuration --> <magentoCLI command="config:set reports/options/enabled 1" stepKey="enableReportModule"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> </before> <after> <!-- Admin logout --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml index 6b6b0b2ef4a16..8e41247a37b54 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml @@ -89,10 +89,7 @@ <!-- Customer is created --> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> - <!-- Reindex and flush the cache to display products on the category page --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index 638ac7e66f769..79bc1e3a8df36 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -142,9 +142,10 @@ endif; ?> order.bindAddressFields('{$block->escapeJs($_addressChoiceContainerId)}'); script; - if ($block->getIsShipping() && $block->getIsAsBilling()): - $scriptString .= <<<script - order.disableShippingAddress(true); + if ($block->getIsShipping()): + $disable = $block->getIsAsBilling() ? 'true' : 'false'; + $scriptString .= <<<script + order.disableShippingAddress({$disable}); script; endif; diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml index 8df45937bb542..7e5daa3d31ddb 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml @@ -56,9 +56,7 @@ <createData entity="SimpleProduct2" stepKey="createSimpleProductThird"> <field key="price">5.50</field> </createData> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index 8c468cce91829..ce2a9a7691fbb 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -23,10 +23,7 @@ <!-- Create product with description --> <createData entity="SimpleProductWithDescription" stepKey="simpleProduct"/> - <!-- Perform reindex and flush cache --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml index fb1f35730fd80..57fc8fbf343c1 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml @@ -25,10 +25,7 @@ <!--Create Simple Product --> <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> - <!-- Perform reindex and flush cache --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml index 1558f9aa5342b..567f88c0d612c 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml @@ -25,10 +25,7 @@ <!-- Create product with short description --> <createData entity="ApiProductWithDescription" stepKey="product"/> - <!-- Perform reindex and flush cache --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml index 19c12843c23a2..1f9213ced0144 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml @@ -25,10 +25,7 @@ <!--Create Simple Product --> <createData entity="defaultSimpleProduct" stepKey="simpleProduct"/> - <!-- Perform reindex and flush cache --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml index 0d709e1d08006..de45cbf9bb2fe 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml @@ -19,6 +19,22 @@ <before> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> <createData entity="SimpleProduct2" stepKey="createSimpleProduct"/> + <createData entity="CustomerCart" stepKey="createCustomerCart"> + <requiredEntity createDataKey="createCustomer"/> + </createData> + <createData entity="CustomerCartItem" stepKey="addCartItem"> + <requiredEntity createDataKey="createCustomerCart"/> + <requiredEntity createDataKey="createSimpleProduct"/> + </createData> + <createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> + <updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="sendCustomerPaymentInformation"> + <requiredEntity createDataKey="createCustomerCart"/> + </updateData> + <createData entity="Shipment" stepKey="shipOrder"> + <requiredEntity createDataKey="createCustomerCart"/> + </createData> <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> </before> <after> @@ -26,12 +42,11 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <actionGroup ref="CreateOrderActionGroup" stepKey="goToCreateOrderPage"> - <argument name="customer" value="$$createCustomer$$"/> - <argument name="product" value="$$createSimpleProduct$$"/> - </actionGroup> - <grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/> - <actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="createShipmentForOrder"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToCreateOrderPage"/> + <actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="openOrdersGrid"/> + <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/> + <grabTextFrom selector="{{AdminOrdersGridSection.orderIdByIncrementId($createCustomerCart.return$)}}" stepKey="orderId"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="createShipmentForOrder"/> <actionGroup ref="FilterShipmentGridByOrderIdActionGroup" stepKey="filterForNewlyCreatedShipment"> <argument name="orderId" value="$orderId"/> </actionGroup> diff --git a/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml index 442ee99e12793..3219877cc6426 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml @@ -38,9 +38,7 @@ <argument name="storeGroupName" value="SecondStoreGroupUnique.name"/> </actionGroup> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml index b661ecb338bde..91b918714a9c4 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml @@ -29,10 +29,7 @@ <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('3')}}" userInput="123456789012345678901" stepKey="fillSwatch3" after="clickAddSwatch3"/> <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('3')}}" userInput="123456789012345678901BrownD" stepKey="fillDescription3" after="fillSwatch3"/> - <!--Run re-index task--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <see selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '3')}}" userInput="123456789012345678901" stepKey="seeGreen" after="seeBlue"/> <see selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '4')}}" userInput="123456789012345678901" stepKey="seeBrown" after="seeGreen"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index 4ed8824d9e39b..159b57f3a39f8 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -103,10 +103,7 @@ <argument name="image" value="TestImageAdobe"/> </actionGroup> - <!-- Run re-index task--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!-- Go to the category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml index 4a78b4380fb68..a7aff1a7c89ff 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml @@ -80,10 +80,7 @@ <argument name="attributeCode" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> - <!--Run re-index task--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!-- Go to the category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml index 2a986463a3d14..902d1a8f21c33 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml @@ -92,10 +92,7 @@ <argument name="attributeCode" value="{{ProductAttributeFrontendLabel.label}}"/> </actionGroup> - <!-- Run re-index task--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!-- Go to the category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml index 50963a105efa5..b312f8db69e81 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml @@ -70,10 +70,7 @@ <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnGenerateProductsButton"/> <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> - <!-- Perform reindex and flush cache --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/> <!--Select any option in the Layered navigation and verify product image--> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup.xml new file mode 100644 index 0000000000000..1c2c72a661ce1 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup.xml @@ -0,0 +1,21 @@ +<?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="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup"> + <annotations> + <description>Fill the Filter By Tax Identifier field with taxRateCode.</description> + </annotations> + <arguments> + <argument name="taxRateCode" type="string"/> + </arguments> + + <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{taxRateCode}}" stepKey="fillNameFilter"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml index 7fa1daeb063ca..0ede3caacd867 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml @@ -44,7 +44,9 @@ <!-- Verify the tax rate grid page shows the tax rate we just created --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{SimpleTaxRate.code}}" stepKey="fillNameFilter"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillNameFilter"> + <argument name="taxRateCode" value="{{SimpleTaxRate.code}}"/> + </actionGroup> <selectOption selector="{{AdminTaxRateGridSection.filterByCountry}}" userInput="Australia" stepKey="fillCountryFilter"/> <fillField selector="{{AdminTaxRateGridSection.filterByPostCode}}" userInput="*" stepKey="fillPostCodeFilter"/> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch"/> @@ -55,7 +57,9 @@ <!-- Go to the tax rate edit page for our new tax rate --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex3"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{SimpleTaxRate.code}}" stepKey="fillNameFilter2"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillNameFilter2"> + <argument name="taxRateCode" value="{{SimpleTaxRate.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml index e189e45483197..cb597273e36b6 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml @@ -46,7 +46,9 @@ <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <!-- Create a tax rate for large postcodes and verify we see expected values on the tax rate grid page --> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{SimpleTaxRate.code}}" stepKey="fillTaxIdentifierField2"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField2"> + <argument name="taxRateCode" value="{{SimpleTaxRate.code}}"/> + </actionGroup> <selectOption selector="{{AdminTaxRateGridSection.filterByCountry}}" userInput="France" stepKey="selectCountry2" /> <fillField selector="{{AdminTaxRateGridSection.filterByPostCode}}" userInput="*" stepKey="seeTaxPostCode1"/> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml index 9a5566c2db881..46d3582681c56 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml @@ -46,7 +46,9 @@ <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <!-- Verify the tax rate grid page shows the specific postcode we just created --> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{SimpleTaxRate.code}}" stepKey="fillTaxIdentifierField2"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField2"> + <argument name="taxRateCode" value="{{SimpleTaxRate.code}}"/> + </actionGroup> <selectOption selector="{{AdminTaxRateGridSection.filterByCountry}}" userInput="Canada" stepKey="fillCountryFilter"/> <fillField selector="{{AdminTaxRateGridSection.filterByPostCode}}" userInput="180" stepKey="fillPostCodeFilter"/> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml index 48217628b927a..f428aabddcf9a 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml @@ -46,7 +46,9 @@ <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <!-- Create a tax rate for zipCodeRange and verify we see expected values on the tax rate grid page --> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{SimpleTaxRate.code}}" stepKey="fillTaxIdentifierField2"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField2"> + <argument name="taxRateCode" value="{{SimpleTaxRate.code}}"/> + </actionGroup> <selectOption selector="{{AdminTaxRateGridSection.filterByCountry}}" userInput="United Kingdom" stepKey="selectCountry2" /> <fillField selector="{{AdminTaxRateGridSection.filterByPostCode}}" userInput="1-7800935" stepKey="seeTaxPostCode1"/> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml index d237e52a60472..0e541b8939053 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml @@ -47,7 +47,9 @@ <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <!-- Create a tax rate for zipCodeRange and verify we see expected values on the tax rate grid page --> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{SimpleTaxRate.code}}" stepKey="fillTaxIdentifierField2"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField2"> + <argument name="taxRateCode" value="{{SimpleTaxRate.code}}"/> + </actionGroup> <selectOption selector="{{AdminTaxRateGridSection.filterByCountry}}" userInput="United States" stepKey="selectCountry2" /> <fillField selector="{{AdminTaxRateGridSection.filterByPostCode}}" userInput="90001-96162" stepKey="seeTaxPostCode1"/> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml index 3abdb45faf95a..5f288d55b5d05 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml @@ -37,7 +37,9 @@ <!-- Confirm Deleted TaxIdentifier(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRate.code}}" stepKey="fillTaxIdentifierField3"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField3"> + <argument name="taxRateCode" value="{{defaultTaxRate.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <see selector="{{AdminTaxRateGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeSuccess"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml index b102b4d945019..6f7ef59788f68 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml @@ -29,7 +29,9 @@ <!-- Search the tax rate on tax grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex1"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillCode"> + <argument name="taxRateCode" value="$$initialTaxRate.code$$"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> @@ -46,7 +48,9 @@ <!-- Verify we see updated 0.1 tax rate(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex4"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{taxRateCustomRateFrance.code}}" stepKey="fillTaxIdentifierField3"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField3"> + <argument name="taxRateCode" value="{{taxRateCustomRateFrance.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> <!-- Verify we see updated 0.1 tax rate on the tax rate form page --> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml index 115a1df4631e5..c7663acf97a14 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml @@ -29,7 +29,9 @@ <!-- Search the tax rate on tax grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex1"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillCode"> + <argument name="taxRateCode" value="$$initialTaxRate.code$$"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> @@ -45,7 +47,9 @@ <!-- Verify we see updated TaxIdentifier(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex4"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{taxRateCustomRateUS.code}}" stepKey="fillTaxIdentifierField3"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField3"> + <argument name="taxRateCode" value="{{taxRateCustomRateUS.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> <!-- Verify we see updated values on the tax rate form page --> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml index 5594cf58e7b21..5776925354e80 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml @@ -29,7 +29,9 @@ <!-- Search the tax identifier on tax grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex1"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode1"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillCode1"> + <argument name="taxRateCode" value="$$initialTaxRate.code$$"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> @@ -46,7 +48,9 @@ <!-- Verify we see updated tax rate(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{taxRateCustomRateUK.code}}" stepKey="fillTaxIdentifierField2"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField2"> + <argument name="taxRateCode" value="{{taxRateCustomRateUK.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> <!-- Verify we see updated tax rate on the tax rate form page --> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml index da531ea373aa1..c4449e5d6e5ad 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml @@ -29,7 +29,10 @@ <!-- Search the tax rate on tax grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex1"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillCode"> + <argument name="taxRateCode" value="$$initialTaxRate.code$$"/> + </actionGroup> + <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> @@ -45,7 +48,9 @@ <!-- Verify we see updated any region tax rate(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{taxRateCustomRateCanada.code}}" stepKey="fillTaxIdentifierField3"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField3"> + <argument name="taxRateCode" value="{{taxRateCustomRateCanada.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> <!-- Verify we see updated any region tax rate on the tax rate form page --> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml index 717d9b9428267..2bac4ca2115c0 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml @@ -29,7 +29,9 @@ <!-- Search the tax rate on tax grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex1"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillCode"> + <argument name="taxRateCode" value="$$initialTaxRate.code$$"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> @@ -47,7 +49,9 @@ <!-- Verify we see updated tax rate(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex2"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRateWithZipRange.code}}" stepKey="fillTaxIdentifierField3"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField3"> + <argument name="taxRateCode" value="{{defaultTaxRateWithZipRange.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> <!-- Verify we see updated tax rate on the tax rate form page --> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml index b664d334162ed..c808de2d7f10d 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml @@ -29,7 +29,10 @@ <!-- Search the tax rate on tax grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex1"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters1"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillCode"> + <argument name="taxRateCode" value="$$initialTaxRate.code$$"/> + </actionGroup> + <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> @@ -44,7 +47,9 @@ <!-- Verify we see updated large tax rate(from the above step) on the tax rate grid page --> <actionGroup ref="AdminTaxRateGridOpenPageActionGroup" stepKey="goToTaxRateIndex4"/> <actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickClearFilters2"/> - <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRateWithLargeRate.code}}" stepKey="fillTaxIdentifierField3"/> + <actionGroup ref="AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup" stepKey="fillTaxIdentifierField3"> + <argument name="taxRateCode" value="{{defaultTaxRateWithLargeRate.code}}"/> + </actionGroup> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> <!-- Verify we see updated large tax rate on the tax rate form page --> diff --git a/app/code/Magento/Theme/etc/frontend/di.xml b/app/code/Magento/Theme/etc/frontend/di.xml index 35eb9d4f8b53c..f0b7f19911e12 100644 --- a/app/code/Magento/Theme/etc/frontend/di.xml +++ b/app/code/Magento/Theme/etc/frontend/di.xml @@ -27,7 +27,7 @@ <plugin name="result-messages" type="Magento\Theme\Controller\Result\MessagePlugin"/> </type> <type name="Magento\Framework\View\Result\Layout"> - <plugin name="asyncCssLoad" type="Magento\Theme\Controller\Result\AsyncCssPlugin" /> + <plugin name="asyncCssLoad" type="Magento\Theme\Controller\Result\AsyncCssPlugin" sortOrder="-20" /> <plugin name="deferJsToFooter" type="Magento\Theme\Controller\Result\JsFooterPlugin" sortOrder="-10" /> </type> <type name="Magento\Theme\Block\Html\Header\CriticalCss"> diff --git a/app/code/Magento/Ui/Component/Filters.php b/app/code/Magento/Ui/Component/Filters.php index 5bf89ae7936e9..aa418a4522044 100644 --- a/app/code/Magento/Ui/Component/Filters.php +++ b/app/code/Magento/Ui/Component/Filters.php @@ -5,6 +5,8 @@ */ namespace Magento\Ui\Component; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponent\ObserverInterface; use Magento\Framework\View\Element\UiComponentFactory; @@ -47,16 +49,42 @@ class Filters extends AbstractComponent implements ObserverInterface protected $uiComponentFactory; /** - * @inheritDoc + * @var TimezoneInterface + */ + private $localeDate; + + /** + * Filters constructor. + * + * @param ContextInterface $context + * @param UiComponentFactory $uiComponentFactory + * @param array $components + * @param array $data + * @param TimezoneInterface|null $localeDate */ public function __construct( ContextInterface $context, UiComponentFactory $uiComponentFactory, array $components = [], - array $data = [] + array $data = [], + ?TimezoneInterface $localeDate = null ) { parent::__construct($context, $components, $data); $this->uiComponentFactory = $uiComponentFactory; + $this->localeDate = $localeDate ?? ObjectManager::getInstance()->get(TimezoneInterface::class); + } + + /** + * @inheritDoc + */ + public function prepare() + { + $config = $this->getData('config'); + // Set date format pattern by current locale + $localeDateFormat = $this->localeDate->getDateFormat(); + $config['options']['dateFormat'] = $localeDateFormat; + $this->setData('config', $config); + parent::prepare(); } /** diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js index 848ad60219a2b..9377d25b82e2e 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js @@ -124,7 +124,10 @@ define([ * * @returns {Filters} Chainable. */ - initialize: function () { + initialize: function (config) { + if (typeof config.options !== 'undefined' && config.options.dateFormat) { + this.constructor.defaults.templates.filters.dateRange.dateFormat = config.options.dateFormat; + } _.bindAll(this, 'updateActive'); this._super() diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js index 1949234c89324..39f2da98b3cba 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js @@ -59,7 +59,10 @@ define([ * * @returns {Range} Chainable. */ - initialize: function () { + initialize: function (config) { + if (config.dateFormat) { + this.constructor.defaults.templates.date.pickerDefaultDateFormat = config.dateFormat; + } this._super() .initChildren(); diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleAndSetLocaleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleAndSetLocaleActionGroup.xml new file mode 100644 index 0000000000000..d9fc4e488f2c8 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserWithRoleAndSetLocaleActionGroup.xml @@ -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"> + <!-- Create new user with role and locale setting--> + <actionGroup name="AdminCreateUserWithRoleAndLocaleActionGroup" extends="AdminCreateUserWithRoleActionGroup"> + <arguments> + <argument name="interfaceLocale" defaultValue="en_US" type="string"/> + </arguments> + + <selectOption selector="{{AdminNewUserFormSection.interfaceLocale}}" userInput="{{interfaceLocale}}" stepKey="setInterfaceLocate" after="confirmPassword"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html b/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html index 42240bff3b8db..374713cad91d6 100644 --- a/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html +++ b/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html @@ -7,10 +7,10 @@ <!--@subject {{trans "Password Reset Confirmation for %name" name=$username}} @--> <!--@vars { "var store.frontend_name":"Store Name", -"var user.id":"Account Holder Id", +"var user.user_id":"Account Holder Id", "var user.rp_token":"Reset Password Token", "var user.name":"Account Holder Name", -"store url=\"admin\/auth\/resetpassword\/\" _query_id=$user.id _query_token=$user.rp_token":"Reset Password URL", +"store url=\"admin\/auth\/resetpassword\/\" _query_id=$user.user_id _query_token=$user.rp_token":"Reset Password URL", "var username":"Account Holder Name" } @--> @@ -20,7 +20,7 @@ {{trans "If you requested this change, reset your password here:"}} -{{store url="admin/auth/resetpassword/" _query_id=$user.id _query_token=$user.rp_token _nosid=1}} +{{store url="admin/auth/resetpassword/" _query_id=$user.user_id _query_token=$user.rp_token _nosid=1}} {{trans "If you did not make this request, you can ignore this email and your password will remain the same."}} diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php index 94c2b74e8ea96..b10018aa07332 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php @@ -4,100 +4,175 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Api; +use Magento\Catalog\Model\ProductLink\Link; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Webapi\Rest\Request; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\WebapiAbstract; +/** + * Class checks product relations functionality + * + * @see \Magento\Catalog\Api\ProductLinkRepositoryInterface + */ class ProductLinkRepositoryInterfaceTest extends WebapiAbstract { + /** + * @var string + */ const SERVICE_NAME = 'catalogProductLinkRepositoryV1'; + + /** + * @var string + */ const SERVICE_VERSION = 'V1'; + + /** + * @var string + */ const RESOURCE_PATH = '/V1/products/'; /** - * @var \Magento\Framework\ObjectManagerInterface + * @var ObjectManagerInterface */ - protected $objectManager; + private $objectManager; + /** + * @var ProductLinkManagementInterface + */ + private $linkManagement; + + /** + * @inheritdoc + */ protected function setUp(): void { + parent::setUp(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->linkManagement = $this->objectManager->get(ProductLinkManagementInterface::class); } /** * @magentoApiDataFixture Magento/Catalog/_files/products_related_multiple.php - * @magentoAppIsolation enabled + * + * @return void */ - public function testDelete() + public function testDelete(): void { $productSku = 'simple_with_cross'; - $linkedSku = 'simple'; $linkType = 'related'; - $this->_webApiCall( - [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . $productSku . '/links/' . $linkType . '/' . $linkedSku, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'DeleteById', - ], - ], - [ - 'sku' => $productSku, - 'type' => $linkType, - 'linkedProductSku' => $linkedSku - ] - ); - /** @var \Magento\Catalog\Model\ProductLink\Management $linkManagement */ - $linkManagement = $this->objectManager->create(\Magento\Catalog\Api\ProductLinkManagementInterface::class); - $linkedProducts = $linkManagement->getLinkedItemsByType($productSku, $linkType); + $this->deleteApiCall($productSku, $linkType, 'simple'); + $linkedProducts = $this->linkManagement->getLinkedItemsByType($productSku, $linkType); $this->assertCount(1, $linkedProducts); - /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $product */ $product = current($linkedProducts); - $this->assertEquals($product->getLinkedProductSku(), 'simple_with_cross_two'); + $this->assertEquals('simple_with_cross_two', $product->getLinkedProductSku()); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + * + * @return void + */ + public function testDeleteNotExistedProductLink(): void + { + $this->expectException(\Exception::class); + $this->expectExceptionMessage((string)__("Product %1 doesn't have linked %2 as %3")); + $this->deleteApiCall('simple', 'related', 'not_exists_product'); } /** * @magentoApiDataFixture Magento/Catalog/_files/products_related.php + * + * @return void */ - public function testSave() + public function testSave(): void { $productSku = 'simple_with_cross'; $linkType = 'related'; + $data = [ + 'entity' => [ + Link::KEY_SKU => 'simple_with_cross', + Link::KEY_LINK_TYPE => 'related', + Link::KEY_LINKED_PRODUCT_SKU => 'simple', + Link::KEY_LINKED_PRODUCT_TYPE => 'simple', + Link::KEY_POSITION => 1000, + ], + ]; + $this->saveApiCall($productSku, $data); + $actual = $this->linkManagement->getLinkedItemsByType($productSku, $linkType); + $this->assertCount(1, $actual, 'Invalid actual linked products count'); + $this->assertEquals(1000, $actual[0]->getPosition(), 'Product position is not updated'); + } - $serviceInfo = [ + /** + * Get service info for api call + * + * @param string $resourcePath + * @param string $httpMethod + * @param string $operation + * @return array + */ + private function getServiceInfo(string $resourcePath, string $httpMethod, string $operation): array + { + return [ 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . $productSku . '/links', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + 'resourcePath' => self::RESOURCE_PATH . $resourcePath, + 'httpMethod' => $httpMethod, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'Save', + 'operation' => self::SERVICE_NAME . $operation, ], ]; + } - $this->_webApiCall( + /** + * Make api call to delete product link + * + * @param string $productSku + * @param string $linkType + * @param string $linkedSku + * @return array|int|string|float|bool + */ + private function deleteApiCall(string $productSku, string $linkType, string $linkedSku) + { + $serviceInfo = $this->getServiceInfo( + $productSku . '/links/' . $linkType . '/' . $linkedSku, + Request::HTTP_METHOD_DELETE, + 'DeleteById' + ); + + return $this->_webApiCall( $serviceInfo, [ - 'entity' => [ - 'sku' => 'simple_with_cross', - 'link_type' => 'related', - 'linked_product_sku' => 'simple', - 'linked_product_type' => 'simple', - 'position' => 1000, - ] + 'sku' => $productSku, + 'type' => $linkType, + 'linkedProductSku' => $linkedSku, ] ); + } - /** @var \Magento\Catalog\Model\ProductLink\Management $linkManagement */ - $linkManagement = $this->objectManager->get(\Magento\Catalog\Api\ProductLinkManagementInterface::class); - $actual = $linkManagement->getLinkedItemsByType($productSku, $linkType); - $this->assertCount(1, $actual, 'Invalid actual linked products count'); - $this->assertEquals(1000, $actual[0]->getPosition(), 'Product position is not updated'); + /** + * Make api call to save product link + * + * @param string $productSku + * @param array $data + * @return array|bool|float|int|string + */ + private function saveApiCall(string $productSku, array $data) + { + $serviceInfo = $this->getServiceInfo( + $productSku . '/links', + Request::HTTP_METHOD_PUT, + 'Save' + ); + + return $this->_webApiCall($serviceInfo, $data); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php index 90fe075f91e30..a1e338fc304db 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php @@ -6,17 +6,20 @@ namespace Magento\Catalog\Api; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; use Magento\Framework\Webapi\Rest\Request; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\WebapiAbstract; /** * SpecialPriceStorage API operations test + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SpecialPriceStorageTest extends WebapiAbstract { @@ -24,6 +27,7 @@ class SpecialPriceStorageTest extends WebapiAbstract const SERVICE_VERSION = 'V1'; const SIMPLE_PRODUCT_SKU = 'simple'; const VIRTUAL_PRODUCT_SKU = 'virtual-product'; + private const PRODUCT_SKU_TWO_WEBSITES = 'simple-on-two-websites'; /** * @var ObjectManager @@ -31,11 +35,23 @@ class SpecialPriceStorageTest extends WebapiAbstract private $objectManager; /** - * Set up. + * @var ProductResource + */ + private $productResource; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @ingeritdoc */ protected function setUp(): void { $this->objectManager = Bootstrap::getObjectManager(); + $this->productResource = $this->objectManager->get(ProductResource::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); } /** @@ -128,6 +144,49 @@ public function testUpdate(array $data) $this->assertEmpty($response); } + /** + * Delete special price for specified store when price scope is global + * + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + * + * @return void + */ + public function testDeleteWhenPriceIsGlobal(): void + { + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/products/special-price-delete', + 'httpMethod' => Request::HTTP_METHOD_POST + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Delete', + ], + ]; + + $response = $this->_webApiCall( + $serviceInfo, + [ + 'prices' => [ + [ + 'price' => 777, + 'store_id' => 1, + 'sku' => self::SIMPLE_PRODUCT_SKU, + 'price_from' => '2037-01-19 03:14:07', + 'price_to' => '2038-01-19 03:14:07' + ] + ] + ] + ); + + $errorMessage = current(array_column($response, 'message')); + $this->assertStringContainsString( + 'Could not change non global Price when price scope is global.', + $errorMessage + ); + } + /** * Test delete method. * @@ -241,4 +300,60 @@ public function deleteData(): array ], ]; } + + /** + * Test delete method for specific store. + * + * @magentoApiDataFixture Magento/Catalog/_files/product_two_websites.php + * @magentoConfigFixture default_store catalog/price/scope 1 + * @return void + */ + public function testDeleteDataForSpecificStore(): void + { + $secondStoreViewId = $this->storeManager->getStore('fixture_second_store') + ->getId(); + + $data = [ + 'price' => 777, + 'store_id' => $secondStoreViewId, + 'sku' => self::PRODUCT_SKU_TWO_WEBSITES, + 'price_from' => '1970-01-01 00:00:01', + 'price_to' => false + ]; + + /** @var ProductRepositoryInterface $productRepository */ + $productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + $product = $productRepository->get($data['sku'], true, 1, true); + $product->setData('special_price', $data['price']); + $product->setData('special_from_date', $data['price_from']); + + $this->productResource->saveAttribute($product, 'special_price'); + $this->productResource->saveAttribute($product, 'special_from_date'); + $this->productResource->saveAttribute($product, 'special_to_date'); + + $product->setData('store_id', $secondStoreViewId); + $this->productResource->saveAttribute($product, 'special_price'); + $this->productResource->saveAttribute($product, 'special_from_date'); + $this->productResource->saveAttribute($product, 'special_to_date'); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/products/special-price-delete', + 'httpMethod' => Request::HTTP_METHOD_POST + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Delete', + ], + ]; + + $this->_webApiCall($serviceInfo, ['prices' => [$data]]); + + $product = $productRepository->get($data['sku'], false, 1, true); + $this->assertNotNull($product->getSpecialPrice()); + + $product = $productRepository->get($data['sku'], false, $secondStoreViewId, true); + $this->assertNull($product->getSpecialPrice()); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/AddTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/AddTest.php new file mode 100644 index 0000000000000..aaa98f1733061 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Category/AddTest.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Controller\Adminhtml\Category; + +use Magento\Catalog\Helper\DefaultCategory; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Tests for catalog category Add controller + * + * @see \Magento\Catalog\Controller\Adminhtml\Category\Add + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class AddTest extends AbstractBackendController +{ + /** + * @var DefaultCategory + */ + private $defaultCategoryHelper; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->defaultCategoryHelper = $this->_objectManager->get(DefaultCategory::class); + } + + /** + * @return void + */ + public function testExecuteWithoutParams(): void + { + $this->dispatch('backend/catalog/category/add'); + $this->assertRedirect($this->stringContains('catalog/category/index')); + } + + /** + * @return void + */ + public function testExecuteAsAjax(): void + { + $this->getRequest()->setQueryValue('isAjax', true); + $this->getRequest()->setParam('parent', $this->defaultCategoryHelper->getId()); + $this->dispatch('backend/catalog/category/add'); + $this->assertJson($this->getResponse()->getBody()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Category/ItemCollectionProviderTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Category/ItemCollectionProviderTest.php new file mode 100644 index 0000000000000..a533c7805a812 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Category/ItemCollectionProviderTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Layer\Category; + +use Magento\Catalog\Api\CategoryRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests for category collection provider. + * + * @see \Magento\Catalog\Model\Layer\Category\ItemCollectionProvider + * @magentoAppArea frontend + */ +class ItemCollectionProviderTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var CategoryRepositoryInterface */ + private $categoryRepository; + + /** @var ItemCollectionProvider */ + private $itemCollectionProvider; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->itemCollectionProvider = $this->objectManager->get(ItemCollectionProvider::class); + $this->categoryRepository = $this->objectManager->get(CategoryRepositoryInterface::class); + } + + /** + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Catalog/_files/category_product.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testGetCollection(): void + { + $category = $this->categoryRepository->get(333); + $categoryProductsCollection = $this->itemCollectionProvider->getCollection($category); + $this->assertCount(1, $categoryProductsCollection); + $this->assertEquals('simple333', $categoryProductsCollection->getFirstItem()->getSku()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php index f7444ca1caaae..321a8b996c32e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php @@ -3,32 +3,48 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Catalog\Model\Layer\Filter\DataProvider; +use Magento\Catalog\Model\Layer\Category; +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + /** * Test class for \Magento\Catalog\Model\Layer\Filter\DataProvider\Price. - * - * @magentoAppIsolation enabled */ -class PriceTest extends \PHPUnit\Framework\TestCase +class PriceTest extends TestCase { + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Price */ + private $model; + + /** @var Resolver */ + private $layerResolver; + + /** @var Category */ + private $layer; + + /** @var PriceFactory */ + private $dataProviderPriceFactory; + /** - * @var \Magento\Catalog\Model\Layer\Filter\DataProvider\Price + * @inheritdoc */ - protected $_model; - protected function setUp(): void { - $category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Category::class - ); - $category->load(4); - $layer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\Catalog\Model\Layer\Category::class); - $layer->setCurrentCategory($category); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create(\Magento\Catalog\Model\Layer\Filter\DataProvider\Price::class, ['layer' => $layer]); + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->layerResolver = $this->objectManager->get(Resolver::class); + $this->layer = $this->layerResolver->get(); + $this->dataProviderPriceFactory = $this->objectManager->get(PriceFactory::class); + $this->model = $this->dataProviderPriceFactory->create(['layer' => $this->layer]); } /** @@ -36,10 +52,12 @@ protected function setUp(): void * @magentoAppIsolation enabled * @magentoDbIsolation disabled * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation auto + * @return void */ - public function testGetPriceRangeAuto() + public function testGetPriceRangeAuto(): void { - $this->assertEquals(10, $this->_model->getPriceRange()); + $this->layer->setCurrentCategory(4); + $this->assertEquals(10, $this->model->getPriceRange()); } /** @@ -48,45 +66,108 @@ public function testGetPriceRangeAuto() * @magentoDbIsolation disabled * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual * @magentoConfigFixture current_store catalog/layered_navigation/price_range_step 1.5 + * @return void */ - public function testGetPriceRangeManual() + public function testGetPriceRangeManual(): void { // what you set is what you get - $this->assertEquals(1.5, $this->_model->getPriceRange()); + $this->layer->setCurrentCategory(4); + $this->assertEquals(1.5, $this->model->getPriceRange()); } /** * @magentoDataFixture Magento/Catalog/_files/categories.php * @magentoAppIsolation enabled * @magentoDbIsolation disabled + * @return void */ - public function testGetMaxPriceInt() + public function testGetMaxPriceInt(): void { - $this->assertEquals(45.00, $this->_model->getMaxPrice()); + $this->layer->setCurrentCategory(4); + $this->assertEquals(45.00, $this->model->getMaxPrice()); } /** * @return array */ - public function getRangeItemCountsDataProvider() + public function getRangeItemCountsDataProvider(): array { return [ // These are $inputRange, [$expectedItemCounts] values [1, [11 => 2, 46 => 1, 16 => '1']], [10, [2 => 3, 5 => 1]], [20, [1 => 3, 3 => 1]], - [50, [1 => 4]] + [50, [1 => 4]], ]; } /** + * @dataProvider getRangeItemCountsDataProvider * @magentoDataFixture Magento/Catalog/_files/categories.php + * @magentoAppIsolation enabled * @magentoDbIsolation disabled - * @dataProvider getRangeItemCountsDataProvider + * @param int $inputRange + * @param array $expectedItemCounts + * @return void + */ + public function testGetRangeItemCounts(int $inputRange, array $expectedItemCounts): void + { + $this->layer->setCurrentCategory(4); + $actualItemCounts = $this->model->getRangeItemCounts($inputRange); + $this->assertEquals($expectedItemCounts, $actualItemCounts); + } + + /** + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_max_intervals 3 + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual + * @magentoDataFixture Magento/Catalog/_files/products_for_search.php + * @return void */ - public function testGetRangeItemCounts($inputRange, $expectedItemCounts) + public function testGetRangeItemCountsManualCalculation(): void { - $actualItemCounts = $this->_model->getRangeItemCounts($inputRange); + $expectedItemCounts = [11 => '2', 21 => '1', 31 => 2]; + $this->layer->setCurrentCategory(333); + $actualItemCounts = $this->model->getRangeItemCounts(1); $this->assertEquals($expectedItemCounts, $actualItemCounts); } + + /** + * @dataProvider getAdditionalRequestDataDataProvider + * @param array $priceFilters + * @param string $expectedRequest + * @return void + */ + public function testGetAdditionalRequestData(array $priceFilters, string $expectedRequest): void + { + $filter = explode('-', $priceFilters[0]); + $this->model->setInterval($filter); + $priorFilters = $this->model->getPriorFilters($priceFilters); + if (!empty($priorFilters)) { + $this->model->setPriorIntervals($priorFilters); + } + + $actualRequest = $this->model->getAdditionalRequestData(); + $this->assertEquals($expectedRequest, $actualRequest); + } + + /** + * @return array + */ + public function getAdditionalRequestDataDataProvider(): array + { + return [ + 'with_prior_filters' => [ + 'price_filters' => ['10-11', '20-21', '30-31'], + 'expected_request' => ',10-11,20-21,30-31', + ], + 'without_prior_filters' => [ + 'price_filters' => ['10-11'], + 'expected_request' => ',10-11', + ], + 'not_valid_prior_filters' => [ + 'price_filters' => ['10-11', '20-21', '31', '40-41'], + 'expected_request' => ',10-11', + ], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/AbstractRelationsDataProviderTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/AbstractRelationsDataProviderTest.php new file mode 100644 index 0000000000000..1254468ada10f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/AbstractRelationsDataProviderTest.php @@ -0,0 +1,125 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Ui\DataProvider\Product\Related; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\Element\UiComponentFactory; +use Magento\Framework\View\Element\UiComponentInterface; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\TestCase; +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Base logic for relations data providers checks + */ +abstract class AbstractRelationsDataProviderTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var UiComponentFactory */ + private $componentFactory; + + /** @var RequestInterface */ + private $request; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->request = $this->objectManager->get(RequestInterface::class); + $this->componentFactory = $this->objectManager->get(UiComponentFactory::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + } + + /** + * Assert grid result data + * + * @param int $expectedCount + * @param array $expectedData + * @param array $actualResult + * @return void + */ + protected function assertResult(int $expectedCount, array $expectedData, array $actualResult): void + { + $this->assertCount($expectedCount, $actualResult); + $item = reset($actualResult); + foreach ($expectedData as $key => $data) { + $this->assertEquals($item[$key], $data); + } + } + + /** + * Get component provided data + * + * @param string $namespace + * @return array + */ + protected function getComponentProvidedData(string $namespace): array + { + $component = $this->componentFactory->create($namespace); + $this->prepareChildComponents($component); + + return $component->getContext()->getDataProvider()->getData(); + } + + /** + * Prepare request + * + * @param string $productSku + * @param string $relatedProductSku + * @param string $storeCode + * @return void + */ + protected function prepareRequest(string $productSku, string $relatedProductSku, string $storeCode): void + { + $storeId = (int)$this->storeManager->getStore($storeCode)->getId(); + $productId = (int)$this->productRepository->get($productSku)->getId(); + $relatedProductId = (int)$this->productRepository->get($relatedProductSku)->getId(); + $params = [ + 'current_product_id' => $productId, + 'current_store_id' => $storeId, + 'filters_modifier' => [ + 'entity_id' => [ + 'condition_type' => 'nin', + 'value' => [$relatedProductId], + ], + ], + ]; + + $this->request->setParams($params); + } + + /** + * Call prepare method in the child components + * + * @param UiComponentInterface $component + * @return void + */ + private function prepareChildComponents(UiComponentInterface $component): void + { + foreach ($component->getChildComponents() as $child) { + $this->prepareChildComponents($child); + } + + $component->prepare(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/CrossSellDataProviderTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/CrossSellDataProviderTest.php new file mode 100644 index 0000000000000..43662b6bb15f2 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/CrossSellDataProviderTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Ui\DataProvider\Product\Related; + +/** + * Checks cross-sell products data provider + * + * @see \Magento\Catalog\Ui\DataProvider\Product\Related\CrossSellDataProvider + * + * @magentoAppArea adminhtml + * @magentoDbIsolation disabled + */ +class CrossSellDataProviderTest extends AbstractRelationsDataProviderTest +{ + /** + * @dataProvider productDataProvider + * + * @magentoDataFixture Magento/Catalog/_files/products_crosssell.php + * @magentoDataFixture Magento/Catalog/_files/product_with_price_on_second_website.php + * + * @param string $storeCode + * @param float $price + * @return void + */ + public function testGetData(string $storeCode, float $price): void + { + $this->prepareRequest('simple_with_cross', 'simple', $storeCode); + $result = $this->getComponentProvidedData('crosssell_product_listing')['items']; + $this->assertResult(1, ['sku' => 'second-website-price-product', 'price' => $price], $result); + } + + /** + * @return array + */ + public function productDataProvider(): array + { + return [ + 'without_store_code' => [ + 'store_code' => 'default', + 'product_price' => 20, + ], + 'with_store_code' => [ + 'store_code' => 'fixture_second_store', + 'product_price' => 10, + ], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/UpSellDataProviderTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/UpSellDataProviderTest.php index a256b0bbee08a..268ae8becccf1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/UpSellDataProviderTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/UpSellDataProviderTest.php @@ -7,15 +7,6 @@ namespace Magento\Catalog\Ui\DataProvider\Product\Related; -use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\App\RequestInterface; -use Magento\Framework\ObjectManagerInterface; -use Magento\Framework\View\Element\UiComponentFactory; -use Magento\Framework\View\Element\UiComponentInterface; -use Magento\Store\Model\StoreManagerInterface; -use PHPUnit\Framework\TestCase; -use Magento\TestFramework\Helper\Bootstrap; - /** * Checks up-sell products data provider * @@ -24,37 +15,8 @@ * @magentoAppArea adminhtml * @magentoDbIsolation disabled */ -class UpSellDataProviderTest extends TestCase +class UpSellDataProviderTest extends AbstractRelationsDataProviderTest { - /** @var ObjectManagerInterface */ - private $objectManager; - - /** @var UiComponentFactory */ - private $componentFactory; - - /** @var RequestInterface */ - private $request; - - /** @var ProductRepositoryInterface */ - private $productRepository; - - /** @var StoreManagerInterface */ - private $storeManager; - - /** - * @inheritdoc - */ - protected function setUp(): void - { - parent::setUp(); - - $this->objectManager = Bootstrap::getObjectManager(); - $this->request = $this->objectManager->get(RequestInterface::class); - $this->componentFactory = $this->objectManager->get(UiComponentFactory::class); - $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); - $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); - } - /** * @dataProvider productDataProvider * @@ -69,10 +31,7 @@ public function testGetData(string $storeCode, float $price): void { $this->prepareRequest('simple_with_upsell', 'simple', $storeCode); $result = $this->getComponentProvidedData('upsell_product_listing')['items']; - $this->assertCount(1, $result); - $item = reset($result); - $this->assertEquals($item['sku'], 'second-website-price-product'); - $this->assertEquals($price, (float)$item['price']); + $this->assertResult(1, ['sku' => 'second-website-price-product', 'price' => $price], $result); } /** @@ -91,60 +50,4 @@ public function productDataProvider(): array ], ]; } - - /** - * Get component provided data - * - * @param string $namespace - * @return array - */ - private function getComponentProvidedData(string $namespace): array - { - $component = $this->componentFactory->create($namespace); - $this->prepareChildComponents($component); - - return $component->getContext()->getDataProvider()->getData(); - } - - /** - * Call prepare method in the child components - * - * @param UiComponentInterface $component - * @return void - */ - private function prepareChildComponents(UiComponentInterface $component): void - { - foreach ($component->getChildComponents() as $child) { - $this->prepareChildComponents($child); - } - - $component->prepare(); - } - - /** - * Prepare request - * - * @param string $productSku - * @param string $relatedProductSku - * @param string $storeCode - * @return void - */ - private function prepareRequest(string $productSku, string $relatedProductSku, string $storeCode): void - { - $storeId = (int)$this->storeManager->getStore($storeCode)->getId(); - $productId = (int)$this->productRepository->get($productSku)->getId(); - $relatedProductId = (int)$this->productRepository->get($relatedProductSku)->getId(); - $params = [ - 'current_product_id' => $productId, - 'current_store_id' => $storeId, - 'filters_modifier' => [ - 'entity_id' => [ - 'condition_type' => 'nin', - 'value' => [$relatedProductId], - ], - ], - ]; - - $this->request->setParams($params); - } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_disabled_image.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_disabled_image.php new file mode 100644 index 0000000000000..fac0144dd1332 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_disabled_image.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\Store\Model\Store; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + +Resolver::getInstance()->requireDataFixture('Magento/Catalog/_files/product_image.php'); + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductResource $productResource */ +$productResource = $objectManager->get(ProductResource::class); +/** @var ProductInterfaceFactory $productFactory */ +$productFactory = $objectManager->get(ProductInterfaceFactory::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$baseWebsiteId = (int)$websiteRepository->get('base')->getId(); +$product = $productFactory->create(); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$baseWebsiteId]) + ->setName('Simple product with disabled image') + ->setSku('simple_with_disabled_img') + ->setPrice(10) + ->setMetaTitle('meta title2') + ->setMetaKeyword('meta keyword2') + ->setMetaDescription('meta description2') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 0]) + ->setStoreId(Store::DEFAULT_STORE_ID) + ->setImage('/m/a/magento_image.jpg') + ->setSmallImage('/m/a/magento_image.jpg') + ->setThumbnail('/m/a/magento_image.jpg') + ->setData( + 'media_gallery', + [ + 'images' => [ + [ + ProductAttributeMediaGalleryEntryInterface::FILE => '/m/a/magento_image.jpg', + ProductAttributeMediaGalleryEntryInterface::POSITION => 1, + ProductAttributeMediaGalleryEntryInterface::LABEL => 'Image Alt Text', + ProductAttributeMediaGalleryEntryInterface::DISABLED => 1, + ProductAttributeMediaGalleryEntryInterface::MEDIA_TYPE => 'image', + ], + ], + ] + ) + ->setCanSaveCustomOptions(true); + +$productResource->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_disabled_image_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_disabled_image_rollback.php new file mode 100644 index 0000000000000..a6d78e7ffb40f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_disabled_image_rollback.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +try { + $productRepository->deleteById('simple_with_disabled_img'); +} catch (NoSuchEntityException $e) { + //already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +Resolver::getInstance()->requireDataFixture('Magento/Catalog/_files/product_image_rollback.php'); diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php index 5197daa759e04..247a9ab34eb36 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php @@ -9,11 +9,12 @@ namespace Magento\Cms\Model\Page; use Magento\Cms\Api\GetPageByIdentifierInterface; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\Cms\Model\CustomLayoutManager; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; -use Magento\Cms\Model\Page as PageModel; -use Magento\Framework\App\Request\Http as HttpRequest; /** * Test pages data provider. @@ -22,6 +23,12 @@ */ class DataProviderTest extends TestCase { + private $providerData = [ + 'name' => 'test', + 'primaryFieldName' => 'page_id', + 'requestFieldName' => 'page_id', + ]; + /** * @var DataProvider */ @@ -42,29 +49,26 @@ class DataProviderTest extends TestCase */ private $request; + /** + * @var ObjectManagerInterface + */ + private $objectManager; + /** * @inheritDoc */ protected function setUp(): void { - $objectManager = Bootstrap::getObjectManager(); - $objectManager->configure([ - 'preferences' => [ - \Magento\Cms\Model\Page\CustomLayoutManagerInterface::class => - \Magento\TestFramework\Cms\Model\CustomLayoutManager::class - ] + $this->objectManager = Bootstrap::getObjectManager(); + $this->objectManager->configure([ + 'preferences' => [CustomLayoutManagerInterface::class => CustomLayoutManager::class] ]); - $this->repo = $objectManager->get(GetPageByIdentifierInterface::class); - $this->filesFaker = $objectManager->get(CustomLayoutManager::class); - $this->request = $objectManager->get(HttpRequest::class); - $this->provider = $objectManager->create( + $this->repo = $this->objectManager->get(GetPageByIdentifierInterface::class); + $this->filesFaker = $this->objectManager->get(CustomLayoutManager::class); + $this->request = $this->objectManager->get(HttpRequest::class); + $this->provider = $this->objectManager->create( DataProvider::class, - [ - 'name' => 'test', - 'primaryFieldName' => 'page_id', - 'requestFieldName' => 'page_id', - 'customLayoutManager' => $this->filesFaker - ] + array_merge($this->providerData, ['customLayoutManager' => $this->filesFaker]) ); } @@ -72,29 +76,42 @@ protected function setUp(): void * Check that custom layout date is handled properly. * * @magentoDataFixture Magento/Cms/_files/pages_with_layout_xml.php - * @throws \Throwable + * @dataProvider customLayoutDataProvider + * + * @param string $identifier + * @param string|null $layoutUpdateSelected * @return void */ - public function testCustomLayoutData(): void + public function testCustomLayoutData(string $identifier, ?string $layoutUpdateSelected): void { - $data = $this->provider->getData(); - $page1Data = null; - $page2Data = null; - $page3Data = null; - foreach ($data as $pageData) { - if ($pageData[PageModel::IDENTIFIER] === 'test_custom_layout_page_1') { - $page1Data = $pageData; - } elseif ($pageData[PageModel::IDENTIFIER] === 'test_custom_layout_page_2') { - $page2Data = $pageData; - } elseif ($pageData[PageModel::IDENTIFIER] === 'test_custom_layout_page_3') { - $page3Data = $pageData; - } - } - $this->assertNotEmpty($page1Data); - $this->assertNotEmpty($page2Data); - $this->assertEquals('_existing_', $page1Data['layout_update_selected']); - $this->assertNull($page2Data['layout_update_selected']); - $this->assertEquals('test_selected', $page3Data['layout_update_selected']); + $page = $this->repo->execute($identifier, 0); + + $request = $this->objectManager->create(RequestInterface::class); + $request->setParam('page_id', $page->getId()); + + $provider = $this->objectManager->create( + DataProvider::class, + array_merge($this->providerData, ['request' => $request]) + ); + + $data = $provider->getData(); + $pageData = $data[$page->getId()]; + + $this->assertEquals($layoutUpdateSelected, $pageData['layout_update_selected']); + } + + /** + * DataProvider for testCustomLayoutData + * + * @return array + */ + public function customLayoutDataProvider(): array + { + return [ + ['test_custom_layout_page_1', '_existing_'], + ['test_custom_layout_page_2', null], + ['test_custom_layout_page_3', 'test_selected'], + ]; } /** diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Attribute/CreateOptionsTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Attribute/CreateOptionsTest.php new file mode 100644 index 0000000000000..8c6f3b3b5977d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Attribute/CreateOptionsTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ConfigurableProduct\Controller\Adminhtml\Product\Attribute; + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\TestFramework\TestCase\AbstractBackendController; + +/** + * Checks creating attribute options process. + * + * @see \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Attribute\CreateOptions + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class CreateOptionsTest extends AbstractBackendController +{ + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var SerializerInterface */ + private $json; + + /** @var ProductAttributeRepositoryInterface */ + private $attributeRepository; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->productRepository = $this->_objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->json = $this->_objectManager->get(SerializerInterface::class); + $this->attributeRepository = $this->_objectManager->get(ProductAttributeRepositoryInterface::class); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * + * @return void + */ + public function testAddAlreadyAddedOption(): void + { + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $attribute = $this->attributeRepository->get('test_configurable'); + $this->getRequest()->setParams([ + 'options' => [ + [ + 'label' => 'Option 1', + 'is_new' => true, + 'attribute_id' => (int)$attribute->getAttributeId(), + ], + ], + ]); + $this->dispatch('backend/catalog/product_attribute/createOptions'); + $responseBody = $this->json->unserialize($this->getResponse()->getBody()); + $this->assertNotEmpty($responseBody); + $this->assertStringContainsString( + (string)__('The value of attribute ""%1"" must be unique', $attribute->getAttributeCode()), + $responseBody['message'] + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php index 321cb24a7fee5..1525065dcf4d3 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php @@ -8,16 +8,19 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Indexer\TestCase; /** * Customer grid collection tests. */ -class CollectionTest extends \Magento\TestFramework\Indexer\TestCase +class CollectionTest extends TestCase { public static function setUpBeforeClass(): void { - $db = Bootstrap::getInstance()->getBootstrap() + $db = Bootstrap::getInstance() + ->getBootstrap() ->getApplication() ->getDbInstance(); if (!$db->isDbDumpExists()) { @@ -42,12 +45,10 @@ public static function setUpBeforeClass(): void */ public function testGetItemByIdForUpdateOnSchedule() { - $targetObject = Bootstrap::getObjectManager()->create( - \Magento\Customer\Model\ResourceModel\Grid\Collection::class - ); - $customerRepository = Bootstrap::getObjectManager()->create( - CustomerRepositoryInterface::class - ); + $targetObject = Bootstrap::getObjectManager() + ->create(Collection::class); + $customerRepository = Bootstrap::getObjectManager() + ->create(CustomerRepositoryInterface::class); /** Verify after first save */ /** @var CustomerInterface $newCustomer */ @@ -68,7 +69,28 @@ public function testGetItemByIdForUpdateOnSchedule() } /** - * teardown + * Verifies that filter condition date is being converted to config timezone before select sql query + * + * @return void + */ + public function testAddFieldToFilter(): void + { + $filterDate = "2021-01-26 00:00:00"; + /** @var TimezoneInterface $timeZone */ + $timeZone = Bootstrap::getObjectManager() + ->get(TimezoneInterface::class); + /** @var Collection $gridCollection */ + $gridCollection = Bootstrap::getObjectManager() + ->get(Collection::class); + $convertedDate = $timeZone->convertConfigTimeToUtc($filterDate); + $collection = $gridCollection->addFieldToFilter('created_at', ['qteq' => $filterDate]); + $expectedSelect = "WHERE (((`main_table`.`created_at` = '{$convertedDate}')))"; + + $this->assertStringContainsString($expectedSelect, $collection->getSelectSql(true)); + } + + /** + * @inheritDoc */ protected function tearDown(): void { diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/email_template_reset_password_user_notification.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/email_template_reset_password_user_notification.php new file mode 100644 index 0000000000000..7b43b6b4b411f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/email_template_reset_password_user_notification.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$origTemplateCode = 'admin_emails_forgot_email_template'; +/** @var \Magento\Email\Model\Template $template */ +$template = $objectManager->create(\Magento\Email\Model\Template::class); +$template->loadDefault($origTemplateCode); +$template->setTemplateCode('Reset Password User Notification Custom Code'); +$template->setOrigTemplateCode('admin_emails_forgot_email_template'); +$template->setId(null); +$template->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php index 7fdfc79b3fdfe..f1b6ca9c09b34 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php @@ -81,6 +81,22 @@ public function testGetOrderItems(): void $this->assertCount(1, $this->block->getItems()); } + /** + * @magentoDataFixture Magento/Sales/_files/order_configurable_product.php + * + * @return void + */ + public function testGetPagerCountConfigurable(): void + { + $order = $this->orderFactory->create()->loadByIncrementId('100000001'); + $this->registerOrder($order); + $this->prepareBlockWithPager(); + + /** @var Pager $pagerBlock */ + $pagerBlock = $this->block->getChildBlock('sales_order_item_pager'); + $this->assertCount(1, $pagerBlock->getCollection()->getItems()); + } + /** * @magentoConfigFixture default/sales/orders/items_per_page 3 * @magentoDataFixture Magento/Sales/_files/order_item_list.php @@ -91,13 +107,7 @@ public function testPagerIsDisplayed(): void { $order = $this->orderFactory->create()->loadByIncrementId('100000001'); $this->registerOrder($order); - $this->block = $this->layout->createBlock(Items::class, 'items_block'); - $this->layout->addBlock( - $this->objectManager->get(Pager::class), - 'sales_order_item_pager', - 'items_block' - ); - $this->block->setLayout($this->layout); + $this->prepareBlockWithPager(); $this->assertTrue($this->block->isPagerDisplayed()); } @@ -110,13 +120,7 @@ public function testPagerIsNotDisplayed(): void { $order = $this->orderFactory->create()->loadByIncrementId('100000001'); $this->registerOrder($order); - $this->block = $this->layout->createBlock(Items::class, 'items_block'); - $this->layout->addBlock( - $this->objectManager->get(Pager::class), - 'sales_order_item_pager', - 'items_block' - ); - $this->block->setLayout($this->layout); + $this->prepareBlockWithPager(); $this->assertFalse($this->block->isPagerDisplayed()); $this->assertEmpty(preg_replace('/\s+/', '', strip_tags($this->block->getPagerHtml()))); } @@ -131,13 +135,7 @@ public function testGetPagerHtml(): void { $order = $this->orderFactory->create()->loadByIncrementId('100000001'); $this->registerOrder($order); - $this->block = $this->layout->createBlock(Items::class, 'items_block'); - $this->layout->addBlock( - $this->objectManager->get(Pager::class), - 'sales_order_item_pager', - 'items_block' - ); - $this->block->setLayout($this->layout); + $this->prepareBlockWithPager(); $this->assertNotEmpty(preg_replace('/\s+/', '', strip_tags($this->block->getPagerHtml()))); $this->assertTrue($this->block->isPagerDisplayed()); } @@ -227,4 +225,18 @@ private function registerOrder(OrderInterface $order): void $this->registry->unregister('current_order'); $this->registry->register('current_order', $order); } + + /** + * Create items block with pager + */ + private function prepareBlockWithPager(): void + { + $this->block = $this->layout->createBlock(Items::class, 'items_block'); + $this->layout->addBlock( + $this->objectManager->get(Pager::class), + 'sales_order_item_pager', + 'items_block' + ); + $this->block->setLayout($this->layout); + } } diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Helper/DataTest.php index 2e9ea5aba536c..c91155ce15fa5 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Helper/DataTest.php @@ -44,6 +44,7 @@ protected function setUp(): void /** * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * * @return void */ public function testGetSwatchAttributesAsArray(): void @@ -51,4 +52,15 @@ public function testGetSwatchAttributesAsArray(): void $product = $this->productRepository->get('simple2'); $this->assertEmpty($this->helper->getSwatchAttributesAsArray($product)); } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_with_disabled_image.php + * + * @return void + */ + public function testGetProductMediaGalleryWithHiddenImage(): void + { + $result = $this->helper->getProductMediaGallery($this->productRepository->get('simple_with_disabled_img')); + $this->assertEmpty($result); + } } diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index e20c4a4b60e62..9380e3ccbabdc 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -591,7 +591,9 @@ public function testSendNotificationEmailsIfRequired() ->get(MutableScopeConfigInterface::class); $config->setValue( 'admin/emails/new_user_notification_template', - $this->getCustomEmailTemplateIdForNewUserNotification() + $this->getCustomEmailTemplateId( + 'admin_emails_new_user_notification_template' + ) ); $userModel = Bootstrap::getObjectManager() ->create(User::class); @@ -619,17 +621,17 @@ public function testSendNotificationEmailsIfRequired() } /** - * Return email template id for new user notification + * Return email template id by origin template code * + * @param string $origTemplateCode * @return int|null * @throws NotFoundException */ - private function getCustomEmailTemplateIdForNewUserNotification(): ?int + private function getCustomEmailTemplateId(string $origTemplateCode): ?int { $templateId = null; $templateCollection = Bootstrap::getObjectManager() - ->get(TemplateCollection::class); - $origTemplateCode = 'admin_emails_new_user_notification_template'; + ->create(TemplateCollection::class); foreach ($templateCollection as $template) { if ($template->getOrigTemplateCode() == $origTemplateCode) { $templateId = (int) $template->getId(); @@ -643,4 +645,33 @@ private function getCustomEmailTemplateIdForNewUserNotification(): ?int } return $templateId; } + + /** + * Verify custom notification is correctly when reset admin password + * + * @magentoDataFixture Magento/Email/Model/_files/email_template_reset_password_user_notification.php + * @magentoDataFixture Magento/User/_files/user_with_role.php + */ + public function testNotificationEmailsIfResetPassword() + { + /** @var MutableScopeConfigInterface $config */ + $config = Bootstrap::getObjectManager() + ->get(MutableScopeConfigInterface::class); + $config->setValue( + 'admin/emails/forgot_email_template', + $this->getCustomEmailTemplateId( + 'admin_emails_forgot_email_template' + ) + ); + $userModel = $this->_model->loadByUsername('adminUser'); + $notificator = $this->objectManager->get(\Magento\User\Model\Spi\NotificatorInterface::class); + $notificator->sendForgotPassword($userModel); + /** @var TransportBuilderMock $transportBuilderMock */ + $transportBuilderMock = $this->objectManager->get(TransportBuilderMock::class); + $sentMessage = $transportBuilderMock->getSentMessage(); + $this->assertStringContainsString( + 'id='.$userModel->getId(), + quoted_printable_decode($sentMessage->getBodyText()) + ); + } } diff --git a/nginx.conf.sample b/nginx.conf.sample index 2dbba68c39c39..989829c111210 100644 --- a/nginx.conf.sample +++ b/nginx.conf.sample @@ -108,8 +108,8 @@ location /static/ { # expires max; # Remove signature of the static files that is used to overcome the browser cache - location ~ ^/static/version { - rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last; + location ~ ^/static/version\d*/ { + rewrite ^/static/version\d*/(.*)$ /static/$1 last; } location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$ {