Skip to content

Commit 758bc29

Browse files
Merge branch 'MC-17014' of https://git.epam.com/magn-m23/magn-m23 into MC-17014
2 parents 123dd8b + 1f5fa0c commit 758bc29

File tree

6 files changed

+64
-22
lines changed

6 files changed

+64
-22
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddWebsiteToProductActionGroup.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@
2020
<waitForPageLoad stepKey="waitForSimpleProductSaved"/>
2121
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertProductSaveSuccessMessage"/>
2222
</actionGroup>
23-
<actionGroup name="attachOneWebsiteToProductActionGroup" extends="AddWebsiteToProductActionGroup">
24-
<uncheckOption selector="{{ProductInWebsitesSection.website(_defaultWebsite.name)}}" stepKey="uncheckMainWebsiteInProduct2" before="checkWebsite"/>
25-
</actionGroup>
26-
</actionGroups>
23+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@
322322
<waitForPageLoad stepKey="waitForPageOpened"/>
323323
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
324324
</actionGroup>
325+
<actionGroup name="unassignWebsiteFromProductActionGroup" extends="SelectProductInWebsitesActionGroup">
326+
<remove keyForRemoval="selectWebsite"/>
327+
<uncheckOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="unSelectWebsite" after="waitForPageOpened"/>
328+
</actionGroup>
325329

326330
<actionGroup name="AdminProductAddSpecialPrice">
327331
<arguments>

app/code/Magento/Tax/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<test name="AdminFixedTaxValSavedForSpecificWebsiteTest">
1212
<annotations>
1313
<features value="Tax"/>
14-
<title value="Cannot Save FPT (Fixed Product Tax) On Catalog Product For Specific Website"/>
15-
<description value="Cannot Save FPT (Fixed Product Tax) On Catalog Product For Specific Website"/>
14+
<title value="Fixed Product Tax value is saved correctly for Specific Website"/>
15+
<description value="Fixed Product Tax value is saved correctly for Specific Website"/>
1616
<severity value="MAJOR"/>
1717
<testCaseId value="MC-17182"/>
1818
<useCaseId value=" MC-17014"/>
@@ -47,8 +47,18 @@
4747
<argument name="StoreGroup" value="NewStoreData"/>
4848
<argument name="customStore" value="storeViewData"/>
4949
</actionGroup>
50+
<!--Set catalog price scope to Global-->
51+
<comment userInput="Set catalog price scope to Global" stepKey="commentSetPriceScope"/>
52+
<magentoCLI command="config:set catalog/price/scope 0" stepKey="setPriceScopeGlobal"/>
53+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
54+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
5055
</before>
5156
<after>
57+
<!--Set catalog price scope to Global-->
58+
<comment userInput="Set catalog price scope to Global" stepKey="commentSetPriceScope"/>
59+
<magentoCLI command="config:set catalog/price/scope 0" stepKey="setPriceScopeGlobal"/>
60+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
61+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
5262
<!-- Delete created data and log out -->
5363
<comment userInput="Delete created data and log out" stepKey="deleteDataAndLogOut"/>
5464
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
@@ -62,19 +72,46 @@
6272
<!-- Go to product edit page and assign it to created website -->
6373
<comment userInput="Go to product edit page and assign it to created website" stepKey="assignProductToCreatedWebsite"/>
6474
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="navigateToProductPage"/>
65-
<actionGroup ref="attachOneWebsiteToProductActionGroup" stepKey="updateSimpleProductAddingWebsiteCreated">
75+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
76+
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct">
6677
<argument name="website" value="{{NewWebSiteData.name}}"/>
6778
</actionGroup>
79+
<actionGroup ref="saveProductForm" stepKey="saveProductFirstTime"/>
6880
<!-- Add Fixed Product Tax attribute -->
6981
<comment userInput="Add Fixed Product Tax attribute" stepKey="addFixedProdTaxAttr"/>
7082
<actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFixedProductTaxAttr">
7183
<argument name="FPTAttributeCode" value="$$createProductFPTAttribute.attribute_code$$"/>
7284
<argument name="stateForFPT" value="California"/>
7385
<argument name="valueForFPT" value="10"/>
7486
</actionGroup>
75-
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
87+
<actionGroup ref="saveProductForm" stepKey="saveProductSecondTime"/>
7688
<!-- Check if created tax attribute is saved -->
7789
<comment userInput="Check if created tax attribute is saved" stepKey="checkThatTaxAttributeIsSaved"/>
7890
<seeElement selector="{{AdminProductAddFPTValueSection.setTaxValueForFPT($$createProductFPTAttribute.attribute_code$$)}}" stepKey="checkIfTaxAttributeSaved"/>
91+
<!--See available websites only 'All Websites'-->
92+
<comment userInput="See available websites only 'All Websites'" stepKey="commentCheckWebsitesDropDown"/>
93+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="seeAllWebsites"/>
94+
<dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="dontSeeSecondWebsite"/>
95+
<dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="dontSeeMainWebsite"/>
96+
<!--Set catalog price scope to Website-->
97+
<comment userInput="Set catalog price scope to Website" stepKey="commentSetPriceScope"/>
98+
<magentoCLI command="config:set catalog/price/scope 1" stepKey="setPriceScopeWebsite"/>
99+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
100+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
101+
<!--See available websites only 'All Websites'-->
102+
<comment userInput="See available websites 'All Websites', 'Main Website' and Second website" stepKey="commentCheckWebsitesInProductPage"/>
103+
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductPageSecondTime"/>
104+
<waitForPageLoad stepKey="waitForProductPageLoadSecondTime"/>
105+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="checkAllWebsitesInDropDown"/>
106+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="checkMainWebsiteInDropDown"/>
107+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="checkSecondWebsitesInDropDown"/>
108+
<actionGroup ref="unassignWebsiteFromProductActionGroup" stepKey="unassignWebsiteInProduct">
109+
<argument name="website" value="{{_defaultWebsite.name}}"/>
110+
</actionGroup>
111+
<actionGroup ref="saveProductForm" stepKey="saveProductThirdTime"/>
112+
<waitForPageLoad stepKey="waitForSavedProductLoad"/>
113+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="checkAllWebsitesInDropDownSecondTime"/>
114+
<dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="checkNoMainWebsiteInDropDown"/>
115+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="checkSecondWebsitesInDropDownSecondTime"/>
79116
</test>
80117
</tests>

