Skip to content

Commit 784c3aa

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop
- merged latest code from mainline branch
2 parents a4e1f3d + 5e225d6 commit 784c3aa

File tree

38 files changed

+700
-156
lines changed

38 files changed

+700
-156
lines changed

app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<after>
2323
<!-- 6. Restore default configuration settings. -->
2424
<magentoCLI command="config:set {{DefaultWebCookieLifetimeConfigData.path}} {{DefaultWebCookieLifetimeConfigData.value}}" stepKey="setDefaultCookieLifetime"/>
25+
<!-- Customer Log Out -->
26+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
2527
<!-- Delete data -->
2628
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
2729
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
</before>
4949

5050
<after>
51+
<!-- Customer Log Out -->
52+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutStorefront"/>
5153
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
5254
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
5355
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
@@ -70,7 +72,7 @@
7072
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductGridPage"/>
7173
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/>
7274
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
73-
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/>
75+
<comment userInput="BIC workaround" stepKey="customerLogoutStorefront"/>
7476
</after>
7577

7678
<!-- Open Product Grid, Filter product and open -->

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@
3131
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/>
3232
</before>
3333
<after>
34+
<!-- Logout customer -->
35+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutStorefront"/>
3436
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
3537
<!-- Delete product and category -->
3638
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3739
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3840
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderListingFilters"/>
3941
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>
40-
<!-- Logout customer -->
41-
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/>
42+
<comment userInput="BIC workaround" stepKey="customerLogoutStorefront"/>
4243
</after>
4344

