-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/2.4-develop' into PWA-1303
- Loading branch information
Showing
34 changed files
with
884 additions
and
25 deletions.
There are no files selected for viewing
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> |
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 ''; | ||
} | ||
} | ||
} |
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
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
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
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
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
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
30 changes: 30 additions & 0 deletions
30
app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminAssertTaxRateInGridActionGroup.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,30 @@ | ||
<?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="AdminAssertTaxRateInGridActionGroup"> | ||
<annotations> | ||
<description>Verifies the specified data is in the specified row on the the admin Tax Zones and Rates page.</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="taxIdentifier" defaultValue="{{US_CA_Rate_1.code}}" type="string"/> | ||
<argument name="country" defaultValue="{{US_CA_Rate_1.tax_country}}" type="string"/> | ||
<argument name="region" defaultValue="{{US_CA_Rate_1.tax_region}}" type="string"/> | ||
<argument name="zip" defaultValue="{{US_CA_Rate_1.tax_postcode}}" type="string"/> | ||
<argument name="rate" defaultValue="{{US_CA_Rate_1.rate}}" type="string"/> | ||
<argument name="rowIndex" defaultValue="1" type="string"/> | ||
</arguments> | ||
<waitForElementVisible selector="{{AdminTaxRateGridSection.nthRow(rowIndex)}}" stepKey="waitForRow"/> | ||
<see userInput="{{taxIdentifier}}" selector="{{AdminTaxRateGridSection.taxIdentifierByRow(rowIndex)}}" stepKey="seeTaxIdentifier"/> | ||
<see userInput="{{country}}" selector="{{AdminTaxRateGridSection.countryByRow(rowIndex)}}" stepKey="seeCountry"/> | ||
<see userInput="{{region}}" selector="{{AdminTaxRateGridSection.regionByRow(rowIndex)}}" stepKey="seeRegion"/> | ||
<see userInput="{{zip}}" selector="{{AdminTaxRateGridSection.zipByRow(rowIndex)}}" stepKey="seeZip"/> | ||
<see userInput="{{rate}}" selector="{{AdminTaxRateGridSection.rateByRow(rowIndex)}}" stepKey="seeRate"/> | ||
</actionGroup> | ||
</actionGroups> |
32 changes: 32 additions & 0 deletions
32
app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteMultipleTaxRatesActionGroup.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,32 @@ | ||
<?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="AdminDeleteMultipleTaxRatesActionGroup"> | ||
<annotations> | ||
<description>Navigates to the 'Tax Zones and Rates' page and deletes all specified rows one by one. Defaults | ||
to delete all rows except the defaults of 'US-CA-*-Rate 1' and 'US-NY-*-Rate 1'.</description> | ||
</annotations> | ||
<arguments> | ||
<argument name="rowsToDelete" defaultValue="{{AdminTaxRateGridSection.allNonDefaultTaxRates}}" type="string"/> | ||
<argument name="expectedRemainingRows" defaultValue="2" type="string"/> | ||
</arguments> | ||
<waitForElementVisible selector="{{AdminLegacyDataGridFilterSection.clear}}" stepKey="waitForResetFilter"/> | ||
<click selector="{{AdminLegacyDataGridFilterSection.clear}}" stepKey="clickResetFilter"/> | ||
<waitForPageLoad stepKey="waitForGridReset"/> | ||
<helper class="\Magento\Tax\Test\Mftf\Helper\TaxHelpers" method="deleteAllSpecifiedTaxRuleRows" stepKey="deleteAllSpecifiedTaxRules"> | ||
<argument name="rowsToDelete">{{rowsToDelete}}</argument> | ||
<argument name="deleteButton">{{AdminMainActionsSection.delete}}</argument> | ||
<argument name="modalAcceptButton">{{AdminConfirmationModalSection.ok}}</argument> | ||
<argument name="successMessage">You deleted the tax rate.</argument> | ||
<argument name="successMessageContainer">{{AdminMessagesSection.success}}</argument> | ||
</helper> | ||
<waitForPageLoad stepKey="waitForGridLoad"/> | ||
<seeNumberOfElements userInput="{{expectedRemainingRows}}" selector="{{AdminTaxRateGridSection.allRows}}" stepKey="seeExpectedFinalTotalRows"/> | ||
</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
Oops, something went wrong.