forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e62c675
commit 3f80642
Showing
5 changed files
with
339 additions
and
2 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
app/code/Magento/Catalog/Test/Mftf/Test/StorefrontForthLevelCategoryTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?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="StorefrontForthLevelCategoryTest"> | ||
<annotations> | ||
<features value="Catalog"/> | ||
<stories value="Category"/> | ||
<title value="Storefront forth level category test"/> | ||
<description value="When the submenu was created in the third stage follow, the submenu works"/> | ||
<severity value="MAJOR"/> | ||
<group value="Catalog"/> | ||
</annotations> | ||
<before> | ||
<createData entity="SimpleSubCategory" stepKey="category1"/> | ||
<createData entity="SubCategoryWithParent" stepKey="category2"> | ||
<requiredEntity createDataKey="category1"/> | ||
</createData> | ||
<createData entity="SubCategoryWithParent" stepKey="category3"> | ||
<requiredEntity createDataKey="category2"/> | ||
</createData> | ||
<createData entity="SubCategoryWithParent" stepKey="category4"> | ||
<requiredEntity createDataKey="category3"/> | ||
</createData> | ||
</before> | ||
<after> | ||
<deleteData createDataKey="category4" stepKey="deleteCategory4"/> | ||
<deleteData createDataKey="category3" stepKey="deleteCategory3"/> | ||
<deleteData createDataKey="category2" stepKey="deleteCategory2"/> | ||
<deleteData createDataKey="category1" stepKey="deleteCategory1"/> | ||
</after> | ||
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> | ||
<moveMouseOver | ||
selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category1.name$$)}}" | ||
stepKey="hoverCategoryLevelOne"/> | ||
<moveMouseOver | ||
selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category2.name$$)}}" | ||
stepKey="hoverCategoryLevelTwo"/> | ||
<moveMouseOver | ||
selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category3.name$$)}}" | ||
stepKey="hoverCategoryLevelThree"/> | ||
<moveMouseOver | ||
selector="{{StorefrontHeaderSection.NavigationCategoryByName($$category4.name$$)}}" | ||
stepKey="hoverCategoryLevelFour"/> | ||
</test> | ||
</tests> |
134 changes: 134 additions & 0 deletions
134
app/code/Magento/Catalog/Test/Unit/Model/Product/Image/ParamsBuilderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Catalog\Test\Unit\Model\Product\Image; | ||
|
||
use Magento\Catalog\Model\Product\Image; | ||
use Magento\Catalog\Model\Product\Image\ParamsBuilder; | ||
use Magento\Framework\App\Area; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Config\View; | ||
use Magento\Framework\View\ConfigInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class ParamsBuilderTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* @var ConfigInterface | ||
*/ | ||
private $viewConfig; | ||
|
||
/** | ||
* @var ParamsBuilder | ||
*/ | ||
private $model; | ||
|
||
protected function setUp() | ||
{ | ||
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); | ||
$this->scopeConfig = $this->createMock(ScopeConfigInterface::class); | ||
$this->viewConfig = $this->createMock(ConfigInterface::class); | ||
$this->model = $objectManager->getObject( | ||
ParamsBuilder::class, | ||
[ | ||
'scopeConfig' => $this->scopeConfig, | ||
'viewConfig' => $this->viewConfig, | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Test watermark location. | ||
*/ | ||
public function testWatermarkLocation() | ||
{ | ||
$imageArguments = [ | ||
'type' => 'type', | ||
'height' => 'image_height', | ||
'width' => 'image_width', | ||
'angle' => 'angle', | ||
'background' => [1, 2, 3] | ||
]; | ||
$scopeId = 1; | ||
$quality = 100; | ||
$file = 'file'; | ||
$width = 'width'; | ||
$height = 'height'; | ||
$size = "{$width}x{$height}"; | ||
$opacity = 'opacity'; | ||
$position = 'position'; | ||
|
||
$viewMock = $this->createMock(View::class); | ||
$viewMock->expects($this->once()) | ||
->method('getVarValue') | ||
->with('Magento_Catalog', 'product_image_white_borders') | ||
->willReturn(true); | ||
|
||
$this->viewConfig->expects($this->once()) | ||
->method('getViewConfig') | ||
->with(['area' => Area::AREA_FRONTEND]) | ||
->willReturn($viewMock); | ||
|
||
$this->scopeConfig->expects($this->exactly(5))->method('getValue')->withConsecutive( | ||
[ | ||
Image::XML_PATH_JPEG_QUALITY | ||
], | ||
[ | ||
"design/watermark/{$imageArguments['type']}_image", | ||
ScopeInterface::SCOPE_STORE, | ||
$scopeId, | ||
], | ||
[ | ||
"design/watermark/{$imageArguments['type']}_size", | ||
ScopeInterface::SCOPE_STORE], | ||
[ | ||
"design/watermark/{$imageArguments['type']}_imageOpacity", | ||
ScopeInterface::SCOPE_STORE, | ||
$scopeId | ||
], | ||
[ | ||
"design/watermark/{$imageArguments['type']}_position", | ||
ScopeInterface::SCOPE_STORE, | ||
$scopeId | ||
] | ||
)->willReturnOnConsecutiveCalls( | ||
$quality, | ||
$file, | ||
$size, | ||
$opacity, | ||
$position | ||
); | ||
|
||
$actual = $this->model->build($imageArguments, $scopeId); | ||
$expected = [ | ||
'image_type' => $imageArguments['type'], | ||
'background' => $imageArguments['background'], | ||
'angle' => $imageArguments['angle'], | ||
'quality' => $quality, | ||
'keep_aspect_ratio' => true, | ||
'keep_frame' => true, | ||
'keep_transparency' => true, | ||
'constrain_only' => true, | ||
'watermark_file' => $file, | ||
'watermark_image_opacity' => $opacity, | ||
'watermark_position' => $position, | ||
'watermark_width' => $width, | ||
'watermark_height' => $height, | ||
'image_height' => $imageArguments['height'], | ||
'image_width' => $imageArguments['width'], | ||
]; | ||
|
||
$this->assertEquals( | ||
$expected, | ||
$actual | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="NoErrorForMiniCartItemEditTest"> | ||
<annotations> | ||
<features value="ConfigurableProduct"/> | ||
<title value="No error for minicart item edit test"/> | ||
<description value="Already selected configurable option should be selected when configurable product is edited from minicart"/> | ||
<severity value="MAJOR"/> | ||
<group value="ConfigurableProduct"/> | ||
</annotations> | ||
<before> | ||
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> | ||
<createData entity="ApiCategory" stepKey="createCategory"/> | ||
<!-- Create Configurable product --> | ||
<actionGroup ref="createConfigurableProduct" stepKey="createProduct"> | ||
<argument name="product" value="_defaultProduct"/> | ||
<argument name="category" value="$$createCategory$$"/> | ||
</actionGroup> | ||
</before> | ||
<after> | ||
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> | ||
<!-- Delete the first simple product --> | ||
<actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> | ||
<argument name="sku" value="{{_defaultProduct.sku}}"/> | ||
</actionGroup> | ||
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" | ||
dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" | ||
stepKey="clickClearFilters"/> | ||
<actionGroup ref="logout" stepKey="logout"/> | ||
</after> | ||
|
||
<!-- Go To Created Product Page --> | ||
<amOnPage stepKey="goToCreatedProductPage" url="{{_defaultProduct.urlKey}}.html"/> | ||
<waitForPageLoad stepKey="waitForProductPageLoad2"/> | ||
|
||
<!-- Add Product to Cart --> | ||
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" | ||
stepKey="checkDropDownProductOption"/> | ||
<selectOption userInput="{{colorProductAttribute1.name}}" | ||
selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" | ||
stepKey="selectOption1"/> | ||
<selectOption userInput="{{colorProductAttribute2.name}}" | ||
selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" | ||
stepKey="selectOption2"/> | ||
<click selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" | ||
stepKey="clickDropDownProductOption"/> | ||
<selectOption userInput="{{colorProductAttribute1.name}}" | ||
selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" | ||
stepKey="selectOptionForAddingToCart"/> | ||
<click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart"/> | ||
<waitForPageLoad stepKey="waitForMiniCart"/> | ||
|
||
<!-- Edit Item in Cart --> | ||
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniCart"/> | ||
<click selector="{{StorefrontMinicartSection.editMiniCartItem}}" stepKey="clickEditCartItem"/> | ||
|
||
<!-- Check if Product Configuration is still selected --> | ||
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" | ||
userInput="{{colorProductAttribute1.name}}" stepKey="seeConfigurationSelected"/> | ||
</test> | ||
</tests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters