Skip to content

Commit 6714c5e

Browse files
committed
Merge remote-tracking branch 'origin/develop' into ACPT-1643
2 parents 6033839 + 3faac9c commit 6714c5e

10 files changed

+191
-31
lines changed

InventoryAdminUi/Test/Mftf/ActionGroup/AdminAssertAssignedSourcesQtyInGridForProductActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{productSku}}" stepKey="fillProduct1SkuFilter"/>
2727
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
2828
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
29+
<scrollTo selector="{{AdminProductGridSection.qtyPerSourceInGrid('productSku')}}" stepKey="scrollToProduct1AssignedSourcesGrid"/>
30+
<waitForElementVisible selector="{{AdminProductGridSection.qtyPerSourceInGrid('productSku')}}" stepKey="waitForProduct1AssignedSourcesGridToBeinteractable"/>
2931
<moveMouseOver selector="{{AdminProductGridSection.qtyPerSourceInGrid('productSku')}}" stepKey="hoverOverProduct1AssignedSourcesGrid"/>
3032
<waitForElementVisible selector="{{AdminProductGridSection.qtyPerSourceOnHover(source1_name,'0')}}" stepKey="waitForElementVisiblePostHoverOnProduct1"/>
3133
<seeElement selector="{{AdminProductGridSection.qtyPerSourceOnHover(source1_name,'0')}}" stepKey="see0quantityForProduct1ForAssignedSources1"/>

InventoryAdminUi/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<remove keyForRemoval="clickApplyFiltersButton"/>
2020
<remove keyForRemoval="clickOnFirstCheckbox"/>
2121
<remove keyForRemoval="enterAttributeQuantity"/>
22-
22+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/>
2323
<waitForElementClickable selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attributeCode)}}" stepKey="waitForCreateConfigurationsClickable" after="clickCreateConfigurations"/>
2424
<click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(attributeCode)}}" stepKey="clickOnFirstAttributeCheckbox" after="waitForCreateConfigurationsClickable"/>
2525
<waitForElementClickable selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(secondAttributeCode)}}" stepKey="waitForFirstAttributeCheckboxClickable" after="clickOnFirstAttributeCheckbox"/>

InventoryAdminUi/Test/Mftf/Section/AdminProductGridSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<element name="textMassSourceAssignmentHeader" type="text" selector="//aside[@data-type='popup']//header[@class='modal-header']//h1[contains(text(),'{{var1}}')]" parameterized="true" />
3838
<element name="textMassSourceAssignmentBody" type="text" selector="//aside[@data-type='popup']//div[contains(text(),'{{var1}}')]" parameterized="true" />
3939
<element name="acceptOKPopup" type="button" selector="//aside[@data-type='popup']//button[@class='action-primary action-accept']" />
40-
<element name="qtyPerSourceInGrid" type="block" selector="//td//div[contains(text(),'{{var}}')]/../..//td[9]//div//li//strong[text()='Default Source']" parameterized="true" />
40+
<element name="qtyPerSourceInGrid" type="block" selector="//td//div[contains(text(),'{{var}}')]/ancestor::div//li//strong[text()='Default Source']" parameterized="true" />
4141
<element name="qtyPerSourceOnHover" type="block" selector="//div[contains(text(),'Quantity per Source:')]/..//strong[contains(text(),'{{var1}}')]/..//span[contains(text(),'{{var2}}')]" parameterized="true" />
4242
<element name="scalableQty" type="text" selector="//span[contains(@data-bind,'salableQuantityData().qty')]"/>
4343
<element name="btnAdvancedInventory" type="button" selector="//button//span[contains(text(),'Advanced Inventory')]"/>

