Skip to content

Commit

Permalink
Merge branch '2.4-develop' into issue12087
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Kilo authored Jul 6, 2020
2 parents 2a48abe + 735579d commit e0eb4b0
Show file tree
Hide file tree
Showing 474 changed files with 19,786 additions and 2,055 deletions.

This file was deleted.

10 changes: 5 additions & 5 deletions app/code/Magento/Backend/Test/Mftf/Section/AdminMenuSection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<element name="widgets" type="button" selector="#nav li[data-ui-id='menu-magento-widget-cms-widget-instance']"/>
<element name="stores" type="button" selector="#menu-magento-backend-stores"/>
<element name="configuration" type="button" selector="#nav li[data-ui-id='menu-magento-config-system-config']"/>
<element name="dashboard" type="button" selector="//li[@id='menu-magento-backend-dashboard']"/>
<element name="sales" type="button" selector="//li[@id='menu-magento-sales-sales']"/>
<element name="marketing" type="button" selector="//li[@id='menu-magento-backend-marketing']"/>
<element name="system" type="button" selector="//li[@id='menu-magento-backend-system']"/>
<element name="findPartners" type="button" selector="//li[@id='menu-magento-marketplace-partners']"/>
<element name="dashboard" type="button" selector="#menu-magento-backend-dashboard"/>
<element name="sales" type="button" selector="#menu-magento-sales-sales"/>
<element name="marketing" type="button" selector="#menu-magento-backend-marketing"/>
<element name="system" type="button" selector="#menu-magento-backend-system"/>
<element name="findPartners" type="button" selector="#menu-magento-marketplace-partners"/>

<!-- Navigate menu selectors -->
<element name="menuItem" type="button" selector="li[data-ui-id='menu-{{dataUiId}}']" parameterized="true" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontBundleValidationMessageActionGroup">
<annotations>
<description>Check error message in validation message box</description>
</annotations>
<arguments>
<argument name="message" type="string"/>
</arguments>

<waitForPageLoad stepKey="waitForPageLoad"/>
<see selector="{{StorefrontBundledSection.validationMessageBox}}" userInput="{{message}}" stepKey="seeErrorHoldMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontBundleValidationMessagesCountActionGroup">
<annotations>
<description>Check if there's a validation message box on page and asserts the validation messages number</description>
</annotations>

<waitForPageLoad stepKey="waitForPageLoad"/>
<seeElement selector="{{StorefrontBundledSection.validationMessageBox}}" stepKey="seeErrorBox"/>
<seeNumberOfElements selector="{{StorefrontBundledSection.validationMessageBox}}" userInput="1" stepKey="seeOneErrorBox"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontAddToTheCartButtonActionGroup">
<annotations>
<description>Clicks 'Add to Cart' on a Storefront Bundled Product page.</description>
</annotations>

