Skip to content

Commit 570a14a

Browse files
authored
Merge pull request #6689 from engcom-Foxtrot/2.4-dev-php8-sync
2.4 dev php8 sync
2 parents 93f2ab1 + a74ad74 commit 570a14a

File tree

571 files changed

+92226
-29977
lines changed

Some content is hidden

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

571 files changed

+92226
-29977
lines changed
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>
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>
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>
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+
}
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

+5-2
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/Test/Mftf/Test/AdminLoginAfterChangeCookieDomainTest.xml

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,11 @@
2121
</annotations>
2222
<before>
2323
<magentoCLI command="config:set {{ChangedCookieDomainForMainWebsiteConfigData.path}} --scope={{ChangedCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{ChangedCookieDomainForMainWebsiteConfigData.scope_code}} {{ChangedCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteBeforeTestRun"/>
24-
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheBeforeTestRun">
25-
<argument name="tags" value="config"/>
26-
</actionGroup>
24+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCacheBeforeTestRun"/>
2725
</before>
2826
<after>
2927
<magentoCLI command="config:set {{EmptyCookieDomainForMainWebsiteConfigData.path}} --scope={{EmptyCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{EmptyCookieDomainForMainWebsiteConfigData.scope_code}} {{EmptyCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteAfterTestComplete"/>
30-
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfterTestComplete">
31-
<argument name="tags" value="config"/>
32-
</actionGroup>
28+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCacheAfterTestComplete"/>
3329
</after>
3430
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
3531
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="seeDashboardPage"/>

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

+1-1
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

0 commit comments

Comments
 (0)