InventoryAdminUi/Test/Mftf/Test/AdminCreateScheduledPermanentUpdateDownloadableProductCustomStockTest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
</annotations>
2121
<before>
2222
<magentoCLI stepKey="addDownloadableDomain" command="downloadable:domains:add static.magento.com example.com"/>
23-
<!--Create stock and source.-->
23+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexAfterCLICommand">
24+
<argument name="indices" value=""/>
25+
</actionGroup>
26+
<!--Create stock and source.-->
2427
<createData entity="FullSource1" stepKey="source"/>
2528
<createData entity="BasicMsiStockWithMainWebsite1" stepKey="stock"/>
2629
<createData entity="SourceStockLinked1" stepKey="sourceStockLink">

InventoryAdminUi/Test/Mftf/Test/AdminMassActionUnAssignAllProductSourcesFromSimpleProductTest.xml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@
9393
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="resetFiltersOnProductGrid"/>
9494
<conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
9595
<comment userInput="Check default source assigned to created products." stepKey="checkDefaultSourceAssignedToCreatedProductsComment"/>
96-
<see selector="{{AdminProductGridSection.productQtyPerSource('1', _defaultSource.name)}}" userInput="1000" stepKey="checkSourceQtyForFirstCreatedProduct"/>
97-
<see selector="{{AdminProductGridSection.productQtyPerSource('2', _defaultSource.name)}}" userInput="1000" stepKey="checkSourceQtyForSecondCreatedProduct"/>
98-
<see selector="{{AdminProductGridSection.productQtyPerSource('3', _defaultSource.name)}}" userInput="1000" stepKey="checkSourceQtyForThirdCreatedProduct"/>
99-
<see selector="{{AdminProductGridSection.productQtyPerSource('4', _defaultSource.name)}}" userInput="1000" stepKey="checkSourceQtyForFourthCreatedProduct"/>
96+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('1', _defaultSource.name)}}" userInput="1000" stepKey="checkSourceQtyForFirstCreatedProduct"/>
97+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('2', _defaultSource.name)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProduct"/>
98+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('3', _defaultSource.name)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProduct"/>
99+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('4', _defaultSource.name)}}" userInput="1000" stepKey="checkSourceQtyForFourthCreatedProduct"/>
100100

101101
<comment userInput="Assign sources to all products" stepKey="assignSourcesToAllCreatedProductsComment"/>
102102
<click selector="{{AdminGridSelectRows.multicheckDropdown}}" stepKey="openMulticheckDropdownForSelectAllProducts"/>
@@ -114,25 +114,25 @@
114114
<waitForPageLoad stepKey="waitForSourcesWillBeAssign"/>
115115

