Skip to content

Commit e47739d

Browse files
committed
Merge remote-tracking branch 'github-magento/MAGETWO-67269' into EPAM-PR-16
2 parents d9728aa + ce0cb8c commit e47739d

File tree

8 files changed

+106
-5
lines changed

8 files changed

+106
-5
lines changed

app/code/Magento/Config/Test/Mftf/Section/AdminSalesConfigSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
<section name="AdminSalesConfigSection">
1010
<element name="enableMAPUseSystemValue" type="checkbox" selector="#sales_msrp_enabled_inherit"/>
1111
<element name="enableMAPSelect" type="select" selector="#sales_msrp_enabled"/>
12+
<element name="giftOptions" type="select" selector="#sales_gift_options-head"/>
13+
<element name="allowGiftReceipt" type="select" selector="#sales_gift_options_allow_gift_receipt"/>
14+
<element name="allowPrintedCard" type="select" selector="#sales_gift_options_allow_printed_card"/>
15+
<element name="go" type="select" selector="//a[@id='sales_gift_options-head']/ancestor::div[@class='entry-edit-head admin__collapsible-block']"/>
1216
</section>
1317
</sections>

app/code/Magento/GiftMessage/Block/Message/Inline.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function getType()
139139
/**
140140
* Define checkout type
141141
*
142-
* @param $type string
142+
* @param string $type
143143
* @return $this
144144
* @codeCoverageIgnore
145145
*/
@@ -238,7 +238,7 @@ public function getMessage($entity = null)
238238
*/
239239
public function getItems()
240240
{
241-
if (!$this->getData('items')) {
241+
if (!$this->hasData('items')) {
242242
$items = [];
243243

244244
$entityItems = $this->getEntity()->getAllItems();
@@ -278,6 +278,8 @@ public function countItems()
278278
}
279279

280280
/**
281+
* Call method getItemsHasMessages
282+
*
281283
* @deprecated Misspelled method
282284
* @see getItemsHasMessages
283285
*/
@@ -325,6 +327,20 @@ public function getEscaped($value, $defaultValue = '')
325327
return $this->escapeHtml(trim($value) != '' ? $value : $defaultValue);
326328
}
327329

330+
/**
331+
* Check availability of order level functionality
332+
*
333+
* @return bool
334+
*/
335+
public function isMessagesOrderAvailable()
336+
{
337+
$entity = $this->getEntity();
338+
if (!$entity->hasIsGiftOptionsAvailable()) {
339+
$this->_eventManager->dispatch('gift_options_prepare', ['entity' => $entity]);
340+
}
341+
return $entity->getIsGiftOptionsAvailable();
342+
}
343+
328344
/**
329345
* Check availability of giftmessages on order level
330346
*
@@ -355,7 +371,7 @@ public function isItemMessagesAvailable($item)
355371
protected function _toHtml()
356372
{
357373
// render HTML when messages are allowed for order or for items only
358-
if ($this->isItemsAvailable() || $this->isMessagesAvailable()) {
374+
if ($this->isItemsAvailable() || $this->isMessagesAvailable() || $this->isMessagesOrderAvailable()) {
359375
return parent::_toHtml();
360376
}
361377
return '';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<actionGroup name="CheckingGiftOptionsActionGroup">
12+
<click stepKey="clickOnCheckoutWithMultipleAddresses" selector="{{MultishippingSection.checkoutWithMultipleAddresses}}"/>
13+
<waitForPageLoad stepKey="waitForPageLoad1"/>
14+
<click stepKey="goToShippingInformation" selector="{{AdminShipmentAddressInformationSection.goToShippingInformation}}"/>
15+
<waitForPageLoad stepKey="waitForGiftOption"/>
16+
<click stepKey="thickAddGiftOptions" selector="{{GiftOptionsOnFrontSection.giftOptionCheckbox}}"/>
17+
<waitForPageLoad stepKey="waitForOptions"/>
18+
<see stepKey="seeAddGiftOptionsForIndividualItems" userInput="Add Gift Options for Individual Items"/>
19+
<dontSee stepKey="dontSeeOtherElement1" userInput="Send Gift Receipt"/>
20+
<dontSee stepKey="dontSeeOtherElement2" userInput="Add Printed Card"/>
21+
</actionGroup>
22+
</actionGroups>
23+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<entity name="allowGiftReceipt" type="allow_gift_receipt">
12+
<data key="value">0</data>
13+
</entity>
14+
<entity name="allowPrintedCard" type="allow_printed_card">
15+
<data key="value">0</data>
16+
</entity>
17+
18+
<entity name="DefaultConfigGiftOptions" type="gift_options_config_state">
19+
<requiredEntity type="wrapping_allow_order">defaultWrappingAllowOrder</requiredEntity>
20+
<requiredEntity type="allow_gift_receipt">defaultAllowGiftReceipt</requiredEntity>
21+
<requiredEntity type="allow_printed_card">defaultAllowPrintedCard</requiredEntity>
22+
</entity>
23+
<entity name="defaultAllowGiftReceipt" type="allow_gift_receipt">
24+
<data key="value">1</data>
25+
</entity>
26+
<entity name="defaultAllowPrintedCard" type="allow_printed_card">
27+
<data key="value">1</data>
28+
</entity>
29+
</entities>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
9+
<section name="GiftOptionsOnFrontSection">
10+
<element name="giftOptionCheckbox" type="text" selector="//span[text()='Add Gift Options']"/>
11+
<element name="addGiftOptionsForIndividualItems" type="text" selector="//dt[@class='order-title individual']"/>
12+
</section>
13+
</sections>

app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
</div>
153153

154154
<dl class="options-items" id="allow-gift-options-container-<?= /* @escapeNotVerified */ $block->getEntity()->getId() ?>">
155+
<?php if ($block->isMessagesOrderAvailable() || $block->isMessagesAvailable()): ?>
155156
<dt id="add-gift-options-for-order-<?= /* @escapeNotVerified */ $block->getEntity()->getId() ?>" class="order-title">
156157
<div class="field choice">
157158
<input type="checkbox" name="allow_gift_options_for_order_<?= /* @escapeNotVerified */ $block->getEntity()->getId() ?>" id="allow_gift_options_for_order_<?= /* @escapeNotVerified */ $block->getEntity()->getId() ?>" data-mage-init='{"giftOptions":{}}' value="1" data-selector='{"id":"#allow-gift-options-for-order-container-<?= /* @escapeNotVerified */ $block->getEntity()->getId() ?>"}'<?php if ($block->getEntityHasMessage()): ?> checked="checked"<?php endif; ?> class="checkbox" />
@@ -192,7 +193,7 @@
192193
</div>
193194
<?php endif; ?>
194195
</dd>
195-
196+
<?php endif; ?>
196197
<?php if ($block->isItemsAvailable()): ?>
197198
<dt id="add-gift-options-for-items-<?= /* @escapeNotVerified */ $block->getEntity()->getId() ?>" class="order-title individual">
198199
<div class="field choice">
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<section name="MultishippingSection">
12+
<element name="checkoutWithMultipleAddresses" type="button" selector="//span[text()='Check Out with Multiple Addresses']"/>
13+
</section>
14+
</sections>

app/code/Magento/Shipping/Test/Mftf/Section/AdminShipmentAddressInformationSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1111
<section name="AdminShipmentAddressInformationSection">
1212
<element name="billingAddress" type="text" selector=".order-billing-address address"/>
1313
<element name="billingAddressEdit" type="button" selector=".order-billing-address .actions a"/>
1414
<element name="shippingAddress" type="text" selector=".order-shipping-address address"/>
1515
<element name="shippingAddressEdit" type="button" selector=".order-shipping-address .actions a"/>
16+
<element name="goToShippingInformation" type="button" selector="//button[@title='Go to Shipping Information']"/>
1617
</section>
1718
</sections>

0 commit comments

Comments
 (0)