-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2855 from magento-borg/MAGETWO-91528
[borg] MAGETWO-91528: Customizable options truncated when displaying ordered product in admin
- Loading branch information
Showing
12 changed files
with
446 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
106 changes: 106 additions & 0 deletions
106
.../Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.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,106 @@ | ||
<?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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> | ||
<test name="StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle"> | ||
<annotations> | ||
<group value="Catalog"/> | ||
<title value="Admin should be able to see the full title of the selected custom option value in the order"/> | ||
<description value="Admin should be able to see the full title of the selected custom option value in the order"/> | ||
<severity value="MAJOR"/> | ||
<testCaseId value="MC-3043"/> | ||
<group value="skip"/> | ||
<!-- Skip due to MQE-1128 --> | ||
</annotations> | ||
<before> | ||
<!--Create Simple Product with Custom Options--> | ||
<createData entity="_defaultCategory" stepKey="createCategory"/> | ||
<createData entity="_defaultProduct" stepKey="createProduct"> | ||
<requiredEntity createDataKey="createCategory"/> | ||
<field key="price">17</field> | ||
</createData> | ||
<updateData createDataKey="createProduct" entity="productWithOptions2" stepKey="updateProductWithOptions"/> | ||
|
||
<createData entity="Simple_US_Customer" stepKey="createCustomer"/> | ||
</before> | ||
<after> | ||
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> | ||
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/> | ||
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> | ||
</after> | ||
|
||
<!-- Login Customer Storefront --> | ||
|
||
<amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/> | ||
<fillField userInput="$$createCustomer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="fillEmail"/> | ||
<fillField userInput="$$createCustomer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}" stepKey="fillPassword"/> | ||
<click selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}" stepKey="clickSignInAccountButton"/> | ||
|
||
<!-- Checking the correctness of displayed prices for user parameters --> | ||
|
||
<amOnPage url="{{StorefrontHomePage.url}}$$createProduct.custom_attributes[url_key]$$.html" stepKey="amOnProductPage"/> | ||
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptionsDropDown(ProductOptionDropDownWithLongValuesTitle.title, ProductOptionValueDropdownLongTitle1.price)}}" stepKey="checkDropDownProductOption"/> | ||
|
||
<!-- Adding items to the checkout --> | ||
|
||
<selectOption userInput="{{ProductOptionValueDropdownLongTitle1.price}}" selector="{{StorefrontProductInfoMainSection.productOptionSelect(ProductOptionDropDownWithLongValuesTitle.title)}}" stepKey="seeProductOptionDropDown"/> | ||
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="finalProductPrice"/> | ||
|
||
<actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> | ||
<argument name="productName" value="$$createProduct.name$$"/> | ||
</actionGroup> | ||
|
||
<!-- Checking the correctness of displayed custom options for user parameters on checkout --> | ||
|
||
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart" /> | ||
|
||
<conditionalClick selector="{{CheckoutPaymentSection.cartItemsArea}}" dependentSelector="{{CheckoutPaymentSection.cartItemsArea}}" visible="true" stepKey="exposeMiniCart"/> | ||
|
||
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskForCartItem"/> | ||
<waitForElement selector="{{CheckoutPaymentSection.cartItemsAreaActive}}" time="30" stepKey="waitForCartItemsAreaActive"/> | ||
|
||
<see selector="{{CheckoutPaymentSection.cartItems}}" userInput="$$createProduct.name$$" stepKey="seeProductInCart"/> | ||
|
||
<conditionalClick selector="{{CheckoutPaymentSection.ProductOptionsByProductItemName($$createProduct.name$$)}}" dependentSelector="{{CheckoutPaymentSection.ProductOptionsActiveByProductItemName($$createProduct.name$$)}}" visible="false" stepKey="exposeProductOptions"/> | ||
|
||
<see selector="{{CheckoutPaymentSection.ProductOptionsActiveByProductItemName($$createProduct.name$$)}}" userInput="{{ProductOptionValueDropdownLongTitle1.title}}" stepKey="seeProductOptionValueDropdown1Input1"/> | ||
|
||
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> | ||
|
||
<!-- Place Order --> | ||
|
||
<waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> | ||
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> | ||
|
||
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> | ||
|
||
<!-- Login to Admin and open Order --> | ||
|
||
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> | ||
|
||
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> | ||
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnOrdersPage"/> | ||
<fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="fillOrderNum"/> | ||
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearchOrderNum"/> | ||
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/> | ||
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> | ||
|
||
<!-- Checking the correctness of displayed custom options for user parameters on Order --> | ||
|
||
<dontSee selector="{{AdminOrderItemsOrderedSection.productNameOptions}}" userInput="{{ProductOptionValueDropdownLongTitle1.title}}" stepKey="dontSeeAdminOrderProductOptionValueDropdown1"/> | ||
<grabTextFrom selector="{{AdminOrderItemsOrderedSection.productNameOptions}} dd" stepKey="productOptionValueText"/> | ||
<assertEquals stepKey="checkProductOptionValue"> | ||
<actualResult type="variable">productOptionValueText</actualResult> | ||
<expectedResult type="string">Optisfvdklvfnkljvnfdklpvnfdjklfdvnjkvfdkjnvfdjkfvndj111 ...</expectedResult> | ||
</assertEquals> | ||
<moveMouseOver selector="{{AdminOrderItemsOrderedSection.productNameOptions}} dd" stepKey="hoverProduct"/> | ||
<waitForElementVisible selector="{{AdminOrderItemsOrderedSection.productNameOptions}} dd:nth-child(2)" stepKey="waitForCustomOptionValueFullName"/> | ||
<see selector="{{AdminOrderItemsOrderedSection.productNameOptions}}" userInput="{{ProductOptionValueDropdownLongTitle1.title}}" stepKey="seeAdminOrderProductOptionValueDropdown1"/> | ||
</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
61 changes: 61 additions & 0 deletions
61
dev/tests/integration/testsuite/Magento/Framework/Filter/TruncateFilterTest.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,61 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Framework\Filter; | ||
|
||
class TruncateFilterTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @param string $expectedValue | ||
* @param string $expectedRemainder | ||
* @param string $string | ||
* @param int $length | ||
* @param string $etc | ||
* @param bool $breakWords | ||
* @dataProvider truncateDataProvider | ||
*/ | ||
public function testFilter( | ||
$expectedValue, | ||
$expectedRemainder, | ||
$string, | ||
$length = 5, | ||
$etc = '...', | ||
$breakWords = true | ||
) { | ||
/** @var TruncateFilter $truncateFilter */ | ||
$truncateFilter = \Magento\TestFramework\ObjectManager::getInstance()->create( | ||
TruncateFilter::class, | ||
[ | ||
'length' => $length, | ||
'etc' => $etc, | ||
'breakWords' => $breakWords, | ||
] | ||
); | ||
$result = $truncateFilter->filter($string); | ||
$this->assertEquals($expectedValue, $result->getValue()); | ||
$this->assertEquals($expectedRemainder, $result->getRemainder()); | ||
} | ||
|
||
public function truncateDataProvider() : array | ||
{ | ||
return [ | ||
'1' => [ | ||
'12...', | ||
'34567890', | ||
'1234567890', | ||
], | ||
'2' => [ | ||
'123..', | ||
' 456 789', | ||
'123 456 789', | ||
8, | ||
'..', | ||
false | ||
] | ||
]; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/Column/NameTest.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,50 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Sales\Block\Adminhtml\Items\Column; | ||
|
||
/** | ||
* @magentoAppArea adminhtml | ||
*/ | ||
class NameTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var Name | ||
*/ | ||
private $block; | ||
|
||
protected function setUp() | ||
{ | ||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); | ||
/** @var $layout \Magento\Framework\View\Layout */ | ||
$layout = $objectManager->create(\Magento\Framework\View\LayoutInterface::class); | ||
/** @var $block \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ | ||
$this->block = $layout->createBlock(Name::class, 'block'); | ||
} | ||
|
||
public function testTruncateString() : void | ||
{ | ||
$remainder = ''; | ||
$this->assertEquals( | ||
'12345', | ||
$this->block->truncateString('1234567890', 5, '', $remainder) | ||
); | ||
} | ||
|
||
public function testGetFormattedOptiong() : void | ||
{ | ||
$this->assertEquals( | ||
[ | ||
'value' => '1234567890123456789012345678901234567890123456789012345', | ||
'remainder' => '67890', | ||
], | ||
$this->block->getFormattedOption( | ||
'123456789012345678901234567890123456789012345678901234567890' | ||
) | ||
); | ||
} | ||
} |
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
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
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
Oops, something went wrong.