<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForElementVisible selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="waitForAddToCartButton"/>
<click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickOnAddToCartButton"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<element name="bundleOptionSelection" type="checkbox" selector="//div[@class='nested options-list']/div[{{optionNumber}}]/label[@class='label']" parameterized="true"/>
<!--Description-->
<!--CE exclusively-->
<element name="longDescriptionText" type="text" selector="//*[@id='description']/div/div" timeout="30"/>
<element name="shortDescriptionText" type="text" selector="//div[@class='product attribute overview']" timeout="30"/>
<element name="longDescriptionText" type="text" selector="#description>div>div" timeout="30"/>
<element name="shortDescriptionText" type="text" selector="div.product.attribute.overview" timeout="30"/>
<!--NameOfProductOnProductPage-->
<element name="bundleProductName" type="text" selector="//*[@id='maincontent']//span[@itemprop='name']"/>
<!--PageNotFoundErrorMessage-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<element name="updateCart" type="button" selector="#product-updatecart-button" timeout="30"/>
<element name="configuredPrice" type="block" selector=".price-configured_price .price"/>
<element name="fixedPricing" type="text" selector="//div[@class='price-box price-final_price']//span[@id]//..//span[contains(text(),'{{var1}}')]" parameterized="true"/>
<element name="customizeProduct" type="button" selector="//*[@id='bundle-slide']"/>
<element name="customizeProduct" type="button" selector="#bundle-slide"/>
<element name="customizableBundleItemOption" type="text" selector="//div[@class='field choice'][1]//input[@type='checkbox']"/>
<element name="customizableBundleItemOption2" type="text" selector="//div[@class='field choice'][2]//input[@type='checkbox']"/>
<element name="nthOptionDiv" type="block" selector="#product-options-wrapper div.field.option:nth-of-type({{var}})" parameterized="true"/>
Expand All @@ -38,5 +38,6 @@
<element name="currencyTrigger" type="select" selector="#switcher-currency-trigger" timeout="30"/>
<element name="currency" type="select" selector="//a[text()='{{arg}}']" parameterized="true"/>
<element name="multiSelectOption" type="select" selector="//div[@class='field option required']//select"/>
<element name="validationMessageBox" type="block" selector="#validation-message-box"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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="StorefrontBundleCheckBoxOptionValidationTest">
<annotations>
<features value="Bundle"/>
<stories value="Bundle product validation before add to cart"/>
<title value="Customer should be able to see only one validation message for checkbox option group"/>
<description value="Customer should be able to see only one validation message for checkbox option group"/>
<testCaseId value="MC-35133"/>
<severity value="MINOR"/>
<group value="Bundle"/>
</annotations>
<before>
<createData entity="ApiProductWithDescription" stepKey="simpleProduct1" before="bundleProduct"/>
<createData entity="ApiProductWithDescription" stepKey="simpleProduct2" after="simpleProduct1"/>
<createData entity="ApiBundleProduct" stepKey="bundleProduct"/>
<createData entity="CheckboxOption" stepKey="checkboxBundleOption">
<requiredEntity createDataKey="bundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createBundleLink1">
<requiredEntity createDataKey="bundleProduct"/>
<requiredEntity createDataKey="checkboxBundleOption"/>
<requiredEntity createDataKey="simpleProduct1"/>
<field key="qty">2</field>
</createData>
<createData entity="ApiBundleLink" stepKey="createBundleLink2">
<requiredEntity createDataKey="bundleProduct"/>
<requiredEntity createDataKey="checkboxBundleOption"/>
<requiredEntity createDataKey="simpleProduct2"/>
<field key="qty">4</field>
</createData>
<magentoCron stepKey="runCronIndex" groups="index"/>
</before>
<after>
<deleteData createDataKey="bundleProduct" stepKey="deleteBundleProduct"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
</after>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStorefront">
<argument name="productUrl" value="$$bundleProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="customizeBundleProduct"/>
<actionGroup ref="StorefrontAddToTheCartButtonActionGroup" stepKey="addToCartBundleProduct"/>
<actionGroup ref="AssertStorefrontBundleValidationMessagesCountActionGroup" stepKey="assertBundleValidationCount"/>
<actionGroup ref="AssertStorefrontBundleValidationMessageActionGroup" stepKey="assertBundleValidationMessage">
<argument name="message" value="Please select one of the options."/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,55 @@
<?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox */ ?>
<?php $_option = $block->getOption() ?>
<?php $_selections = $_option->getSelections() ?>
<?php $inputClass = 'checkbox product bundle option bundle-option-' . $block->escapeHtmlAttr($_option->getId()) ?>
<?php $inputId = 'bundle-option-' . $block->escapeHtmlAttr($_option->getId()) ?>
<?php $inputName = 'bundle_option[' . $block->escapeHtmlAttr($_option->getId()) . ']' ?>
<?php $dataValidation = 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' .
$block->escapeHtmlAttr($_option->getId()) . ']&quot;]:checked\'}"' ?>

