Skip to content

Commit 8a8d50a

Browse files
committed
B2B-1704: Add MFTF test for MC-38621
- Addressing CR feedback
1 parent 0bcca21 commit 8a8d50a

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

app/code/Magento/Catalog/Test/Mftf/Helper/CurlHelpers.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ class CurlHelpers extends Helper
1919
*
2020
* @param string $url
2121
* @param string $expectedString
22-
* @param string $formKey
22+
* @param string $postBody
2323
* @return void
2424
*
2525
*/
26-
public function assertCurlResponseContainsString($url, $expectedString, $formKey = null): void
26+
public function assertCurlResponseContainsString($url, $expectedString, $postBody = null): void
2727
{
2828
$cookie = $this->getCookie('admin');
29-
$curlResponse = $this->getCurlResponse($url, $cookie, $formKey);
29+
$curlResponse = $this->getCurlResponse($url, $cookie, $postBody);
3030
$this->assertStringContainsString($expectedString, $curlResponse);
3131
}
3232

@@ -35,20 +35,18 @@ public function assertCurlResponseContainsString($url, $expectedString, $formKey
3535
*
3636
* @param string $url
3737
* @param string $cookie
38-
* @param string $formKey
38+
* @param string $postBody
3939
* @return string
4040
*
4141
*/
42-
public function getCurlResponse($url, $cookie = null, $formKey = null): string
42+
private function getCurlResponse($url, $cookie = null, $postBody = null): string
4343
{
4444
// Start Session
4545
$session = curl_init($url);
4646

4747
// Set Options
48-
if ($formKey) {
49-
$data = [
50-
'form_key' => $formKey
51-
];
48+
if ($postBody) {
49+
$data = json_decode($postBody);
5250
curl_setopt($session, CURLOPT_POST, true);
5351
curl_setopt($session, CURLOPT_POSTFIELDS, $data);
5452
}
@@ -69,7 +67,7 @@ public function getCurlResponse($url, $cookie = null, $formKey = null): string
6967
* @return string
7068
*
7169
*/
72-
public function getCookie($cookieName = 'admin'): string
70+
private function getCookie($cookieName = 'admin'): string
7371
{
7472
try {
7573
$webDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');

app/code/Magento/TaxImportExport/Test/Mftf/ActionGroup/AdminExportTaxRatesActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
</annotations>
1515
<waitForElementVisible selector="{{AdminImportExportTaxRatesSection.exportTaxRatesButton}}" stepKey="waitForExportTaxRates"/>
1616
<click selector="{{AdminImportExportTaxRatesSection.exportTaxRatesButton}}" stepKey="clickExportTaxRates"/>
17-
<waitForPageLoad stepKey="waitForImport"/>
17+
<waitForPageLoad stepKey="waitForExport"/>
1818
</actionGroup>
1919
</actionGroups>

app/code/Magento/TaxImportExport/Test/Mftf/Test/AdminExportTaxRatesTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
<executeJS function="return window.FORM_KEY" stepKey="grabFormKey"/>
4747
<helper class="\Magento\Catalog\Test\Mftf\Helper\CurlHelpers" method="assertCurlResponseContainsString" stepKey="assertExportedFileContainsCATaxRate">
4848
<argument name="url">{$grabExportUrl}</argument>
49-
<argument name="formKey">{$grabFormKey}</argument>
49+
<argument name="postBody">{"form_key": "{$grabFormKey}"}</argument>
5050
<argument name="expectedString">{{US_CA_Rate_1.code}}</argument>
5151
</helper>
5252
<helper class="\Magento\Catalog\Test\Mftf\Helper\CurlHelpers" method="assertCurlResponseContainsString" stepKey="assertExportedFileContainsNYTaxRate">
5353
<argument name="url">{$grabExportUrl}</argument>
54-
<argument name="formKey">{$grabFormKey}</argument>
54+
<argument name="postBody">{"form_key": "{$grabFormKey}"}</argument>
5555
<argument name="expectedString">{{US_NY_Rate_1.code}}</argument>
5656
</helper>
5757
</test>

0 commit comments

Comments
 (0)