Skip to content

Commit

Permalink
Merge pull request #8500 from magento-gl/Hammer_Platform_Health_Scope…
Browse files Browse the repository at this point in the history
…_28082023

Hammer platform health scope 28082023
  • Loading branch information
sidolov committed Sep 4, 2023
2 parents 0e33b80 + 99de5ac commit ab0c0b5
Show file tree
Hide file tree
Showing 78 changed files with 22,224 additions and 22,183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<click selector="{{StorefrontHeaderSection.mobileMenuToggle}}" stepKey="openSideMenu"/>
<waitForElementClickable selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createParentCategory.name$$)}}" stepKey="waitForCategoryMenuClickable" />
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createParentCategory.name$$)}}" stepKey="expandCategoryMenu"/>
<waitForPageLoad stepKey="waitForSearchResult"/>

<!-- Assert the category expanded successfully -->
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="verifySubCatMenuItemIsVisibleInTheSidebar">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CatalogSearch\Observer;

use Magento\Catalog\Model\Product\ProductList\ToolbarMemorizer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class ToolbarMemorizerObserver implements ObserverInterface
{
/**
* @var ToolbarMemorizer
*/
private $toolbarMemorizer;

/**
* ToolbarMemoriserObserver constructor.
* @param ToolbarMemorizer $toolbarMemorizer
*/
public function __construct(ToolbarMemorizer $toolbarMemorizer)
{
$this->toolbarMemorizer = $toolbarMemorizer;
}

/**
* Save toolbar parameters in catalog session
*
* @param Observer $observer
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function execute(Observer $observer): void
{
$this->toolbarMemorizer->memorizeParams();
}
}
15 changes: 15 additions & 0 deletions app/code/Magento/CatalogSearch/etc/frontend/events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_predispatch_catalogsearch_advanced_result">
<observer name="catalog_sort_param_memorization" instance="Magento\CatalogSearch\Observer\ToolbarMemorizerObserver"/>
</event>
<event name="controller_action_predispatch_catalogsearch_result_index">
<observer name="catalog_sort_param_memorization" instance="Magento\CatalogSearch\Observer\ToolbarMemorizerObserver"/>
</event>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<arguments>
<argument name="Image"/>
</arguments>

<waitForElementVisible selector="{{MediaGallerySection.imageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="waitForInitialImages"/>
<grabMultiple selector="{{MediaGallerySection.imageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="initialImages"/>
<waitForElementVisible selector="{{MediaGallerySection.lastImageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="waitForLastImage"/>
<click selector="{{MediaGallerySection.lastImageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="selectImage"/>
<conditionalClick selector="{{MediaGallerySection.lastImageOrImageCopy(Image.fileName, Image.extension)}}" dependentSelector="{{MediaGallerySection.DeleteSelectedBtn}}" visible="false" stepKey="selectImage"/>
<waitForElementVisible selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="waitForDeleteBtn"/>
<click selector="{{MediaGallerySection.DeleteSelectedBtn}}" stepKey="clickDeleteSelected"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
Expand All @@ -28,7 +28,7 @@
<waitForPageLoad stepKey="waitForPageLoad2"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
<grabMultiple selector="{{MediaGallerySection.imageOrImageCopy(Image.fileName, Image.extension)}}" stepKey="newImages"/>

<assertLessThan stepKey="assertLessImages">
<expectedResult type="variable">initialImages</expectedResult>
<actualResult type="variable">newImages</actualResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testProcessShouldNotLoginCustomerIfNotRegisteredInTargetStore():

public function testProcessShouldThrowExceptionIfCustomerDoesNotExist(): void
{
$this->expectErrorMessage('Something went wrong.');
$this->expectExceptionMessage('Something went wrong.');
$data = ['customer_id' => 1];
$this->session->expects($this->never())
->method('setCustomerDataAsLoggedIn');
Expand All @@ -127,7 +127,7 @@ public function testProcessShouldThrowExceptionIfCustomerDoesNotExist(): void

public function testProcessShouldThrowExceptionIfAnErrorOccur(): void
{
$this->expectErrorMessage('Something went wrong.');
$this->expectExceptionMessage('Something went wrong.');
$data = ['customer_id' => 2];
$this->session->expects($this->never())
->method('setCustomerDataAsLoggedIn');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<actionGroup ref="AdminMediaGalleryFolderSelectActionGroup" stepKey="unselectFoldersToVerifyDeleteFolderButtonStatus">
<argument name="name" value="{{AdminMediaGalleryFolderData.name}}"/>
</actionGroup>
<waitForPageLoad stepKey="waitForSearchResult" time="10"/>
<conditionalClick selector="{{AdminMediaGalleryFolderSection.clearFilterFolderName}}" dependentSelector="{{AdminMediaGalleryFolderSection.clearFilterFolderName}}" visible="true" stepKey="clearAllFiltersIfAny"/>
<seeElement selector="{{AdminMediaGalleryFolderSection.disabledDeleteFolderButton}}" stepKey="DeleteFolderButtonIsDisabled"/>

<!-- Step4.2 Delete Folder is enabled post selecting folder -->
Expand All @@ -72,6 +74,7 @@
<actionGroup ref="AdminMediaGalleryFolderSelectActionGroup" stepKey="deselectWysiwygFolder">
<argument name="name" value="{{AdminMediaGalleryFolderData.name}}"/>
</actionGroup>
<conditionalClick selector="{{AdminMediaGalleryFolderSection.clearFilterFolderName}}" dependentSelector="{{AdminMediaGalleryFolderSection.clearFilterFolderName}}" visible="true" stepKey="clearAllFiltersIfAny2"/>
<seeElement selector="{{AdminMediaGalleryFolderSection.disabledDeleteFolderButton}}" stepKey="DeleteFolderButtonIsNowDisabledAgain"/>

<!-- Step5 Select folder to delete -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testGetWebsitesThrowsException(): void
{
$message = 'get website exception';
$this->expectException(\Exception::class);
$this->expectErrorMessage($message);
$this->expectExceptionMessage($message);

$this->scopeConfigMock->method('isSetFlag')->willReturn(false);
$this->storeManagerMock->method('getWebsites')
Expand All @@ -103,7 +103,7 @@ public function testProcessPriceThrowsException(): void
{
$message = 'create collection exception';
$this->expectException(\Exception::class);
$this->expectErrorMessage($message);
$this->expectExceptionMessage($message);

$groupMock = $this->createMock(\Magento\Store\Model\Group::class);
$storeMock = $this->createMock(Store::class);
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testProcessStockThrowsException(): void
{
$message = 'create collection exception';
$this->expectException(\Exception::class);
$this->expectErrorMessage($message);
$this->expectExceptionMessage($message);

$groupMock = $this->createMock(\Magento\Store\Model\Group::class);
$storeMock = $this->createMock(Store::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@

<!--Click unassign and verify AssertOrderStatusSuccessUnassignMessage-->
<click selector="{{AdminOrderStatusGridSection.unassign}}" stepKey="clickUnassign"/>
<waitForText selector="{{AdminMessagesSection.success}}" userInput="You have unassigned the order status." stepKey="seeAssertOrderStatusSuccessUnassignMessage"/>
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageVisible" />
<waitForText selector="{{AdminMessagesSection.success}}" time="30" userInput="You have unassigned the order status." stepKey="seeAssertOrderStatusSuccessUnassignMessage"/>

<!--Verify the order status grid page shows the updated order status and verify AssertOrderStatusInGrid-->
<actionGroup ref="AssertOrderStatusExistsInGrid" stepKey="seeAssertOrderStatusInGrid">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
*/
class TaxTest extends TestCase
{
/**
* @var float
*/
private const EPSILON = 0.0000000001;

/**
* @var Tax
*/
Expand Down Expand Up @@ -118,13 +123,13 @@ function ($price, $type) use (&$roundingDelta) {

//verify invoice data
foreach ($expectedResults['creditmemo_data'] as $key => $value) {
$this->assertEquals($value, $this->creditmemo->getData($key));
$this->assertEqualsWithDelta($value, $this->creditmemo->getData($key), self::EPSILON);
}
//verify invoice item data
foreach ($expectedResults['creditmemo_items'] as $itemKey => $itemData) {
$creditmemoItem = $creditmemoItems[$itemKey];
foreach ($itemData as $key => $value) {
$this->assertEquals($value, $creditmemoItem->getData($key));
$this->assertEqualsWithDelta($value, $creditmemoItem->getData($key), self::EPSILON);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

class TaxTest extends TestCase
{
/**
* @var float
*/
private const EPSILON = 0.0000000001;

/**
* @var Tax
*/
Expand Down Expand Up @@ -115,13 +120,13 @@ public function testCollect($orderData, $invoiceData, $expectedResults)

//verify invoice data
foreach ($expectedResults['invoice_data'] as $key => $value) {
$this->assertEquals($value, $this->invoice->getData($key));
$this->assertEqualsWithDelta($value, $this->invoice->getData($key), self::EPSILON);
}
//verify invoice item data
foreach ($expectedResults['invoice_items'] as $itemKey => $itemData) {
$invoiceItem = $invoiceItems[$itemKey];
foreach ($itemData as $key => $value) {
$this->assertEquals($value, $invoiceItem->getData($key));
$this->assertEqualsWithDelta($value, $invoiceItem->getData($key), self::EPSILON);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ public function calculateDataProvider()
'expectedRuleDiscountQty' => 100,
'expectedDiscountData' => [
'amount' => 98,
'baseAmount' => 59.5,
'originalAmount' => 119,
'baseAmount' => 59.49999999999999,
'originalAmount' => 118.99999999999999,
'baseOriginalAmount' => 80.5,
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

class RowBaseCalculatorTest extends RowBaseAndTotalBaseCalculatorTestCase
{
/**
* @var float
*/
private const EPSILON = 0.0000000001;

/** @var RowBaseCalculator|MockObject */
protected $rowBaseCalculator;

Expand All @@ -27,13 +32,21 @@ public function testCalculateWithTaxInPrice()
$this->taxDetailsItem,
$this->calculate($this->rowBaseCalculator, true)
);
$this->assertEquals(self::UNIT_PRICE_INCL_TAX_ROUNDED, $this->taxDetailsItem->getPriceInclTax());
$this->assertEqualsWithDelta(
self::UNIT_PRICE_INCL_TAX_ROUNDED,
$this->taxDetailsItem->getPriceInclTax(),
self::EPSILON
);

$this->assertSame(
$this->taxDetailsItem,
$this->calculate($this->rowBaseCalculator, false)
);
$this->assertEquals(self::UNIT_PRICE_INCL_TAX, $this->taxDetailsItem->getPriceInclTax());
$this->assertEqualsWithDelta(
self::UNIT_PRICE_INCL_TAX,
$this->taxDetailsItem->getPriceInclTax(),
self::EPSILON
);
}

public function testCalculateWithTaxNotInPrice()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

class TotalBaseCalculatorTest extends RowBaseAndTotalBaseCalculatorTestCase
{
/**
* @var float
*/
private const EPSILON = 0.0000000001;

/** @var MockObject */
protected $totalBaseCalculator;

Expand All @@ -27,7 +32,11 @@ public function testCalculateWithTaxInPrice()
$this->taxDetailsItem,
$this->calculate($this->totalBaseCalculator)
);
$this->assertEquals(self::UNIT_PRICE_INCL_TAX_ROUNDED, $this->taxDetailsItem->getPriceInclTax());
$this->assertEqualsWithDelta(
self::UNIT_PRICE_INCL_TAX_ROUNDED,
$this->taxDetailsItem->getPriceInclTax(),
self::EPSILON
);
}

public function testCalculateWithTaxInPriceNoRounding()
Expand All @@ -41,7 +50,11 @@ public function testCalculateWithTaxInPriceNoRounding()
$this->taxDetailsItem,
$this->calculate($this->totalBaseCalculator, false)
);
$this->assertEquals(self::UNIT_PRICE_INCL_TAX, $this->taxDetailsItem->getPriceInclTax());
$this->assertEqualsWithDelta(
self::UNIT_PRICE_INCL_TAX,
$this->taxDetailsItem->getPriceInclTax(),
self::EPSILON
);
}

public function testCalculateWithTaxNotInPrice()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
*/
class UnitBaseCalculatorTest extends TestCase
{
/**
* @var float
*/
private const EPSILON = 0.0000000001;

public const STORE_ID = 2300;
public const QUANTITY = 1;
public const UNIT_PRICE = 500;
Expand Down Expand Up @@ -161,14 +166,30 @@ public function testCalculateWithTaxInPrice()
$this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY));
$this->assertSame(self::CODE, $this->taxDetailsItem->getCode());
$this->assertSame(self::TYPE, $this->taxDetailsItem->getType());
$this->assertEquals(self::ROW_TAX_ROUNDED, $this->taxDetailsItem->getRowTax());
$this->assertEquals(self::PRICE_INCL_TAX_ROUNDED, $this->taxDetailsItem->getPriceInclTax());
$this->assertEqualsWithDelta(
self::ROW_TAX_ROUNDED,
$this->taxDetailsItem->getRowTax(),
self::EPSILON
);
$this->assertEqualsWithDelta(
self::PRICE_INCL_TAX_ROUNDED,
$this->taxDetailsItem->getPriceInclTax(),
self::EPSILON
);

$this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY, false));
$this->assertSame(self::CODE, $this->taxDetailsItem->getCode());
$this->assertSame(self::TYPE, $this->taxDetailsItem->getType());
$this->assertEquals(self::ROW_TAX, $this->taxDetailsItem->getRowTax());
$this->assertEquals(self::PRICE_INCL_TAX, $this->taxDetailsItem->getPriceInclTax());
$this->assertEqualsWithDelta(
self::ROW_TAX,
$this->taxDetailsItem->getRowTax(),
self::EPSILON
);
$this->assertEqualsWithDelta(
self::PRICE_INCL_TAX,
$this->taxDetailsItem->getPriceInclTax(),
self::EPSILON
);
}

public function testCalculateWithTaxNotInPrice()
Expand All @@ -192,9 +213,13 @@ public function testCalculateWithTaxNotInPrice()
->willReturn([['id' => 0, 'percent' => 0, 'rates' => []]]);

$this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY));
$this->assertEquals(self::CODE, $this->taxDetailsItem->getCode());
$this->assertEquals(self::TYPE, $this->taxDetailsItem->getType());
$this->assertEquals(0.0, $this->taxDetailsItem->getRowTax());
$this->assertEqualsWithDelta(
self::CODE,
$this->taxDetailsItem->getCode(),
self::EPSILON
);
$this->assertEqualsWithDelta(self::TYPE, $this->taxDetailsItem->getType(), self::EPSILON);
$this->assertEqualsWithDelta(0.0, $this->taxDetailsItem->getRowTax(), self::EPSILON);
}

/**
Expand Down
Loading

0 comments on commit ab0c0b5

Please sign in to comment.