-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6715 from magento-cia/2.4.3-develop-2.4-develop-s…
…ync-032221 Sync of 2.4.3-develop with 2.4-develop
- Loading branch information
Showing
560 changed files
with
98,282 additions
and
30,921 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ExportTaxRatesTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="AdminAwsS3ExportTaxRatesTest" extends="AdminExportTaxRatesTest"> | ||
<annotations> | ||
<features value="AwsS3"/> | ||
<stories value="Export Tax"/> | ||
<title value="S3 - Export Tax Rates"/> | ||
<description value="Exports tax rates from the System > Data Transfer > Import/Export Tax Rates page, from | ||
the Tax Rule page, from the Tax Rates grid page as a .csv, and from the Tax Rates grid page as an .xml. | ||
Validates contents in downloaded file for each export area. Note that MFTF cannot simply click export and | ||
have access to the file that is downloaded in the browser due to the test not having access to the server | ||
that is running the test browser. Therefore, this test verifies that the Export button can be successfully | ||
clicked, grabs the request URL from the Export button's form, executes the request on the magento machine | ||
via a curl request, and verifies the contents of the exported file. Uses S3 for the file system."/> | ||
<severity value="MAJOR"/> | ||
<testCaseId value="MC-38621"/> | ||
<group value="importExport"/> | ||
<group value="tax"/> | ||
</annotations> | ||
|
||
<before> | ||
<!-- Enable AWS S3 Remote Storage --> | ||
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="revertInitialTaxRateCA"/> | ||
</before> | ||
|
||
<after> | ||
<!-- Disable AWS S3 Remote Storage --> | ||
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/> | ||
</after> | ||
</test> | ||
</tests> |
35 changes: 35 additions & 0 deletions
35
app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ImportTaxRatesTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="AdminAwsS3ImportTaxRatesTest" extends="AdminImportTaxRatesTest"> | ||
<annotations> | ||
<features value="AwsS3"/> | ||
<stories value="Import Tax"/> | ||
<title value="S3 - Import and Update Tax Rates"/> | ||
<description value="Imports tax rates from the System > Data Transfer > Import/Export Tax Rates page and | ||
from the Tax Rule page, to create new tax rates and update existing tax rates. Verifies results on the Tax | ||
Rates grid page. Uses S3 for the file system."/> | ||
<severity value="MAJOR"/> | ||
<testCaseId value="MC-38621"/> | ||
<group value="importExport"/> | ||
<group value="tax"/> | ||
</annotations> | ||
|
||
<before> | ||
<!-- Enable AWS S3 Remote Storage --> | ||
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="revertInitialTaxRateCA"/> | ||
</before> | ||
|
||
<after> | ||
<!-- Disable AWS S3 Remote Storage --> | ||
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/> | ||
</after> | ||
</test> | ||
</tests> |
24 changes: 24 additions & 0 deletions
24
...to/Backend/Test/Mftf/ActionGroup/AssertAdminDashboardDisplayedWithNoErrorsActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AssertAdminDashboardDisplayedWithNoErrorsActionGroup"> | ||
<annotations> | ||
<description>Checks if Dashboard is displayed properly</description> | ||
</annotations> | ||
|
||
<seeElement selector="{{AdminDashboardSection.dashboardDiagramOrderContentTab}}" stepKey="seeOrderContentTab"/> | ||
<seeElement selector="{{AdminDashboardSection.dashboardDiagramContent}}" stepKey="seeDiagramContent"/> | ||
<click selector="{{AdminDashboardSection.dashboardDiagramAmounts}}" stepKey="clickDashboardAmount"/> | ||
<waitForLoadingMaskToDisappear stepKey="waitForDashboardAmountLoading"/> | ||
<seeElement selector="{{AdminDashboardSection.dashboardDiagramAmountsContentTab}}" stepKey="seeDiagramAmountContent"/> | ||
<seeElement selector="{{AdminDashboardSection.dashboardDiagramTotals}}" stepKey="seeAmountTotals"/> | ||
<dontSeeJsError stepKey="dontSeeJsError"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Backend\Test\Mftf\Helper; | ||
|
||
use Magento\FunctionalTestingFramework\Helper\Helper; | ||
|
||
/** | ||
* Class for MFTF helpers for curl requests. | ||
*/ | ||
class CurlHelpers extends Helper | ||
{ | ||
/** | ||
* Assert a that a curl request's response contains an expected string | ||
* | ||
* @param string $url | ||
* @param string $expectedString | ||
* @param string $postBody | ||
* @param string $cookieName | ||
* @return void | ||
* | ||
*/ | ||
public function assertCurlResponseContainsString($url, $expectedString, $postBody = null, $cookieName = 'admin'): void | ||
{ | ||
$cookie = $this->getCookie($cookieName); | ||
$curlResponse = $this->getCurlResponse($url, $cookie, $postBody); | ||
$this->assertStringContainsString($expectedString, $curlResponse); | ||
} | ||
|
||
/** | ||
* Sends a curl request with the provided URL & cookie. Returns the response | ||
* | ||
* @param string $url | ||
* @param string $cookie | ||
* @param string $postBody | ||
* @return string | ||
* | ||
*/ | ||
private function getCurlResponse($url, $cookie = null, $postBody = null): string | ||
{ | ||
// Start Session | ||
$session = curl_init($url); | ||
|
||
// Set Options | ||
if ($postBody) { | ||
$data = json_decode($postBody, true); | ||
curl_setopt($session, CURLOPT_POST, true); | ||
curl_setopt($session, CURLOPT_POSTFIELDS, $data); | ||
} | ||
curl_setopt($session, CURLOPT_COOKIE, $cookie); | ||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); | ||
|
||
// Execute | ||
$response = curl_exec($session); | ||
curl_close($session); | ||
|
||
return $response; | ||
} | ||
|
||
/** | ||
* Gets the value of the specified cookie and returns the key value pair of the cookie | ||
* | ||
* @param string $cookieName | ||
* @return string | ||
* | ||
*/ | ||
private function getCookie($cookieName = 'admin'): string | ||
{ | ||
try { | ||
$webDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); | ||
$cookieValue = $webDriver->grabCookie($cookieName); | ||
|
||
return $cookieName . '=' . $cookieValue; | ||
} catch (\Exception $exception) { | ||
$this->fail($exception->getMessage()); | ||
return ''; | ||
} | ||
} | ||
} |
Oops, something went wrong.