app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\Weee\Model\Attribute\Backend\Weee;
99

10-
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
1110
use Magento\Framework\Exception\LocalizedException;
1211
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
1312

@@ -70,9 +69,11 @@ public function __construct(
7069
* Get backend model name.
7170
*
7271
* @return string
72+
* phpcs:disable Magento2.Functions.StaticFunction
7373
*/
7474
public static function getBackendModelName()
7575
{
76+
// phpcs:enable Magento2.Functions.StaticFunction
7677
return \Magento\Weee\Model\Attribute\Backend\Weee\Tax::class;
7778
}
7879

@@ -202,16 +203,4 @@ public function getEntityIdField()
202203
{
203204
return $this->_attributeTax->getIdFieldName();
204205
}
205-
206-
/**
207-
* Don't need to change scope for tax.
208-
*
209-
* @param Attribute $attribute
210-
* @return $this
211-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
212-
*/
213-
public function setScope($attribute)
214-
{
215-
return $this;
216-
}
217206
}

app/code/Magento/Weee/Test/Mftf/Section/AdminProductAddFPTValueSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@
1414
<element name="selectCountryForFPT" type="select" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[country]')])[last()]" parameterized="true"/>
1515
<element name="selectStateForFPT" type="select" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[state]')])[last()]" parameterized="true"/>
1616
<element name="setTaxValueForFPT" type="text" selector="(//input[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[value]')])[last()]" parameterized="true"/>
17+
<element name="setWebSiteForFPT" type="text" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[website_id]')])[last()]" parameterized="true"/>
18+
<element name="setWebSiteForFPTOption" type="text" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[website_id]')])/option[contains(text(), '{{website}}')]" parameterized="true"/>
1719
</section>
1820
</sections>

app/code/Magento/Weee/Ui/DataProvider/Product/Form/Modifier/Manager/Website.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Weee\Ui\DataProvider\Product\Form\Modifier\Manager;
79

810
use Magento\Catalog\Api\Data\ProductInterface;
@@ -12,6 +14,8 @@
1214
use Magento\Directory\Model\Currency;
1315
use Magento\Store\Api\Data\WebsiteInterface;
1416
use Magento\Store\Model\StoreManagerInterface;
17+
use Magento\Catalog\Helper\Data;
18+
use Magento\Framework\App\ObjectManager;
1519

1620
/**
1721
* Class Website
@@ -23,19 +27,27 @@ class Website
2327
*/
2428
private $websites;
2529

30+
/**
31+
* @var Data
32+
*/
33+
private $catalogHelper;
34+
2635
/**
2736
* @param LocatorInterface $locator
2837
* @param StoreManagerInterface $storeManager
2938
* @param DirectoryHelper $directoryHelper
39+
* @param Data|null $catalogHelper
3040
*/
3141
public function __construct(
3242
LocatorInterface $locator,
3343
StoreManagerInterface $storeManager,
34-
DirectoryHelper $directoryHelper
44+
DirectoryHelper $directoryHelper,
45+
Data $catalogHelper = null
3546
) {
3647
$this->locator = $locator;
3748
$this->storeManager = $storeManager;
3849
$this->directoryHelper = $directoryHelper;
50+
$this->catalogHelper = $catalogHelper ?: ObjectManager::getInstance()->get(Data::class);
3951
}
4052

4153
/**
@@ -60,6 +72,7 @@ public function getWebsites(ProductInterface $product, EavAttribute $eavAttribut
6072

6173
if ($this->storeManager->hasSingleStore()
6274
|| ($eavAttribute->getEntityAttribute() && $eavAttribute->getEntityAttribute()->isScopeGlobal()
75+
|| $this->catalogHelper->isPriceGlobal()
6376
)
6477
) {
6578
return $this->websites = $websites;

0 commit comments

Comments
 (0)