116116
<comment userInput="Check for all sources was assigned" stepKey="checkAllCreatedSourcesAssignedToProductsComment"/>
117-
<see selector="{{AdminProductGridSection.productQtyPerSource('1', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForFirstSource"/>
118-
<see selector="{{AdminProductGridSection.productQtyPerSource('1', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForSecondSource"/>
119-
<see selector="{{AdminProductGridSection.productQtyPerSource('1', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForThirdSource"/>
120-
<see selector="{{AdminProductGridSection.productQtyPerSource('1', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForFourthSource"/>
121-
122-
<see selector="{{AdminProductGridSection.productQtyPerSource('2', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForFirstSource"/>
123-
<see selector="{{AdminProductGridSection.productQtyPerSource('2', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForSecondSource"/>
124-
<see selector="{{AdminProductGridSection.productQtyPerSource('2', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForThirdSource"/>
125-
<see selector="{{AdminProductGridSection.productQtyPerSource('2', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForFourthSource"/>
126-
127-
<see selector="{{AdminProductGridSection.productQtyPerSource('3', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForFirstSource"/>
128-
<see selector="{{AdminProductGridSection.productQtyPerSource('3', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForSecondSource"/>
129-
<see selector="{{AdminProductGridSection.productQtyPerSource('3', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForThirdSource"/>
130-
<see selector="{{AdminProductGridSection.productQtyPerSource('3', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForFourthSource"/>
131-
132-
<see selector="{{AdminProductGridSection.productQtyPerSource('4', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForFirstSource"/>
133-
<see selector="{{AdminProductGridSection.productQtyPerSource('4', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForSecondSource"/>
134-
<see selector="{{AdminProductGridSection.productQtyPerSource('4', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForThirdSource"/>
135-
<see selector="{{AdminProductGridSection.productQtyPerSource('4', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForFourthSource"/>
117+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('1', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForFirstSource"/>
118+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('1', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForSecondSource"/>
119+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('1', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForThirdSource"/>
120+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('1', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForFourthSource"/>
121+
122+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('2', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForFirstSource"/>
123+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('2', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForSecondSource"/>
124+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('2', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForThirdSource"/>
125+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('2', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForSecondCreatedProductForFourthSource"/>
126+
127+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('3', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForFirstSource"/>
128+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('3', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForSecondSource"/>
129+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('3', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForThirdSource"/>
130+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('3', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForThirdCreatedProductForFourthSource"/>
131+
132+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('4', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForFirstSource"/>
133+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('4', $$createSecondCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForSecondSource"/>
134+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('4', $$createThirdCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForThirdSource"/>
135+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('4', $$createFourthCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFourthCreatedProductForFourthSource"/>
136136

137137
<comment userInput="Unassign all sources from all products" stepKey="unassignSourcesFromAllCreatedProductsComment"/>
138138
<click selector="{{AdminGridSelectRows.multicheckDropdown}}" stepKey="openMulticheckDropdownForSelectAllProductsForUnassignSources"/>
@@ -150,10 +150,10 @@
150150
<waitForPageLoad stepKey="waitForSourcesWillBeUnassign"/>
151151

152152
<comment userInput="Check if default source still assigned to created products." stepKey="checkDefaultSourceStillAssignedToCreatedProductsComment"/>
153-
<see selector="{{AdminProductGridSection.productQtyPerSource('1', _defaultSource.name)}}" userInput="1000" stepKey="checkDefaultSourceStillForFirstCreatedProduct"/>
154-
<see selector="{{AdminProductGridSection.productQtyPerSource('2', _defaultSource.name)}}" userInput="1000" stepKey="checkDefaultSourceStillForSecondCreatedProduct"/>
155-
<see selector="{{AdminProductGridSection.productQtyPerSource('3', _defaultSource.name)}}" userInput="1000" stepKey="checkDefaultSourceStillForThirdCreatedProduct"/>
156-
<see selector="{{AdminProductGridSection.productQtyPerSource('4', _defaultSource.name)}}" userInput="1000" stepKey="checkDefaultSourceStillForFourthCreatedProduct"/>
153+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('1', _defaultSource.name)}}" userInput="1000" stepKey="checkDefaultSourceStillForFirstCreatedProduct"/>
154+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('2', _defaultSource.name)}}" userInput="0" stepKey="checkDefaultSourceStillForSecondCreatedProduct"/>
155+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('3', _defaultSource.name)}}" userInput="0" stepKey="checkDefaultSourceStillForThirdCreatedProduct"/>
156+
<waitForText selector="{{AdminProductGridSection.productQtyPerSource('4', _defaultSource.name)}}" userInput="1000" stepKey="checkDefaultSourceStillForFourthCreatedProduct"/>
157157

158158
<comment userInput="Check for all sources was unassigned" stepKey="checkAllCreatedSourcesUnassignedFromProductsComment"/>
159159
<dontSee selector="{{AdminProductGridSection.productQtyPerSource('1', $$createFirstCustomSource.source[name]$$)}}" userInput="0" stepKey="checkSourceQtyForFirstCreatedProductForFirstSourceUnassined"/>

InventoryCatalogAdminUi/Test/Mftf/Test/AdminCreateOrderWithVirtualProductFromDefaultSourceWithBackordersTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
<waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/>
102102
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/>
103103
<waitForPageLoad stepKey="waitForGuestCheckoutPageLoad"/>
104+
<waitForElementVisible selector="{{CheckoutShippingSection.emailAddress}}" stepKey="waitForEmailFieldVisible" />
104105
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="{{MsiCustomer1.email}}" stepKey="enterEmail"/>
105106
<waitForPageLoad stepKey="waitAfterEnterEmail"/>
106107
<fillField selector=".billing-address-form input[name=firstname]" userInput="{{MsiCustomer1.firstname}}" stepKey="enterFirstName"/>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* Copyright 2023 Adobe
5+
* All Rights Reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Adobe and its suppliers, if any. The intellectual
9+
* and technical concepts contained herein are proprietary to Adobe
10+
* and its suppliers and are protected by all applicable intellectual
11+
* property laws, including trade secret and copyright laws.
12+
* Dissemination of this information or reproduction of this material
13+
* is strictly forbidden unless prior written permission is obtained
14+
* from Adobe.
15+
* ************************************************************************
16+
*/
17+
declare(strict_types=1);
18+
19+
namespace Magento\InventoryConfigurableProduct\Plugin\Model\ResourceModel\Attribute;
20+
21+
use Magento\Catalog\Api\Data\ProductInterface;
22+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
23+
use Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface;
24+
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
25+
use Magento\Framework\App\ScopeInterface;
26+
use Magento\Framework\DB\Select;
27+
use Magento\Framework\EntityManager\MetadataPool;
28+
use Magento\Framework\Exception\NoSuchEntityException;
29+
use Magento\Store\Model\Store;
30+
use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;
31+
32+
/**
33+
* Plugin for OptionSelectBuilderInterface to add "enabled" filter.
34+
*/
35+
class IsEnabledOptionSelectBuilder
36+
{
37+
/**
38+
* @param ProductAttributeRepositoryInterface $attributeRepository
39+
* @param MetadataPool $metadataPool
40+
*/
41+
public function __construct(
42+
private readonly ProductAttributeRepositoryInterface $attributeRepository,
43+
private readonly MetadataPool $metadataPool
44+
) {
45+
}
46+
47+
/**
48+
* Add "enabled" filter to select.
49+
*
50+
* @param OptionSelectBuilderInterface $subject
51+
* @param Select $select
52+
* @param AbstractAttribute $superAttribute
53+
* @param int $productId
54+
* @param ScopeInterface $scope
55+
* @return Select
56+
*
57+
* @throws NoSuchEntityException
58+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
59+
*/
60+
public function afterGetSelect(
61+
OptionSelectBuilderInterface $subject,
62+
Select $select,
63+
AbstractAttribute $superAttribute,
64+
int $productId,
65+
ScopeInterface $scope
66+
) {
67+
$storeId = $scope->getId();
68+
$status = $this->attributeRepository->get(ProductInterface::STATUS);
69+
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
70+
$linkField = $metadata->getLinkField();
71+
72+
$select->joinInner(
73+
['entity_status_global' => $status->getBackendTable()],
74+
"entity_status_global.{$linkField} = entity.{$linkField}"
75+
. " AND entity_status_global.attribute_id = {$status->getAttributeId()}"
76+
. " AND entity_status_global.store_id = " . Store::DEFAULT_STORE_ID,
77+
[]
78+
)->joinLeft(
79+
['entity_status_store' => $status->getBackendTable()],
80+
"entity_status_store.{$linkField} = entity.{$linkField}"
81+
. " AND entity_status_store.attribute_id = {$status->getAttributeId()}"
82+
. " AND entity_status_store.store_id = {$storeId}",
83+
[]
84+
)->where(
85+
$select->getConnection()->getIfNullSql('entity_status_global.value', 'entity_status_store.value') . ' = ?',
86+
ProductStatus::STATUS_ENABLED
87+
);
88+
89+
return $select;
90+
}
91+
}

0 commit comments

Comments
 (0)