Skip to content

Commit e237a9b

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-41093
2 parents 8526c52 + 1fa7fb1 commit e237a9b

File tree

257 files changed

+7154
-659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+7154
-659
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAwsS3ExportTaxRatesTest" extends="AdminExportTaxRatesTest">
12+
<annotations>
13+
<features value="AwsS3"/>
14+
<stories value="Export Tax"/>
15+
<title value="S3 - Export Tax Rates"/>
16+
<description value="Exports tax rates from the System > Data Transfer > Import/Export Tax Rates page, from
17+
the Tax Rule page, from the Tax Rates grid page as a .csv, and from the Tax Rates grid page as an .xml.
18+
Validates contents in downloaded file for each export area. Note that MFTF cannot simply click export and
19+
have access to the file that is downloaded in the browser due to the test not having access to the server
20+
that is running the test browser. Therefore, this test verifies that the Export button can be successfully
21+
clicked, grabs the request URL from the Export button's form, executes the request on the magento machine
22+
via a curl request, and verifies the contents of the exported file. Uses S3 for the file system."/>
23+
<severity value="MAJOR"/>
24+
<testCaseId value="MC-38621"/>
25+
<group value="importExport"/>
26+
<group value="tax"/>
27+
</annotations>
28+
29+
<before>
30+
<!-- Enable AWS S3 Remote Storage -->
31+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="revertInitialTaxRateCA"/>
32+
</before>
33+
34+
<after>
35+
<!-- Disable AWS S3 Remote Storage -->
36+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/>
37+
</after>
38+
</test>
39+
</tests>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAwsS3ImportTaxRatesTest" extends="AdminImportTaxRatesTest">
12+
<annotations>
13+
<features value="AwsS3"/>
14+
<stories value="Import Tax"/>
15+
<title value="S3 - Import and Update Tax Rates"/>
16+
<description value="Imports tax rates from the System > Data Transfer > Import/Export Tax Rates page and
17+
from the Tax Rule page, to create new tax rates and update existing tax rates. Verifies results on the Tax
18+
Rates grid page. Uses S3 for the file system."/>
19+
<severity value="MAJOR"/>
20+
<testCaseId value="MC-38621"/>
21+
<group value="importExport"/>
22+
<group value="tax"/>
23+
</annotations>
24+
25+
<before>
26+
<!-- Enable AWS S3 Remote Storage -->
27+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="revertInitialTaxRateCA"/>
28+
</before>
29+
30+
<after>
31+
<!-- Disable AWS S3 Remote Storage -->
32+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/>
33+
</after>
34+
</test>
35+
</tests>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="AssertAdminDashboardDisplayedWithNoErrorsActionGroup">
12+
<annotations>
13+
<description>Checks if Dashboard is displayed properly</description>
14+
</annotations>
15+
16+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramOrderContentTab}}" stepKey="seeOrderContentTab"/>
17+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramContent}}" stepKey="seeDiagramContent"/>
18+
<click selector="{{AdminDashboardSection.dashboardDiagramAmounts}}" stepKey="clickDashboardAmount"/>
19+
<waitForLoadingMaskToDisappear stepKey="waitForDashboardAmountLoading"/>
20+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramAmountsContentTab}}" stepKey="seeDiagramAmountContent"/>
21+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramTotals}}" stepKey="seeAmountTotals"/>
22+
<dontSeeJsError stepKey="dontSeeJsError"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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\Backend\Test\Mftf\Helper;
9+
10+
use Magento\FunctionalTestingFramework\Helper\Helper;
11+
12+
/**
13+
* Class for MFTF helpers for curl requests.
14+
*/
15+
class CurlHelpers extends Helper
16+
{
17+
/**
18+
* Assert a that a curl request's response contains an expected string
19+
*
20+
* @param string $url
21+
* @param string $expectedString
22+
* @param string $postBody
23+
* @param string $cookieName
24+
* @return void
25+
*
26+
*/
27+
public function assertCurlResponseContainsString($url, $expectedString, $postBody = null, $cookieName = 'admin'): void
28+
{
29+
$cookie = $this->getCookie($cookieName);
30+
$curlResponse = $this->getCurlResponse($url, $cookie, $postBody);
31+
$this->assertStringContainsString($expectedString, $curlResponse);
32+
}
33+
34+
/**
35+
* Sends a curl request with the provided URL & cookie. Returns the response
36+
*
37+
* @param string $url
38+
* @param string $cookie
39+
* @param string $postBody
40+
* @return string
41+
*
42+
*/
43+
private function getCurlResponse($url, $cookie = null, $postBody = null): string
44+
{
45+
// Start Session
46+
$session = curl_init($url);
47+
48+
// Set Options
49+
if ($postBody) {
50+
$data = json_decode($postBody, true);
51+
curl_setopt($session, CURLOPT_POST, true);
52+
curl_setopt($session, CURLOPT_POSTFIELDS, $data);
53+
}
54+
curl_setopt($session, CURLOPT_COOKIE, $cookie);
55+
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
56+
57+
// Execute
58+
$response = curl_exec($session);
59+
curl_close($session);
60+
61+
return $response;
62+
}
63+
64+
/**
65+
* Gets the value of the specified cookie and returns the key value pair of the cookie
66+
*
67+
* @param string $cookieName
68+
* @return string
69+
*
70+
*/
71+
private function getCookie($cookieName = 'admin'): string
72+
{
73+
try {
74+
$webDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');
75+
$cookieValue = $webDriver->grabCookie($cookieName);
76+
77+
return $cookieName . '=' . $cookieValue;
78+
} catch (\Exception $exception) {
79+
$this->fail($exception->getMessage());
80+
return '';
81+
}
82+
}
83+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCheckDashboardWithChartsTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Google Charts on Magento dashboard"/>
15+
<title value="Admin should see Google chart on Magento dashboard"/>
16+
<description value="Google chart on Magento dashboard page is displaying properly"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-98934"/>
19+
<useCaseId value="MAGETWO-98584"/>
20+
<group value="backend"/>
21+
</annotations>
22+
<before>
23+
<magentoCLI command="config:set admin/dashboard/enable_charts 1" stepKey="setEnableCharts"/>
24+
<createData entity="SimpleProduct2" stepKey="createProduct">
25+
<field key="price">150</field>
26+
</createData>
27+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
28+
<field key="firstname">John1</field>
29+
<field key="lastname">Doe1</field>
30+
</createData>
31+
<createData entity="CustomerCart" stepKey="createCustomerCart">
32+
<requiredEntity createDataKey="createCustomer"/>
33+
</createData>
34+
<createData entity="CustomerCartItem" stepKey="addCartItem">
35+
<requiredEntity createDataKey="createCustomerCart"/>
36+
<requiredEntity createDataKey="createProduct"/>
37+
</createData>
38+
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
39+
<requiredEntity createDataKey="createCustomerCart"/>
40+
</createData>
41+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
42+
</before>
43+
<after>
44+
<magentoCLI command="config:set admin/dashboard/enable_charts 0" stepKey="setDisableChartsAsDefault"/>
45+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
46+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
47+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
48+
</after>
49+
50+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabQuantityBefore"/>
51+
52+
<updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="sendCustomerPaymentInformation">
53+
<requiredEntity createDataKey="createCustomerCart"/>
54+
</updateData>
55+
<createData entity="Invoice" stepKey="invoiceOrder">
56+
<requiredEntity createDataKey="createCustomerCart"/>
57+
</createData>
58+
<createData entity="Shipment" stepKey="shipOrder">
59+
<requiredEntity createDataKey="createCustomerCart"/>
60+
</createData>
61+
62+
<reloadPage stepKey="refreshPage"/>
63+
<actionGroup ref="AssertAdminDashboardDisplayedWithNoErrorsActionGroup" stepKey="assertAdminDashboardNotBroken"/>
64+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabQuantityAfter"/>
65+
<assertGreaterThan stepKey="checkQuantityWasChanged">
66+
<actualResult type="const">$grabQuantityAfter</actualResult>
67+
<expectedResult type="const">$grabQuantityBefore</expectedResult>
68+
</assertGreaterThan>
69+
</test>
70+
</tests>

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="AdminDashboardWithChartsTest">
11+
<test name="AdminDashboardWithChartsTest" deprecated="Use AdminCheckDashboardWithChartsTest instead">
1212
<annotations>
1313
<features value="Backend"/>
1414
<stories value="Google Charts on Magento dashboard"/>
15-
<title value="Admin should see Google chart on Magento dashboard"/>
15+
<title value="DEPRECATED. Admin should see Google chart on Magento dashboard"/>
1616
<description value="Google chart on Magento dashboard page is displaying properly"/>
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MAGETWO-98934"/>
1919
<useCaseId value="MAGETWO-98584"/>
2020
<group value="backend"/>
21+
<skip>
22+
<issueId value="DEPRECATED">Use AdminCheckDashboardWithChartsTest instead</issueId>
23+
</skip>
2124
</annotations>
2225
<before>
2326
<magentoCLI command="config:set admin/dashboard/enable_charts 1" stepKey="setEnableCharts"/>

app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ script;
200200
setLocation(url);
201201
';
202202
} else {
203-
$scriptString .= <<<script
203+
$scriptString .= <<<'script'
204204
jQuery('#preview_selected_store').val(scopeId);
205205
jQuery('#preview_form').submit();
206206

app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Bundle\Model\Option;
1212
use Magento\Catalog\Model\Product;
1313
use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
14+
use Magento\Framework\GraphQl\Query\Uid;
1415
use Magento\Framework\Pricing\Helper\Data;
1516
use Magento\Framework\Serialize\SerializerInterface;
1617

@@ -19,6 +20,11 @@
1920
*/
2021
class BundleOptionDataProvider
2122
{
23+
/**
24+
* Option type name
25+
*/
26+
private const OPTION_TYPE = 'bundle';
27+
2228
/**
2329
* @var Data
2430
*/
@@ -34,19 +40,27 @@ class BundleOptionDataProvider
3440
*/
3541
private $configuration;
3642

43+
/**
44+
* @var Uid
45+
*/
46+
private $uidEncoder;
47+
3748
/**
3849
* @param Data $pricingHelper
3950
* @param SerializerInterface $serializer
4051
* @param Configuration $configuration
52+
* @param Uid $uidEncoder
4153
*/
4254
public function __construct(
4355
Data $pricingHelper,
4456
SerializerInterface $serializer,
45-
Configuration $configuration
57+
Configuration $configuration,
58+
Uid $uidEncoder
4659
) {
4760
$this->pricingHelper = $pricingHelper;
4861
$this->serializer = $serializer;
4962
$this->configuration = $configuration;
63+
$this->uidEncoder = $uidEncoder;
5064
}
5165

5266
/**
@@ -100,8 +114,15 @@ private function buildBundleOptions(array $bundleOptions, ItemInterface $item):
100114
continue;
101115
}
102116

117+
$optionDetails = [
118+
self::OPTION_TYPE,
119+
$bundleOption->getOptionId()
120+
];
121+
$uidString = implode('/', $optionDetails);
122+
103123
$options[] = [
104124
'id' => $bundleOption->getId(),
125+
'uid' => $this->uidEncoder->encode($uidString),
105126
'label' => $bundleOption->getTitle(),
106127
'type' => $bundleOption->getType(),
107128
'values' => $this->buildBundleOptionValues($bundleOption->getSelections(), $item),
@@ -130,10 +151,19 @@ private function buildBundleOptionValues(array $selections, ItemInterface $item)
130151
continue;
131152
}
132153

154+
$optionValueDetails = [
155+
self::OPTION_TYPE,
156+
$selection->getOptionId(),
157+
$selection->getSelectionId(),
158+
(int) $selection->getSelectionQty()
159+
];
160+
$uidString = implode('/', $optionValueDetails);
161+
133162
$selectionPrice = $this->configuration->getSelectionFinalPrice($item, $selection);
134163
$values[] = [
135-
'label' => $selection->getName(),
136164
'id' => $selection->getSelectionId(),
165+
'uid' => $this->uidEncoder->encode($uidString),
166+
'label' => $selection->getName(),
137167
'quantity' => $qty,
138168
'price' => $this->pricingHelper->currency($selectionPrice, false, false),
139169
];

0 commit comments

Comments
 (0)