<div class="field option <?= ($_option->getRequired()) ? ' required': '' ?>">
<label class="label">
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
</label>
<div class="control">
<div class="nested options-list">
<?php if ($block->showSingle()) : ?>
<?php if ($block->showSingle()): ?>
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?>
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?>
<input type="hidden"
class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> product bundle option"
name="bundle_option[<?= $block->escapeHtml($_option->getId()) ?>]"
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/>
<?php else :?>
<?php foreach ($_selections as $_selection) : ?>
<?php else: ?>
<?php foreach ($_selections as $selection): ?>
<?php $sectionId = $selection->getSelectionId() ?>
<div class="field choice">
<input class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> checkbox product bundle option change-container-classname"
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
<input class="<?=/* @noEscape */ $inputClass ?> change-container-classname"
id="<?=/* @noEscape */ $inputId . '-' . $block->escapeHtmlAttr($sectionId)?>"
type="checkbox"
<?php if ($_option->getRequired()) { echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' . $block->escapeHtmlAttr($_option->getId()) . ']&quot;]:checked\'}"'; } ?>
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]"
data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]"
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
<?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?>
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"/>
<?php if ($_option->getRequired()): ?>
<?= /* @noEscape */ $dataValidation ?>
<?php endif;?>
name="<?=/* @noEscape */ $inputName .'['. $block->escapeHtmlAttr($sectionId)?>]"
data-selector="<?= /* @noEscape */ $inputName.'['.$block->escapeHtmlAttr($sectionId)?>]"
<?php if ($block->isSelected($selection)): ?>
<?= ' checked="checked"' ?>
<?php endif; ?>
<?php if (!$selection->isSaleable()): ?>
<?= ' disabled="disabled"' ?>
<?php endif; ?>
value="<?= $block->escapeHtmlAttr($sectionId) ?>"
data-errors-message-box="#validation-message-box"/>
<label class="label"
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
<span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection) ?></span>
for="<?= /* @noEscape */ $inputId . '-' . $block->escapeHtmlAttr($sectionId) ?>">
<span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($selection) ?></span>
<br/>
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?>
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($selection) ?>
</label>
</div>
<?php endforeach; ?>
<div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div>
<div id="validation-message-box"></div>
<?php endif; ?>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<element name="customer" type="button" selector="//div[@class='admin__page-nav-title title _collapsible']//strong[text()='Customers']"/>
<element name="customerConfig" type="text" selector="//span[text()='Customer Configuration']"/>
<element name="captcha" type="button" selector="#customer_captcha-head"/>
<element name="dependent" type="button" selector="//a[@id='customer_captcha-head' and @class='open']"/>
<element name="dependent" type="button" selector="a#customer_captcha-head.open"/>
<element name="forms" type="multiselect" selector="#customer_captcha_forms"/>
<element name="createUser" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_create']"/>
<element name="forgotpassword" type="multiselect" selector="//select[@id='customer_captcha_forms']/option[@value='user_forgotpassword']"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ public function execute()
unset($data['apply_to']);
}

if ($model->getBackendType() == 'static' && !$model->getIsUserDefined()) {
$data['frontend_class'] = $model->getFrontendClass();
}

$model->addData($data);

if (!$attributeId) {
Expand Down
12 changes: 6 additions & 6 deletions app/code/Magento/Catalog/Model/FilterProductCustomAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
namespace Magento\Catalog\Model;

/**
* Filter custom attributes for product using the blacklist
* Filter custom attributes for product using the excluded list
*/
class FilterProductCustomAttribute
{
/**
* @var array
*/
private $blackList;
private $excludedList;

/**
* @param array $blackList
* @param array $excludedList
*/
public function __construct(array $blackList = [])
public function __construct(array $excludedList = [])
{
$this->blackList = $blackList;
$this->excludedList = $excludedList;
}

/**
Expand All @@ -33,6 +33,6 @@ public function __construct(array $blackList = [])
*/
public function execute(array $attributes): array
{
return array_diff_key($attributes, array_flip($this->blackList));
return array_diff_key($attributes, array_flip($this->excludedList));
}
}
8 changes: 4 additions & 4 deletions app/code/Magento/Catalog/Model/Layer/Filter/Price/Render.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function renderRangeLabel($fromPrice, $toPrice)
}

/**
* Prepare range data
*
* @param int $range
* @param int[] $dbRanges
* @return array
Expand All @@ -81,12 +83,10 @@ public function renderRangeData($range, $dbRanges)
if (empty($dbRanges)) {
return [];
}
$lastIndex = array_keys($dbRanges);
$lastIndex = $lastIndex[count($lastIndex) - 1];

foreach ($dbRanges as $index => $count) {
$fromPrice = $index == 1 ? '' : ($index - 1) * $range;
$toPrice = $index == $lastIndex ? '' : $index * $range;
$fromPrice = $index == 1 ? 0 : ($index - 1) * $range;
$toPrice = $index * $range;
$this->itemDataBuilder->addItemData(
$this->renderRangeLabel($fromPrice, $toPrice),
$fromPrice . '-' . $toPrice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public function getFailedItems()
}
}

/**
* Clear validation messages to prevent wrong validation for subsequent price update.
* Work around for backward compatible changes.
*/
$this->failedItems = [];

return $failedItems;
}
}
Loading

0 comments on commit e0eb4b0

Please sign in to comment.