Skip to content

Commit

Permalink
Merge branch '2.4-develop' into ref-AdminValidateShippingTrackingNumb…
Browse files Browse the repository at this point in the history
…erTes
  • Loading branch information
AnnaAPak committed Jan 4, 2021
2 parents 0406e76 + 960a51f commit 7cedea5
Show file tree
Hide file tree
Showing 129 changed files with 4,573 additions and 411 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ indent_size = 2

[{composer, auth}.json]
indent_size = 4

[db_schema_whitelist.json]
indent_size = 4
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* getPagerVisibility()
* getVarNamePage()
*/
$numColumns = count($block->getColumns());

/**
* @var \Magento\Backend\Block\Widget\Grid\Extended $block
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
$numColumns = count($block->getColumns());

?>
<?php if ($block->getCollection()): ?>
<?php if ($block->canDisplayContainer()): ?>
Expand Down Expand Up @@ -285,7 +286,9 @@ $numColumns = count($block->getColumns());
</table>

</div>
<?php if ($block->canDisplayContainer()): ?>
</div>
<?php endif; ?>
<?php
/** @var \Magento\Framework\Json\Helper\Data $jsonHelper */
$jsonHelper = $block->getData('jsonHelper');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ public function create(
$quantity,
array $arguments = []
) {
$quantity = $quantity ? (float)$quantity : 1.;
$selection->setQty($quantity);

$arguments['bundleProduct'] = $bundleProduct;
$arguments['saleableItem'] = $selection;
$arguments['quantity'] = $quantity ? (float)$quantity : 1.;
$arguments['quantity'] = $quantity;

return $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="cartClickCategory"/>

<!--Click add to cart-->
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
<actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addProductToCart"/>

<!--Check for details page-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Bundle\Test\Unit\Ui\DataProvider\Product\Form\Modifier;

use Magento\Bundle\Model\Product\Attribute\Source\Shipment\Type as ShipmentType;
use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePanel;
use Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePrice;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Framework\UrlInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* Test for bundle panel
*/
class BundlePanelTest extends TestCase
{
/**
* @var UrlInterface|MockObject
*/
private $urlBuilder;

/**
* @var ShipmentType|MockObject
*/
private $shipmentType;

/**
* @var LocatorInterface|MockObject
*/
private $locatorMock;

/**
* @var ProductInterface|MockObject
*/
private $productMock;

/**
* @var ArrayManager|MockObject
*/
private $arrayManagerMock;

/**
* @var BundlePanel
*/
private $bundlePanelModel;

/**
* @return void
*/
protected function setUp(): void
{
$this->objectManager = new ObjectManager($this);
$this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)
->disableOriginalConstructor()
->getMock();
$this->arrayManagerMock->expects($this->any())
->method('get')
->willReturn([]);
$this->urlBuilder = $this->getMockBuilder(UrlInterface::class)
->getMockForAbstractClass();
$this->shipmentType = $this->getMockBuilder(ShipmentType::class)
->getMockForAbstractClass();
$this->productMock = $this->getMockBuilder(ProductInterface::class)
->addMethods(['getStoreId'])
->getMockForAbstractClass();
$this->productMock->method('getId')
->willReturn(true);
$this->productMock->method('getStoreId')
->willReturn(0);
$this->locatorMock = $this->getMockBuilder(LocatorInterface::class)
->onlyMethods(['getProduct'])
->getMockForAbstractClass();
$this->locatorMock->method('getProduct')
->willReturn($this->productMock);

$this->bundlePanelModel = $this->objectManager->getObject(
BundlePanel::class,
[
'locator' => $this->locatorMock,
'urlBuilder' => $this->urlBuilder,
'shipmentType' => $this->shipmentType,
'arrayManager' => $this->arrayManagerMock,
]
);
}

/**
* Test for modify meta
*
* @param string $shipmentTypePath
* @param string $dataScope
*
* @return void
* @dataProvider getDataModifyMeta
*/
public function testModifyMeta(string $shipmentTypePath, string $dataScope): void
{
$sourceMeta = [
'bundle-items' => [
'children' => [
BundlePrice::CODE_PRICE_TYPE => []
]
]
];
$this->arrayManagerMock->method('findPath')
->willReturnMap(
[
[
BundlePanel::CODE_SHIPMENT_TYPE,
[],
null,
'children',
ArrayManager::DEFAULT_PATH_DELIMITER,
$shipmentTypePath
],
]
);
$this->arrayManagerMock->method('merge')
->willReturn([]);
$this->arrayManagerMock->method('remove')
->willReturn([]);
$this->arrayManagerMock->method('set')
->willReturn([]);
$this->arrayManagerMock->expects($this->at(12))
->method('merge')
->with(
$shipmentTypePath . BundlePanel::META_CONFIG_PATH,
[],
[
'dataScope' => $dataScope,
'validation' => [
'required-entry' => false
]
]
);
$this->bundlePanelModel->modifyMeta($sourceMeta);
}

/**
* Data provider for modify meta test
*
* @return string[][]
*/
public function getDataModifyMeta(): array
{
return [
[
'bundle-items/children',
'data.product.shipment_type'
],
[
'someAttrGroup/children',
'shipment_type'
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,19 @@ public function modifyData(array $data)
*/
private function modifyShipmentType(array $meta)
{
$actualPath = $this->arrayManager->findPath(
static::CODE_SHIPMENT_TYPE,
$meta,
null,
'children'
);

$meta = $this->arrayManager->merge(
$this->arrayManager->findPath(
static::CODE_SHIPMENT_TYPE,
$meta,
null,
'children'
) . static::META_CONFIG_PATH,
$actualPath . static::META_CONFIG_PATH,
$meta,
[
'dataScope' => 'data.product.shipment_type',
'dataScope' => stripos($actualPath, self::CODE_BUNDLE_DATA) === 0
? 'data.product.shipment_type' : 'shipment_type',
'validation' => [
'required-entry' => false
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,62 +124,108 @@
</after>

<!-- Open Product in Store Front Page -->
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront"/>
<waitForPageLoad stepKey="waitForProductToLoad"/>
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront">
<argument name="product" value="$createConfigProduct$"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>

<!-- Verify category,Configurable product and initial price -->
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage"/>
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct1.price$$" stepKey="seeInitialPriceInStoreFront"/>
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage">
<argument name="categoryName" value="$$createCategory.name$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront">
<argument name="productName" value="$$createConfigProduct.name$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeInitialPriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
</actionGroup>
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront"/>
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront">
<argument name="productStockStatus" value="In Stock"/>
</actionGroup>

<!-- Verify First Child Product attribute option is displayed -->
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1"/>

<!-- Select product Attribute option1, option2 and option3 and verify changes in the price -->
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="selectOption1"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct1.price$$" stepKey="seeChildProduct1PriceInStoreFront"/>
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectOption2"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeChildProduct2PriceInStoreFront"/>
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption3.label$$" stepKey="selectOption3"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct3.price$$" stepKey="seeChildProduct3PriceInStoreFront"/>

<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1">
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
</actionGroup>
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption2">
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct2PriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
</actionGroup>
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption3">
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
<argument name="optionLabel" value="$$getConfigAttributeOption3.label$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct3PriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct3.price$$"/>
</actionGroup>
<!-- Open Product Index Page and Filter First Child product -->
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
<argument name="product" value="ApiSimpleOne"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToProductIndex"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/>
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="selectFirstRow">
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
</actionGroup>
<click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="selectFirstRow"/>
<waitForPageLoad stepKey="waitForProductPageToLoad"/>

<!-- Disable the product -->
<click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="disableProduct"/>
<actionGroup ref="ToggleProductEnabledActionGroup" stepKey="disableProduct"/>
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
<argument name="message" value="You saved the product."/>
</actionGroup>

<!-- Open Product Store Front Page -->
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront1"/>
<waitForPageLoad stepKey="waitForProductToLoad1"/>
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1">
<argument name="product" value="$createConfigProduct$"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/>

<!-- Verify category,configurable product and updated price -->
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage1"/>
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront1"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeUpdatedProductPriceInStoreFront"/>
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1">
<argument name="categoryName" value="$$createCategory.name$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1">
<argument name="productName" value="$$createConfigProduct.name$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeUpdatedProductPriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1">
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
</actionGroup>
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront1"/>
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1">
<argument name="productStockStatus" value="In Stock"/>
</actionGroup>

<!-- Verify product Attribute Option1 is not displayed -->
<dontSee selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="dontSeeOption1"/>

<!--Select product Attribute option2 and option3 and verify changes in the price -->
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectTheOption2"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeSecondChildProductPriceInStoreFront"/>
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption3.label$$" stepKey="selectTheOption3"/>
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct3.price$$" stepKey="seeThirdProductPriceInStoreFront"/>
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectTheOption2">
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSecondChildProductPriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
</actionGroup>
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectTheOption3">
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
<argument name="optionLabel" value="$$getConfigAttributeOption3.label$$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeThirdProductPriceInStoreFront">
<argument name="productPrice" value="$$createConfigChildProduct3.price$$"/>
</actionGroup>
</test>
</tests>
Loading

0 comments on commit 7cedea5

Please sign in to comment.