4445
<!-- Login Customer Storefront -->

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitleTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
3434
</before>
3535
<after>
36+
<!-- Customer Log Out -->
37+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
3638
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
3739
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3840
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/PriceRange.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public function resolve(
6363
$product = $value['model'];
6464
$product->unsetData('minimal_price');
6565

66+
if ($context) {
67+
$customerGroupId = $context->getExtensionAttributes()->getCustomerGroupId();
68+
if ($customerGroupId !== null) {
69+
$product->setCustomerGroupId($customerGroupId);
70+
}
71+
}
72+
6673
$requestedFields = $info->getFieldSelection(10);
6774
$returnArray = [];
6875

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
<!-- Delete products and category -->
3939
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
4040
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
41-
41+
<!-- Customer Log Out -->
42+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
43+
4244
<!-- Delete customer -->
4345
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
4446

app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckSelectedShippingAddressInCheckoutActionGroup.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
<argument name="customerVar"/>
1717
<argument name="customerAddressVar"/>
1818
</arguments>
19-
2019
<waitForElement selector="{{CheckoutShippingSection.shippingTab}}" time="30" stepKey="waitForShippingSectionLoaded"/>
21-
<see stepKey="VerifyFirstNameInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.firstname}}"/>
22-
<see stepKey="VerifyLastNameInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.lastname}}"/>
23-
<see stepKey="VerifyStreetInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.street[0]}}"/>
24-
<see stepKey="VerifyCityInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.city}}"/>
25-
<see stepKey="VerifyZipInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.postcode}}"/>
26-
<see stepKey="VerifyPhoneInSelectedAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.telephone}}"/>
20+
<see selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.firstname}}" stepKey="VerifyFirstNameInSelectedAddress"/>
21+
<see selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerVar.lastname}}" stepKey="VerifyLastNameInSelectedAddress"/>
22+
<see selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.street[0]}}" stepKey="VerifyStreetInSelectedAddress"/>
23+
<see selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.city}}" stepKey="VerifyCityInSelectedAddress"/>
24+
<see selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.postcode}}" stepKey="VerifyZipInSelectedAddress"/>
25+
<see selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{customerAddressVar.telephone}}" stepKey="VerifyPhoneInSelectedAddress"/>
2726
</actionGroup>
2827
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontCheckSelectedBillingAddressInCheckoutWithSearchActionGroup">
12+
<annotations>
13+
<description>Validates that the provided Customer and Address details are listed on the Storefront Checkout page under the 'Billing Address' section when multiple Addresses are present for a Customer.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="customerVar"/>
17+
<argument name="customerAddressVar"/>
18+
</arguments>
19+
<waitForElement selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" time="30" stepKey="waitForBillingSectionLoaded"/>
20+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerVar.firstname}}" stepKey="verifyFirstNameInSelectedAddress"/>
21+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerVar.lastname}}" stepKey="verifyLastNameInSelectedAddress"/>
22+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.street[0]}}" stepKey="verifyStreetInSelectedAddress"/>
23+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.city}}" stepKey="verifyCityInSelectedAddress"/>
24+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.postcode}}" stepKey="verifyZipInSelectedAddress"/>
25+
<see selector="{{CheckoutBillingAddressSection.selectedBillingAddress}}" userInput="{{customerAddressVar.telephone}}" stepKey="verifyPhoneInSelectedAddress"/>
26+
</actionGroup>
27+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutClickSaveAddressButtonActionGroup.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
<annotations>
1313
<description>Click Save Address button on checkout.</description>
1414
</annotations>
15-
16-
<click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="saveAddress"/>
15+
<waitForElementVisible selector="{{CheckoutShippingSection.saveAddress}}" stepKey="waitForSaveButton"/>
16+
<click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="clickSaveButton"/>
1717
<waitForPageLoad stepKey="waitForAddressSaved"/>
18+
<waitForElementNotVisible selector="{{CheckoutShippingSection.newAddressForm}}" stepKey="waitForNewAddressFormGone"/>
1819
</actionGroup>
1920
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontClickAddNewAddressButtonFromCheckoutShippingActionGroup">
12+
<annotations>
13+
<description>Clicks the New Address button on the storefront Checkout Shipping page</description>
14+
</annotations>
15+
<waitForElementVisible selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="waitForAddNewAddressButton"/>
16+
<click selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="clickAddNewAddressButton"/>
17+
<waitForPageLoad stepKey="waitForPageToLoad"/>
18+
<waitForElementVisible selector="{{CheckoutShippingSection.newAddressForm}}" stepKey="waitForNewAddressForm"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontClickUpdateAddressInCheckoutActionGroup">
12+
<annotations>
13+
<description>Clicks the Update button on the checkout page when entering a New Address.</description>
14+
</annotations>
15+
<waitForElementVisible selector="{{CheckoutShippingSection.updateAddress}}" stepKey="waitForUpdateButton"/>
16+
<click selector="{{CheckoutShippingSection.updateAddress}}" stepKey="clickUpdateButton"/>
17+
<waitForPageLoad stepKey="waitForAddressSaved"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontSelectAddressInCheckoutAddressDropDownActionGroup">
12+
<annotations>
13+
<description>Selects the specified option in the address selection drop down on the storefront Checkout page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="address" defaultValue="New Address" type="string"/>
17+
</arguments>
18+
<waitForElementVisible selector="{{CheckoutPaymentSection.addressDropdown}}" stepKey="waitForAddressDropDownToBeVisible"/>
19+
<selectOption selector="{{CheckoutPaymentSection.addressDropdown}}" userInput="{{address}}" stepKey="selectAddressOption"/>
20+
<waitForPageLoad stepKey="waitForAddressLoad"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontSelectCustomerAddressOnPaymentStepInCheckoutActionGroup">
12+
<annotations>
13+
<description>Selects the specified address after 'Change Address' pop up has been opened on the Storefront Checkout page on the 'Payment' step.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="address" type="string"/>
17+
</arguments>
18+
<waitForElementVisible selector="{{CheckoutBillingAddressSearchSection.selectButton(address)}}" stepKey="waitForAddress"/>
19+
<click selector="{{CheckoutBillingAddressSearchSection.selectButton(address)}}" stepKey="clickSelectForAddress"/>
20+
<waitForElementNotVisible selector="{{CheckoutShippingAddressSearchSection.popupSelectShippingAddress}}" stepKey="waitForPopupClosed"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<element name="editAddressButton" type="button" selector=".action-edit-address" timeout="30"/>
1616
<element name="addressDropdown" type="select" selector="[name=billing_address_id]"/>
1717
<element name="newAddressButton" type="button" selector=".action-show-popup" timeout="30"/>
18+
<element name="newAddressForm" type="text" selector="#co-shipping-form"/>
1819
<element name="email" type="input" selector="input[id*=customer-email]"/>
1920
<element name="password" type="input" selector="#customer-password"/>
2021
<element name="firstName" type="input" selector="input[name=firstname]"/>

