Skip to content

Commit 16db839

Browse files
Merge branch 'MC-29690' into 2.4-develop-com-pr4
2 parents a50d335 + fd1fe53 commit 16db839

File tree

9 files changed

+319
-57
lines changed

9 files changed

+319
-57
lines changed

app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<testCaseId value="MC-14770"/>
1818
<group value="CatalogRule"/>
1919
<group value="mtf_migrated"/>
20+
<skip>
21+
<issueId value="MC-24172"/>
22+
</skip>
2023
</annotations>
2124
<before>
2225
<!-- Login as Admin -->

app/code/Magento/Indexer/Test/Mftf/Section/AdminIndexManagementSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<element name="massActionSubmit" type="button" selector="#gridIndexer_massaction-form button"/>
1616
<element name="indexerSelect" type="select" selector="//select[contains(@class,'action-select-multiselect')]"/>
1717
<element name="indexerStatus" type="text" selector="//tr[descendant::td[contains(., '{{status}}')]]//*[contains(@class, 'col-indexer_status')]/span" parameterized="true"/>
18-
<element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']"/>
18+
<element name="successMessage" type="text" selector="//*[@data-ui-id='messages-message-success']" timeout="120"/>
1919
<element name="selectMassAction" type="select" selector="#gridIndexer_massaction-mass-select"/>
2020
</section>
2121
</sections>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Catalog\Model\Product\Attribute\Source\Status;
10+
use Magento\Catalog\Model\Product\Type;
11+
use Magento\Catalog\Model\Product\Visibility;
12+
use Magento\Catalog\Model\ProductFactory;
13+
use Magento\Store\Api\WebsiteRepositoryInterface;
14+
use Magento\TestFramework\Helper\Bootstrap;
15+
16+
require __DIR__ . '/category.php';
17+
18+
$objectManager = Bootstrap::getObjectManager();
19+
/** @var ProductFactory $productFactory */
20+
$productFactory = $objectManager->get(ProductFactory::class);
21+
/** @var WebsiteRepositoryInterface $websiteRepository */
22+
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
23+
$defaultWebsiteId = $websiteRepository->get('base')->getId();
24+
$product = $productFactory->create();
25+
$product->isObjectNew(true);
26+
$product->setTypeId(Type::TYPE_SIMPLE)
27+
->setAttributeSetId($product->getDefaultAttributeSetId())
28+
->setWebsiteIds([$defaultWebsiteId])
29+
->setName('Simple Product In Stock')
30+
->setSku('in-stock-product')
31+
->setPrice(10)
32+
->setWeight(1)
33+
->setShortDescription("Short description")
34+
->setTaxClassId(0)
35+
->setDescription('Description with <b>html tag</b>')
36+
->setMetaTitle('meta title')
37+
->setMetaKeyword('meta keyword')
38+
->setMetaDescription('meta description')
39+
->setVisibility(Visibility::VISIBILITY_BOTH)
40+
->setStatus(Status::STATUS_ENABLED)
41+
->setCategoryIds([333])
42+
->setStockData(['use_config_manage_stock' => 0])
43+
->setCanSaveCustomOptions(true)
44+
->setHasOptions(true);
45+
/** @var ProductRepositoryInterface $productRepositoryFactory */
46+
$productRepository = $objectManager->create(ProductRepositoryInterface::class);
47+
$productRepository->save($product);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\Registry;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
require __DIR__ . '/category_rollback.php';
14+
15+
$objectManager = Bootstrap::getObjectManager();
16+
/** @var Registry $registry */
17+
$registry = $objectManager->get(Registry::class);
18+
19+
$registry->unregister('isSecureArea');
20+
$registry->register('isSecureArea', true);
21+
/** @var ProductRepositoryInterface $productRepository */
22+
$productRepository = $objectManager->create(ProductRepositoryInterface::class);
23+
24+
try {
25+
$productRepository->deleteById('in-stock-product');
26+
} catch (NoSuchEntityException $e) {
27+
//already removed
28+
}
29+
$registry->unregister('isSecureArea');
30+
$registry->register('isSecureArea', false);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LayeredNavigation\Block\Navigation\Category;
9+
10+
use Magento\Catalog\Model\Layer\Resolver;
11+
use Magento\CatalogInventory\Model\Configuration;
12+
use Magento\Framework\App\Config\MutableScopeConfigInterface;
13+
use Magento\Framework\App\ScopeInterface;
14+
use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest;
15+
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
16+
use Magento\Store\Model\ScopeInterface as StoreScope;
17+
18+
/**
19+
* Provides tests for select filter in navigation block on category page with out of stock products
20+
* and enabled out of stock products displaying.
21+
*
22+
* @magentoAppArea frontend
23+
* @magentoAppIsolation enabled
24+
* @magentoDbIsolation disabled
25+
*/
26+
class OutOfStockProductsFilterTest extends AbstractFiltersTest
27+
{
28+
/**
29+
* @var MutableScopeConfigInterface
30+
*/
31+
private $scopeConfig;
32+
33+
/**
34+
* @inheritdoc
35+
*/
36+
protected function setUp()
37+
{
38+
parent::setUp();
39+
$this->scopeConfig = $this->objectManager->get(MutableScopeConfigInterface::class);
40+
}
41+
42+
/**
43+
* @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php
44+
* @magentoDataFixture Magento/Catalog/_files/out_of_stock_product_with_category.php
45+
* @magentoDataFixture Magento/Catalog/_files/product_with_category.php
46+
* @dataProvider getFiltersWithOutOfStockProduct
47+
* @param int $showOutOfStock
48+
* @param array $expectation
49+
* @return void
50+
*/
51+
public function testGetFiltersWithOutOfStockProduct(int $showOutOfStock, array $expectation): void
52+
{
53+
$this->updateConfigShowOutOfStockFlag($showOutOfStock);
54+
$this->getCategoryFiltersAndAssert(
55+
['out-of-stock-product' => 'Option 1', 'in-stock-product' => 'Option 2'],
56+
['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS],
57+
$expectation,
58+
'Category 1'
59+
);
60+
}
61+
62+
/**
63+
* @return array
64+
*/
65+
public function getFiltersWithOutOfStockProduct(): array
66+
{
67+
return [
68+
'show_out_of_stock' => [
69+
'show_out_of_stock' => 1,
70+
'expectation' => [['label' => 'Option 1', 'count' => 1], ['label' => 'Option 2', 'count' => 1]],
71+
],
72+
'not_show_out_of_stock' => [
73+
'show_out_of_stock' => 0,
74+
'expectation' => [['label' => 'Option 2', 'count' => 1]],
75+
],
76+
];
77+
}
78+
79+
/**
80+
* @inheritdoc
81+
*/
82+
protected function getLayerType(): string
83+
{
84+
return Resolver::CATALOG_LAYER_CATEGORY;
85+
}
86+
87+
/**
88+
* @inheritdoc
89+
*/
90+
protected function getAttributeCode(): string
91+
{
92+
return 'dropdown_attribute';
93+
}
94+
95+
/**
96+
* Updates store config 'cataloginventory/options/show_out_of_stock' flag.
97+
*
98+
* @param int $showOutOfStock
99+
* @return void
100+
*/
101+
protected function updateConfigShowOutOfStockFlag(int $showOutOfStock): void
102+
{
103+
$this->scopeConfig->setValue(
104+
Configuration::XML_PATH_SHOW_OUT_OF_STOCK,
105+
$showOutOfStock,
106+
StoreScope::SCOPE_STORE,
107+
ScopeInterface::SCOPE_DEFAULT
108+
);
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\LayeredNavigation\Block\Navigation\Search;
9+
10+
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
11+
use Magento\Catalog\Model\Layer\Resolver;
12+
use Magento\LayeredNavigation\Block\Navigation\Category\OutOfStockProductsFilterTest as CategoryFilterTest;
13+
14+
/**
15+
* Provides tests for select filter in navigation block on search page with out of stock products
16+
* and enabled out of stock products displaying.
17+
*
18+
* @magentoAppArea frontend
19+
* @magentoAppIsolation enabled
20+
* @magentoDbIsolation disabled
21+
*/
22+
class OutOfStockProductsFilterTest extends CategoryFilterTest
23+
{
24+
/**
25+
* @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php
26+
* @magentoDataFixture Magento/Catalog/_files/out_of_stock_product_with_category.php
27+
* @magentoDataFixture Magento/Catalog/_files/product_with_category.php
28+
* @dataProvider getFiltersWithOutOfStockProduct
29+
* @param int $showOutOfStock
30+
* @param array $expectation
31+
* @return void
32+
*/
33+
public function testGetFiltersWithOutOfStockProduct(int $showOutOfStock, array $expectation): void
34+
{
35+
$this->updateConfigShowOutOfStockFlag($showOutOfStock);
36+
$this->getSearchFiltersAndAssert(
37+
['out-of-stock-product' => 'Option 1', 'in-stock-product' => 'Option 2'],
38+
[
39+
'is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS,
40+
'is_filterable_in_search' => 1,
41+
],
42+
$expectation
43+
);
44+
}
45+
46+
/**
47+
* @inheritdoc
48+
*/
49+
protected function getLayerType(): string
50+
{
51+
return Resolver::CATALOG_LAYER_SEARCH;
52+
}
53+
}

dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@ require.config({
1212
}
1313
});
1414

15-
define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Squire, ko, $, registry) {
15+
define(['squire', 'ko', 'jquery', 'jquery/validate'], function (Squire, ko, $) {
1616
'use strict';
1717

1818
var injector = new Squire(),
1919
modalStub = {
2020
openModal: jasmine.createSpy(),
2121
closeModal: jasmine.createSpy()
2222
},
23+
country = {
24+
/** Stub */
25+
on: function () {},
26+
27+
/** Stub */
28+
get: function () {},
29+
30+
/** Stub */
31+
set: function () {}
32+
},
2333
mocks = {
2434
'Magento_Customer/js/model/customer': {
2535
isLoggedIn: ko.observable()
@@ -28,17 +38,7 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
2838
'Magento_Checkout/js/model/address-converter': jasmine.createSpy(),
2939
'Magento_Checkout/js/model/quote': {
3040
isVirtual: jasmine.createSpy(),
31-
shippingMethod: ko.observable(),
32-
33-
/**
34-
* Stub
35-
*/
36-
shippingAddress: function () {
37-
38-
return {
39-
'countryId': 'AD'
40-
};
41-
}
41+
shippingMethod: ko.observable()
4242
},
4343
'Magento_Checkout/js/action/create-shipping-address': jasmine.createSpy().and.returnValue(
4444
jasmine.createSpyObj('newShippingAddress', ['getKey'])
@@ -62,7 +62,18 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
6262
'checkoutData',
6363
['setSelectedShippingAddress', 'setNewCustomerShippingAddress', 'setSelectedShippingRate']
6464
),
65-
'Magento_Ui/js/lib/registry/registry': registry,
65+
'Magento_Ui/js/lib/registry/registry': {
66+
async: jasmine.createSpy().and.returnValue(function () {}),
67+
create: jasmine.createSpy(),
68+
set: jasmine.createSpy(),
69+
get: jasmine.createSpy().and.callFake(function (query) {
70+
if (query === 'test.shippingAddress.shipping-address-fieldset.country_id') {
71+
return country;
72+
} else if (query === 'checkout.errors') {
73+
return {};
74+
}
75+
})
76+
},
6677
'Magento_Checkout/js/model/shipping-rate-service': jasmine.createSpy()
6778
},
6879
obj;
@@ -73,7 +84,6 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
7384
obj = new Constr({
7485
provider: 'provName',
7586
name: '',
76-
parentName: 'test',
7787
index: '',
7888
popUpForm: {
7989
options: {
@@ -174,16 +184,6 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
174184

175185
describe('"validateShippingInformation" method', function () {
176186
it('Check method call on negative cases.', function () {
177-
/* jscs:disable */
178-
var country = {
179-
on: function () {},
180-
get: function () {},
181-
set: function () {}
182-
};
183-
/* jscs:enable */
184-
185-
registry.set('test.shippingAddress.shipping-address-fieldset.country_id', country);
186-
registry.set('checkout.errors', {});
187187
obj.source = {
188188
get: jasmine.createSpy().and.returnValue(true),
189189
set: jasmine.createSpy(),
@@ -199,20 +199,10 @@ define(['squire', 'ko', 'jquery', 'uiRegistry', 'jquery/validate'], function (Sq
199199
expect(obj.validateShippingInformation()).toBeFalsy();
200200
});
201201
it('Check method call on positive case.', function () {
202-
/* jscs:disable */
203-
var country = {
204-
on: function () {},
205-
get: function () {},
206-
set: function () {}
207-
};
208-
/* jscs:enable */
209-
210202
$('body').append('<form data-role="email-with-possible-login">' +
211203
'<input type="text" name="username" />' +
212204
'</form>');
213205

214-
registry.set('test.shippingAddress.shipping-address-fieldset.country_id', country);
215-
registry.set('checkout.errors', {});
216206
obj.source = {
217207
get: jasmine.createSpy().and.returnValue(true),
218208
set: jasmine.createSpy(),

dev/tests/js/jasmine/tests/app/code/Magento/Signifyd/frontend/js/Fingerprint.test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ define([
1010

1111
/*eslint max-nested-callbacks: ["error", 5]*/
1212
describe('Signifyd device fingerprint client script', function () {
13+
var originalTimeout;
14+
15+
beforeEach(function () {
16+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
17+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 12000;
18+
});
19+
20+
afterEach(function () {
21+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
22+
});
1323

1424
it('SIGNIFYD_GLOBAL object initialization check', function (done) {
1525
var script = document.createElement('script');
@@ -32,7 +42,6 @@ define([
3242
expect(signifyd.scriptTagHasLoaded()).toBe(true);
3343
done();
3444
}, 10000);
35-
36-
}, 12000);
45+
});
3746
});
3847
});

0 commit comments

Comments
 (0)