app/code/Magento/Checkout/Test/Mftf/Test/DefaultBillingAddressShouldBeCheckedOnPaymentPageTest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
</actionGroup>
3232
</before>
3333
<after>
34+
<!--Logout from customer account-->
35+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutStorefront"/>
3436
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3537
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3638
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
37-
<!--Logout from customer account-->
38-
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
39+
<comment userInput="BIC workaround" stepKey="logoutCustomer"/>
3940
</after>
4041
<!-- Add simple product to cart and go to checkout-->
4142
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">

app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@
107107
<deleteData createDataKey="createDownloadableProduct" stepKey="deleteDownloadableProduct"/>
108108
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
109109
<deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/>
110-
111-
<!-- Delete customer -->
112-
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
110+
<comment userInput="BIC workaround" stepKey="deleteCustomer"/>
113111

114112
<!-- Logout customer -->
115113
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/>
116114

115+
<!-- Delete customer -->
116+
<deleteData createDataKey="createCustomer" stepKey="deleteCreatedCustomer"/>
117+
117118
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
118119
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
119120
</after>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828
</actionGroup>
2929
</before>
3030
<after>
31+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutStorefront"/>
3132
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
3233
<deleteData createDataKey="createCategory" stepKey="deleteSimpleCategory"/>
3334
<deleteData createDataKey="createCustomer" stepKey="deleteUsCustomer"/>
3435
<actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="resetCustomerFilters"/>
3536
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
36-
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
37+
<comment userInput="BIC workaround" stepKey="logoutCustomer"/>
3738
</after>
3839

3940
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin">
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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\Customer\Model\Group;
9+
10+
use Magento\Customer\Model\ResourceModel\Group\Resolver as ResolverResource;
11+
12+
/**
13+
* Lightweight service for getting current customer group based on customer id
14+
*/
15+
class Resolver
16+
{
17+
/**
18+
* @var ResolverResource
19+
*/
20+
private $resolverResource;
21+
22+
/**
23+
* @param ResolverResource $resolverResource
24+
*/
25+
public function __construct(ResolverResource $resolverResource)
26+
{
27+
$this->resolverResource = $resolverResource;
28+
}
29+
30+
/**
31+
* Return customer group id
32+
*
33+
* @param int $customerId
34+
* @return int|null
35+
*/
36+
public function resolve(int $customerId) : ?int
37+
{
38+
return $this->resolverResource->resolve($customerId);
39+
}
40+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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\Customer\Model\ResourceModel\Group;
9+
10+
use Magento\Framework\App\ResourceConnection;
11+
12+
/**
13+
* Resource model for customer group resolver service
14+
*/
15+
class Resolver
16+
{
17+
/**
18+
* @var ResourceConnection
19+
*/
20+
private $resourceConnection;
21+
22+
/**
23+
* @param ResourceConnection $resourceConnection
24+
*/
25+
public function __construct(
26+
ResourceConnection $resourceConnection
27+
) {
28+
$this->resourceConnection = $resourceConnection;
29+
}
30+
31+
/**
32+
* Resolve customer group from db
33+
*
34+
* @param int $customerId
35+
* @return int|null
36+
*/
37+
public function resolve(int $customerId) : ?int
38+
{
39+
$result = null;
40+
41+
$connection = $this->resourceConnection->getConnection();
42+
$tableName = $this->resourceConnection->getTableName('customer_entity');
43+
44+
$query = $connection
45+
->select()
46+
->from(
47+
['main_table' => $tableName],
48+
['main_table.group_id']
49+
)
50+
->where('main_table.entity_id = ?', $customerId);
51+
$groupId = $connection->fetchOne($query);
52+
if ($groupId) {
53+
$result = (int) $groupId;
54+
}
55+
56+
return $result;
57+
}
58+
}

0 commit comments

Comments
 (0)